[23385] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 5604 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 2 14:08:51 2003

Date: Thu, 2 Oct 2003 11:05:14 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Thu, 2 Oct 2003     Volume: 10 Number: 5604

Today's topics:
    Re: [newbie] how to walk values on a column in perl (Tad McClellan)
    Re: [newbie] how to walk values on a column in perl (Greg Bacon)
    Re: Backup your projects neatly (Tad McClellan)
    Re: c.l.p.announce MIA (was:  boston perl classes with  (Randal L. Schwartz)
    Re: c.l.p.announce MIA (was:  boston perl classes with  <graham.drabble@lineone.net>
        Converting Mail::Internet to MIME::Entity? (Robert Nicholson)
    Re: dashes or tildies? <mbudash@sonic.net>
        data varification code logic <king21122@yahoo.com>
    Re: DBI <someone@somewhere.com>
    Re: DBI <tore@aursand.no>
    Re: examples of sprintf <raisin@delete-this-trash.mts.net>
    Re: examples of sprintf <ict@eh.org>
        finding net::Ping <abcd@efg.com>
    Re: finding net::Ping <HelgiBriem_1@hotmail.com>
    Re: finding net::Ping <nobull@mail.com>
    Re: hashes (John Carroll)
    Re: hashes (John Carroll)
    Re: How to generate this list? <mikeflan@earthlink.net>
        I would like to use unsupported variant type VT_I8 and  (Stephan Meszaros)
        IsSorted @list ? 1 : 0 <king21122@yahoo.com>
    Re: IsSorted @list ? 1 : 0 <nobull@mail.com>
    Re: Oops, 5.8.1 broke my program (Al MacHonahey)
        Perl 5.8 UTF-8 RedHat SLOW (Mike)
    Re: Perl CGI executing command line functions (Nick)
    Re: Perl CGI executing command line functions <flavell@ph.gla.ac.uk>
    Re: Perl CGI executing command line functions <nobull@mail.com>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: Thu, 2 Oct 2003 08:53:07 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: [newbie] how to walk values on a column in perl
Message-Id: <slrnbnobe3.uu0.tadmc@magna.augustmail.com>

John <news2003@wanadoo.es> wrote:

> If I want to walk the colunms on one array of array, How do you do
> that?
> 
> This is my case
> 
> @a = (
>       [qw/a b c d e/],
>       [qw/1 b m e f/],
>       [qw/c b n g h/],
>       [qw/j b l z y/]
>       ),
> 


   my @col1 = map $_->[1], @a;


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 02 Oct 2003 14:18:45 -0000
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: [newbie] how to walk values on a column in perl
Message-Id: <vnocu5nfqrdg33@corp.supernews.com>

: If I want to walk the colunms on one array of array, How do you do
: that?

There's more than one way to do it:

    #! /usr/local/bin/perl

    use warnings;
    use strict;

    sub transpose {
        my $max = 0;
        for (@_) {
            $max = @$_ if @$_ > $max;
        }

        my @t = map [], 1..$max;

        for (@_) {
            my @a = (@$_, map undef, 1..$max-@$_);

            for (@a) {
                my $top = shift @t;
                push @$top => $_;
                push @t, $top;
            }
        }

        wantarray ? @t : \@t;
    }

    sub column {
        my $i = shift;

        my @col = map $_->[$i], @_;

        wantarray ? @col : \@col;
    }

    sub equal {
        return 1 unless @_;

        my $first = shift;
        for (@_) {
            return unless $_ eq $first;
        }

        1;
    }

    sub equal_column_transpose {
        my $i = shift;

        my @t = transpose @_;

        print "transpose: column $i: ";
        if (equal @{ $t[$i] }) {
            print "equal\n";
        }
        else {
            print "not equal\n";
        }
    }

    sub equal_column_slice {
        my $i = shift;

        print "slice:     column $i: ";
        if (equal column $i, @_) {
            print "equal\n";
        }
        else {
            print "not equal\n";
        }
    }

    ## main
    my @a = (
        [qw/a b c d e/],
        [qw/1 b m e f/],
        [qw/c b n g h/],
        [qw/j b l z y/]
    );

    foreach my $col (0..4) {
        foreach my $cmp (\&equal_column_transpose, \&equal_column_slice) {
            $cmp->($col, @a);
        }
    }

: [...]

Hope this helps,
Greg
-- 
But the majesty of capitalism is not that it that it
makes people rich, but that it makes them humble.
    -- Bill Bonner


------------------------------

Date: Thu, 2 Oct 2003 08:43:37 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Backup your projects neatly
Message-Id: <slrnbnoas9.uri.tadmc@magna.augustmail.com>

Guy <Dont.Reply@please.com> wrote:
> 
> If you are tired 


I am tired of people of abusing Usenet with spam.

Do you have a product that helps find other people with
your lack of ethics?


> Relative Reversion is a new innovative product


Don't do business with unethical businesses...


-- 
    Tad McClellan                          SGML consulting
    tadmc@augustmail.com                   Perl programming
    Fort Worth, Texas


------------------------------

Date: Thu, 02 Oct 2003 15:16:17 GMT
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: c.l.p.announce MIA (was:  boston perl classes with damian conway)
Message-Id: <fb7dc9ababe6be795267a5026f48b59b@news.teranews.com>

>>>>> "Randal" == Randal L Schwartz <merlyn@stonehenge.com> writes:

Randal> I was unaware that my chosen usenet posting host has been blocking all
Randal> such attempts, legitimate or not, for a long time.  I'm in search of a
Randal> posting host that will let me inject moderated articles.  Once I find
Randal> that, I can again resume CLPA postings.

By the way, in case it hadn't been noticed, CLPA is once again flowing.
I found another host to inject moderated articles, and the first
new post (after a three month dry spell) was the 5.8.1 announcement.
Good timing. :)

So, feel free to post to CLPA again.

print "Just another Perl hacker," # and your CLPA moderator since 1995
-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!


------------------------------

Date: Thu, 02 Oct 2003 16:46:39 +0100
From: Graham Drabble <graham.drabble@lineone.net>
Subject: Re: c.l.p.announce MIA (was:  boston perl classes with damian conway)
Message-Id: <Xns9408AAABD6C4Egrahamdrabblelineone@ID-77355.user.dfncis.de>

On 02 Oct 2003 merlyn@stonehenge.com (Randal L. Schwartz) wrote in
news:fb7dc9ababe6be795267a5026f48b59b@news.teranews.com: 

>>>>>> "Randal" == Randal L Schwartz <merlyn@stonehenge.com> writes:
> 
> Randal> I was unaware that my chosen usenet posting host has been
> Randal> blocking all such attempts, legitimate or not, for a long
> Randal> time.  I'm in search of a posting host that will let me
> Randal> inject moderated articles.  Once I find that, I can again
> Randal> resume CLPA postings. 
> 
> By the way, in case it hadn't been noticed, CLPA is once again
> flowing. I found another host to inject moderated articles, 

Oh good. It did surprise me somewhat when I found that you were the 
moderator of record!

> print "Just another Perl hacker," # and your CLPA moderator since
> 1995 

Long may it continue.

-- 
Graham Drabble
If you're interested in what goes on in other groups or want to find 
an interesting group to read then check news.groups.reviews for what 
others have to say or contribute a review for others to read.


------------------------------

Date: 2 Oct 2003 08:00:00 -0700
From: robert@elastica.com (Robert Nicholson)
Subject: Converting Mail::Internet to MIME::Entity?
Message-Id: <24a182bd.0310020700.5178d00e@posting.google.com>

The docs for MIME::Entity suggest you can do this to build a data
array reference for use with parse_data

#my @lines = (@{$mail->header}, "\n", @{$mail->body});

in my case whenever I do this I end up with @lines omitting all header
information.

Currently I'm doing this

@msg = split('\n', $mail->as_string());
@newMsg = map { $_ .= "\n" } @msg;

but I'm sure there's a better way.


------------------------------

Date: Thu, 02 Oct 2003 17:02:43 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: dashes or tildies?
Message-Id: <mbudash-EE5C79.10024402102003@typhoon.sonic.net>

In article <hj0onvsvjlbjhi4ttghmerdsuid4sjhlbn@4ax.com>,
 Helgi Briem <HelgiBriem_1@hotmail.com> wrote:

> On Wed, 01 Oct 2003 22:25:52 +0200, Tore Aursand <tore@aursand.no>
> wrote:
> 
> >In addition, I would have used an existing module to actually send the
> >mail.  Never done that in a long time myself, but I remember Net::SMTP
> >being a nice one.
> 
> I like MIME::Lite. 
> 

my personal choice as well.

-- 
Michael Budash


------------------------------

Date: Fri, 03 Oct 2003 03:17:48 +1000
From: King <king21122@yahoo.com>
Subject: data varification code logic
Message-Id: <3F7C5DBC.2020602@yahoo.com>

Hello

I have a data file and need to build another file with the data sorted 
and douplicated data removed based on the first column value.

so
1- use the values-after-sorting of the first column as keys
2- make another array with only the values that are mentioned more than 
once.
3- put the first file in an Hash of Arrays.
4- use the values-after-sorting array and the douplicate-value array to 
build the new file.

is there a better logic to do this or better yet a perl module?

thanks alot



#collect all the values of the first column in an array
my @col_1;
while (<DATA>) {
     my @L = split;
     push @col_1, $L[0]; #could those 2 lines be combined in one?
}

#sort the array
my @sorted = sort @col_1;

#build array with only those values which are mentioned more than once
my @double;
for my $i ( 0 .. $#sorted ) {
   my $counter = 1;
   while ( $counter > 0 ) {
     if ( $sorted[$i] =! $sorted[$i+1] ) {
        $counter = 0
      } else {
	   push @double, $sorted[$i]; #a problem here. will collect the same 
value more than once which I don't want. need help please
        $i = $i + 1;
      }

}



------------------------------

Date: Thu, 2 Oct 2003 15:07:57 +0100
From: "Bigus" <someone@somewhere.com>
Subject: Re: DBI
Message-Id: <blhbfu$13ou@newton.cc.rl.ac.uk>


"ko" <kuujinbo@hotmail.com> wrote in message
news:blh39r$mp0$1@pin3.tky.plala.or.jp...
> Bigus wrote:
>
> [snip]
> > That works to a point, but it's not bullet-proof. ie: some email
addresses
> > have, for example, a single quote in them like:
> >
> > f.o'neill@somewhere.com
> >
> > A quote causes the above to generate the following error:
> >
> > You have an error in your SQL syntax near
> > 'neill@somewhere.com','1065092739','618BA732FF2A739F6E')' at line 1.
>
> Look into the placeholders and bind values section of the DBI docs.

Thanks.. sorted with the $db->quote() command in this case. The placeholders
& binding thing looks like it might be useful for other parts of my script.

Regards
Bigus




------------------------------

Date: Thu, 02 Oct 2003 17:47:18 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: DBI
Message-Id: <pan.2003.10.02.12.40.42.160229@aursand.no>

On Thu, 02 Oct 2003 12:17:23 +0100, Bigus wrote:
> # check if row exists and update / insert as appropriate
> @row = $db->selectrow_array("SELECT * FROM tickets WHERE email = '$email'");
> 
> if($row[0] =~ /\w+/){
>       $db->do("UPDATE tickets SET time = '$thetime', ticket = '$ticket'
> WHERE email = '$email'");
> }
> else{
>       $db->do("INSERT INTO tickets (email,time,ticket) VALUES
> ('$email','$thetime','$ticket')");
> }
> 
> # check for DB errors
> if($db->errstr){
>        print $db->errstr;
> }

Problems occur when the data you insert into the SQL query contain single
quotes (or other non-escaped special characters).

The easiest way to deal with problems like this is to _always_ bind
variables into your SQL query.  I recommend this way of doing it even when
you are 110% sure that the data you're about to insert into the SQL is
"clean";

  my $stExists = $dhh->prepare('SELECT COUNT(*)
                                FROM   tickets
                                WHERE  email = ?');
  $stExists->execute( $email );
  my ( $exists ) = $stExists->fetchrow();
  $stExists->finish();

  if ( $exists ) {
      my $stUpdate = $dbh->prepare('UPDATE tickets
                                    SET    time = ?,
                                           ticket = ?
                                    WHERE  email = ?');
      $stUpdate->execute( $thetime, $ticket, $email );
      $stUpdate->finish();
  }
  else {
      my $stInsert = $dbh->prepare('INSERT INTO tickets
                                    VALUES (email, time, ticket)
                                           (?, ?, ?)');
      $stInsert->execute( $email, $thetime, $ticket );
      $stInsert->finish();
  }

Lookup 'perldoc DBI' for more information about bind'ing values into SQL
queries.


-- 
Tore Aursand <tore@aursand.no>


------------------------------

Date: Thu, 2 Oct 2003 08:05:29 -0500
From: Barry Kimelman <raisin@delete-this-trash.mts.net>
Subject: Re: examples of sprintf
Message-Id: <MPG.19e5de96fd9f7f5d989698@news.mts.net>

[This followup was posted to comp.lang.perl.misc]

In article <3F7AF041.20009@yahoo.com>, king21122@yahoo.com says...
> Hello
> 
> are there some easy examples on how to use the sprintf, examples that 
> will assume you don't know any thing about the function and takes you 
> one step at the time teaching you the ins and outs on its usage?
> I have read the online docs, but need more easy examples.
> 
> I am trying to add numbers 20 infront of the format %d%02d%02d and could 
> not find an example on how to do it.
> 
> thanks

$string = sprintf "20%d%02d%02d",$number1,$number2,$number3;


------------------------------

Date: 2 Oct 2003 23:27:42 +1000
From: Iain Truskett <ict@eh.org>
Subject: Re: examples of sprintf
Message-Id: <slrnbnoaeb.tqk.ict@dellah.org>

* King <king21122@yahoo.com>:
>  are there some easy examples on how to use the sprintf, examples that 
>  will assume you don't know any thing about the function and takes you 
>  one step at the time teaching you the ins and outs on its usage?
>  I have read the online docs, but need more easy examples.

perldoc -f sprintf  (if you do bother to read it all the way through)
does have examples and does take a fairly basic approach along with its
going into more depth.

If you're on a unix-like system, you can also do 'man sprintf' to see
the C library's version which has much the same syntax.

See also any decent Perl beginners book or C beginners book.


cheers,
-- 
Iain.                                          <http://eh.org/~koschei/>


------------------------------

Date: Thu, 02 Oct 2003 11:27:28 -0500
From: Ben <abcd@efg.com>
Subject: finding net::Ping
Message-Id: <blhjlg$ci8m8$1@ID-121117.news.uni-berlin.de>

Hi,

I have the line "use net::Ping" in a perl script and then later a call 
to a function called pingecho.  How do I find out what pingecho does. 
Where do I find net::Ping?

Thanks,
Ben



------------------------------

Date: Thu, 02 Oct 2003 16:34:18 +0000
From: Helgi Briem <HelgiBriem_1@hotmail.com>
Subject: Re: finding net::Ping
Message-Id: <gokonvscaopi8aip70gtotmcfrhluukp3f@4ax.com>

On Thu, 02 Oct 2003 11:27:28 -0500, Ben <abcd@efg.com> wrote:

>I have the line "use net::Ping" in a perl script and then later a call 
>to a function called pingecho.  How do I find out what pingecho does. 

perldoc Net::Ping

>Where do I find net::Ping?

Where the Spelling Police put it in the evidence locker.

Its name is Net::Ping, not net::Ping.  Case matters.  


------------------------------

Date: 02 Oct 2003 17:33:26 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: finding net::Ping
Message-Id: <u965j7ha5l.fsf@wcl-l.bham.ac.uk>

Ben <abcd@efg.com> writes:

> I have the line "use net::Ping"

I shall assume you mean "use Net::Ping"

> in a perl script and then later a call to a function called
> pingecho.  How do I find out what pingecho does.

Look at the source or read the documentation (perldoc Net::Ping).

> Where do I find net::Ping?

In the usual place (see FAQ "What modules and extensions are available
for Perl?...").

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: 2 Oct 2003 10:12:05 -0700
From: john.carroll@usap.gov (John Carroll)
Subject: Re: hashes
Message-Id: <6b4da9ff.0310020912.6f4a6f59@posting.google.com>

tiltonj@erols.com (Jay Tilton) wrote in message news:<3f7b5690.165868900@news.erols.com>...
> john.carroll@usap.gov (John Carroll) wrote:
> 
> : but my comparison to a string doesn't work.  I
> : concatenated it with an empty string and I still get the same answer
> : as originally, which was that if I compare two strings that print
> : identically, 
> 
> Could there be leading or trailing whitespace in either string?  That
> could cause them to _appear_ to be identical without being identical.
> Surrounding the printed string with visible characters can reveal the
> presence of whitespace.

I already thought of that, but thanks for the idea.  I happen to use
the vertical bar "|", but anything works. :^)

>     $file_password = "test";
>     $password = $in{"Password"};
>     print "-->$password<--";
>     print "-->$file_password<--";
>     if ($password ne $file_password) {
>         $incorrect_pw = "true";
>     }


------------------------------

Date: 2 Oct 2003 10:22:22 -0700
From: john.carroll@usap.gov (John Carroll)
Subject: Re: hashes
Message-Id: <6b4da9ff.0310020922.1402b89b@posting.google.com>

"J. Gleixner" <glex_nospam@qwest.net> wrote in message news:<XqIeb.92$vN4.91555@news.uswest.net>...

*snip to save space*

> > 
> > I don't care, but my comparison to a string doesn't work.  I
> > concatenated it with an empty string and I still get the same answer
> > as originally, which was that if I compare two strings that print
> > identically, the comparison fails (returns not equal).  Also, if I set
> > both variables to strings explicitly, or even only explicitly reset
> > the variable that originally holds the value of the hash %in for the
> > key 'Password', I get the comparison to work properly, but if I leave
> > it as shown above, the comparison fails.
> 
> Short example..
> 
> my $file_password = "test";
> my $password = $in{"Password"};
> my %in;
> $in{"Password"} = "test";
> $in{"Password2"} = $file_password;
> print "1. they're equal\n" if $file_password eq $in{"Password"};
> print "2. they're equal\n" if $file_password eq $password;
> print "3. they're still equal\n" if $file_password eq $in{"Password2"};
> 
> 1. they're equal
> 2. they're equal
> 3. they're still equal

I'll try all of these, to see if I get any different answers.

> Maybe the values you're comparing aren't what you think they are?  Maybe 
> one contains a " "?  Try:
> 
> print "-$password-\n";
> print "-$in{Password}-\n";
> 
> So you can see if there are any blanks in the beginning/end.

See my earlier post... I already tried this, and got identical output.
 Oddly, if I do a cmp on the string, I get a -1 result, which means my
hash value variable is less than the test variable.

thanks,
john


------------------------------

Date: Thu, 02 Oct 2003 14:19:11 GMT
From: Mike Flannigan <mikeflan@earthlink.net>
Subject: Re: How to generate this list?
Message-Id: <3F7C3486.E794BE5F@earthlink.net>


"John W. Krahn" wrote:

> You didn't copy it correctly.  What you have is the translation operator
> y@@@ followed by 'array ]}}" x @array;'.  Change "y @array" to "my
> @array".
>
> John
> --
> use Perl;
> program
> fulfillment

Thanks John.  Very interesting program.  Over my
head for sure, but interesting.

It was taking so long, so I shorted the array to

use strict;
use warnings;

my @array = qw/ A A A B B C /;

print "$_\n" for glob "{@{[ join ',', @array ]}}" x @array;

__END__



------------------------------

Date: 2 Oct 2003 09:11:29 -0700
From: grosmezz@yahoo.com (Stephan Meszaros)
Subject: I would like to use unsupported variant type VT_I8 and VT_UI4.
Message-Id: <d718893a.0310020811.292d4aac@posting.google.com>

Hi, I am a newbie with PERL and I writing a script to access some
ActiveX methods that are using VT_I8 and VT_UI4.
I have succeeded so far accessing other methods that are using the
supported types in the Win32::OLE::Variant module.

How hard would it be to add support for the VT_I8 and VT_UI4 variant
types?
Where do I start?

Thank you!
Stephan


------------------------------

Date: Fri, 03 Oct 2003 01:22:21 +1000
From: King <king21122@yahoo.com>
Subject: IsSorted @list ? 1 : 0
Message-Id: <3F7C42AD.4090304@yahoo.com>

Hello
I need to find out if a data file is sorted by it's first column with is 
suppose to be a unique value.
I am thinking
while (<FH>) {
   push @key, split [0];
}
IsSorted @key ? do this : do that;

thanks



------------------------------

Date: 02 Oct 2003 17:55:38 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: IsSorted @list ? 1 : 0
Message-Id: <u9oewzfuk5.fsf@wcl-l.bham.ac.uk>

King <king21122@yahoo.com> writes:

> I need to find out if a data file is sorted by it's first column with
> is suppose to be a unique value.
> I am thinking
> while (<FH>) {
>    push @key, split [0];
> }
> IsSorted @key ? do this : do that;

I suspect you are asking if there is some cleaver short-cut to
implement the IsSorted function.  

I think the answer is no.  You just do it the obvious way (compare
each element with the next).

Of course there's no need to read the whole lot into memory - you
could just compate the first field of each line with the first field
of the previous line.

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: 2 Oct 2003 10:58:45 -0700
From: 2host.com@inorbit.com (Al MacHonahey)
Subject: Re: Oops, 5.8.1 broke my program
Message-Id: <d784b905.0310020958.211b5bb9@posting.google.com>

Abigail <abigail@abigail.nl> wrote in message news:<slrnbnlvho.ta8.abigail@alexandra.abigail.nl>...
> Wally Sanford (wsanford@wallysanford.com) wrote on MMMDCLXXXIII September
> MCMXCIII in <URL:news:blet5j$ahsqj$1@ID-196529.news.uni-berlin.de>:
> ==  Abigail wrote:
> == > Xaonon (xaonon@hotpop.com) wrote on MMMDCLXXXII September MCMXCIII in
> == > <URL:news:slrnbnkat7.vjm.xaonon@xaonon.local>:
> == > {}  Or, more likely, it was broken before in some way that wasn't
> == > apparent until {}  I installed 5.8.1.  The program in question is a
> == > signature generator, which {}  runs as a daemon and produces random
> == > quips via a named pipe.  The main loop {}  looks like this:
> == > {}
> ==  [Snip more NON STANDARD quoting...]
> ==  
> ==  Abigail, coudl you please refrain from using non standard quoting. It makes
> ==  it more difficult for people who use parsers to sort out quoting levels
> ==  (color coding, etc.) groups.google.com is one such place that does this.
> ==  Thank you.
> ==  
> ==  
> ==  [Heres an old post relating to this, indicating I'm not the first to ask
> ==  either.]
> ==  [Google:
> ==  
> ==  From: planb@newsreaders.com (J. Moreno)
> ==  Subject: Re: Statistics for comp.lang.perl.misc
> ==  Date: 1999/06/22
> 
> 
> Let's see, two requests in 4 years. I can't really be impressed by
> those numbers.
> 
> You have a few options:
>   - Make your parser smarter. It'll be fairly trivial in Perl to read a
>     posting of mine and determine that posts quoting prefix.
>   - Killfile me.
> 
> The latter is the easiest option.
> 
> 
> Abigail

You know, its really ironic how you folks complain profusely if some
goes against Usenet tradition/standards of not top-posting or quoting
entire posts while adding one line of oc, but you feel to go against
another, seemingly because you feel "above" everyone else who tries to
follow the standard/ countless Usenet guidelines that you pretend to
cherish.

You see, using > for quoting characters as been the Usenet standard
(or plain text medium standard for that matter, i.e. email) for
quoting text for over a decade. Many article processors use this, as
have millions of Usenet users do, but you instead for what ever reason
continue your own way, preventing countless article processors to miss
parse your articles, such as stat keepers.

Maybe we should use Abigail's example and start posting using html, as
she has shown us that Usenet tradition/guidelines/standards do not
need to be followed.


------------------------------

Date: 2 Oct 2003 08:48:43 -0700
From: mike@kamloopsbc.com (Mike)
Subject: Perl 5.8 UTF-8 RedHat SLOW
Message-Id: <5478acb6.0310020748.68b31586@posting.google.com>

From: Graham Smith (grehom@ntlworld.com)
Subject: Re: Perl 5.8 UTF-8 RedHat SLOW 
Newsgroups: comp.lang.perl.misc
Date: 2003-06-14 02:04:02 PST 

>> 
>> I have built a new P4 RedHat 9 webserver to replace my old P3 Linux
>> 7.2 webserver, and found it to be significantly slower than the old
P3
>> machine.  

>When you say you built the new machine, are we talking about the
>hardware as well as the software for the os and web site.  When I
>assembled my new computer from m/board and Athlon 2700 processor by
>default it ran (strolled) at a lot slower speed than it is capable
>(defaulted to underclocking).  Have you bench tested the new machine
>with any non-perl software?

I haven't done any further testing since I got the loads to moderate
levels.  Since that time, I've moved to testing out a P4 2.4Ghz with
HyperThreading, 2GB DDR 3200 RAM on 800mhz FSB.  I didn't think it
would make this much difference, but my initial feeling from compiling
MySQL, Apache, PHP etc. is that this machine is going to handle the
loads better (or at least equal) to the old Solaris 8 machines on the
PIII.  There's no easy scientific way for me to verify this, as the
loads are all based on current customer activity.

(NOTE:  This message had to be posted separately, for some reason I
could not reply to the last thread...)


------------------------------

Date: 2 Oct 2003 06:25:27 -0700
From: kvetchv@yahoo.com (Nick)
Subject: Re: Perl CGI executing command line functions
Message-Id: <3eb8c8ea.0310020525.374773b9@posting.google.com>

Thanks guys.

tadmc@augustmail.com (Tad McClellan) wrote in message 
> You should learn Perl itself first, before moving on to a
> complicated application area such as CGI programs.

sounds like a fine idea and I intend to do this but I was hoping I
could pick up enough to write this CGI program
> 
> Why is it that you do not want to give them command line access?
> 
Our company has a policy that does not allow departments other than IT
to have command line access to the app servers.  Another department in
our company uses a program that makes additions/changes to one of our
app servers & database and the only current way to make these specific
changes is for them to put in a request with the IT department to
manually type in this application's script.
>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote in message news:<blfh4d$bgeu8$1@ID-184292.news.uni-berlin.de>...
> *Some* of the commands? Do they have access to upload and run their
> own CGI scripts? In that case, what prevents them from uploading a
> script and executing *any* system command?
> 
Yes, they do have this control but since they are part of our company
we trust them and the app server and database is their equipment, we
just run/houses/configure so it is unlikely they will do harm to their
own machines
> 
> 
> An example:
> 
>      $result = `ls $commd 2>&1`;
> 
> The '2>&1' part makes it capture also possible error messages in $result.

Thanks!

Gregory Toomey <nospam@bigpond.com> wrote in message news:<1211198.pjaMW0z05n@gregs-web-hosting-and-pickle-farming>...
> It was a dark and stormy night, and Nick managed to scribble:
> 
Aaaaah, the story of my life.

Michael Budash <mbudash@sonic.net> wrote in message news:<mbudash-00DE11.14242401102003@typhoon.sonic.net>...

> the most naive way would be this:
> 
> #----------------------------------------
> #!perl -w
> 
> use strict;
> use CGI qw/:standard/;
> 
> $|++;
> 
> print header();
> 
> my $commd = param('commd');
> 
> print `ls $commd`;
> #----------------------------------------
> 
> however... think of what would happen if the user entered "; rm -fr *.*" 
> !!!!!!!
> 
> you might wanna constrain what is allowable...


We would restrict them to only certain commands.  While that doesn't
mean that they couldn't put a pipe in the options and enter a 2
commands at once but it is unlikely they would try to do any harm.
Thanks for the help!


------------------------------

Date: Thu, 2 Oct 2003 15:53:36 +0100
From: "Alan J. Flavell" <flavell@ph.gla.ac.uk>
Subject: Re: Perl CGI executing command line functions
Message-Id: <Pine.LNX.4.53.0310021545310.12654@ppepc56.ph.gla.ac.uk>

On Thu, 2 Oct 2003, Nick wrote:

> sounds like a fine idea and I intend to do this but I was hoping I
> could pick up enough to write this CGI program

As others have already warned you in various ways: you seem to be
setting yourself up for a security compromise.

Don't misunderstand me: there's nothing wrong with playing around and
exploring the capabilities of your various tools, and everybody needs
to make a start somewhere;  but for a serious production application
you _do_ need a sound grasp of the components (Perl, CGI,
security...), and it seems to me that you are playing with fire if you
attempt it with less.  I'm not sure that I'd want to trust myself to
get that sort of thing right without some aggressive peer-review, and
I've been dealing with computers, off and on, since 1958.

It isn't a simple matter of "trusting" the users: maybe they hadn't
appreciated the consequences of their well-intentioned actions, but if
you haven't screened them effectively enough from the dangerous bits
them the result would be as bad, irrespective of their intentions in
the matter.  Isn't that why the company policy is to keep them away
from the command line in the first place, after all?


------------------------------

Date: 02 Oct 2003 17:50:59 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Perl CGI executing command line functions
Message-Id: <u9smmbfurw.fsf@wcl-l.bham.ac.uk>

kvetchv@yahoo.com (Nick) writes:

> tadmc@augustmail.com (Tad McClellan) wrote in message 

> > Why is it that you do not want to give them command line access?
> > 
> Our company has a policy that does not allow departments other than IT
> to have command line access to the app servers.

This reminds me of something that I've heard of happening in a number
of places in one form or another.

The basic senario comes down to this.

Someone in a company decides that some resource needs to be protected
from the masses.  So the rooms containing that resource have their
locks changed.  The minions are not given keys to the rooms where the
valuable resource is housed.

However, in order to do their jobs the minions need to use the
resource.  The solution is to hang a key to the secure rooms in a
place where everyone (including visitors without even the minions'
keys) can get to it.  

-- 
     \\   ( )
  .  _\\__[oo
 .__/  \\ /\@
 .  l___\\
  # ll  l\\
 ###LL  LL\\


------------------------------

Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 6 Apr 01)
Message-Id: <null>


Administrivia:

The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc.  For subscription or unsubscription requests, send
the single line:

	subscribe perl-users
or:
	unsubscribe perl-users

to almanac@ruby.oce.orst.edu.  

To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.

To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.

For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.


------------------------------
End of Perl-Users Digest V10 Issue 5604
***************************************


home help back first fref pref prev next nref lref last post