[21837] in Perl-Users-Digest

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

Perl-Users Digest, Issue: 4041 Volume: 10

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 29 03:05:35 2002

Date: Tue, 29 Oct 2002 00:05:12 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Tue, 29 Oct 2002     Volume: 10 Number: 4041

Today's topics:
        ---logfile analysis <zhaoq@onelink.com.cn>
    Re: ---logfile analysis (Tad McClellan)
    Re: ---logfile analysis <zhaoq@onelink.com.cn>
    Re: ---logfile analysis <goldbb2@earthlink.net>
        [ANN] Tk::Task 1.1 uploaded to CPAN <kevin@vaildc.net>
    Re: amateur socketeer: long wait <nospam@nospam.com>
    Re: Best way to traverse multilevel hash? <wksmith@optonline.net>
    Re: Can package names be supplied on-the-fly? <goldbb2@earthlink.net>
    Re: Can package names be supplied on-the-fly? (Randal L. Schwartz)
    Re: deleting a file... kill ??? <kelly@pcocd2.intel.com>
    Re: diff that ignores newlines? (Alan Barclay)
        Exceptions from SOAP::Lite using Google API <David.Squire@csse.monash.edu.au>
    Re: Exceptions from SOAP::Lite using Google API <s_grazzini@hotmail.com>
    Re: exclusive execution of a perl script <kelly@pcocd2.intel.com>
    Re: filehandles in reference array within reference has <goldbb2@earthlink.net>
    Re: flock question addendum (tî'pô)
    Re: HTML Text Substitution CGI <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
    Re: newbie LWP redirect/cookie question (RP)
        POST filter (hsasshofer)
    Re: setreuid on AIX 5.1 with perl 5.6.1 <techcog@acme.N3T>
    Re: significance of 42 for perl, any?!? <ak@freeshell.org.REMOVE>
        Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)

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

Date: Tue, 29 Oct 2002 10:43:27 +0800
From: "Bill zhao" <zhaoq@onelink.com.cn>
Subject: ---logfile analysis
Message-Id: <apksjs$853$1@mail.cn99.com>

I start my perl learning for a month now
now I am processing a log file. its content format is like below:

Oct 28 18:13:26 intra xinetd[504]: START: smtp pid=18217 from=192.168.0.87
Oct 28 18:13:27 intra xinetd[504]: EXIT: smtp status=0 pid=18217
duration=1(sec)
Oct 28 18:13:27 intra xinetd[504]: START: smtp pid=18218 from=192.168.0.87
Oct 28 18:13:33 intra xinetd[504]: EXIT: smtp status=0 pid=18218
duration=6(sec)
Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18458 from=192.168.0.252
Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18459 from=192.168.0.252
Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18460 from=192.168.0.252
Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18461 from=192.168.0.252
Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18458
duration=6(sec)
Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18461
duration=6(sec)
Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18459
duration=6(sec)
Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18460
duration=6(sec)
Oct 29 08:58:33 intra xinetd[504]: START: smtp pid=19344 from=192.168.0.252
Oct 29 08:58:35 intra xinetd[504]: EXIT: smtp status=0 pid=19344
duration=2(sec)
Oct 29 09:07:20 intra xinetd[504]: START: smtp pid=19673 from=192.168.0.39
Oct 29 09:07:20 intra xinetd[504]: START: smtp pid=19675 from=192.168.0.92
Oct 29 09:07:24 intra xinetd[504]: EXIT: smtp status=0 pid=19675
duration=4(sec)
Oct 29 09:07:25 intra xinetd[504]: EXIT: smtp status=0 pid=19673
duration=5(sec)

*Note: Obviously the 2 lines contain the same value of pid belong to one
consession.

  I am going to build a file each line of which contain a consession. the
above log flile
only put the consession start lines and exit lines, the same consession's
start line and
exit line  do not always live together.
Somebody can tell me a mechanism to do this work?
Thank you in advance
Bill Zhao







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

Date: Mon, 28 Oct 2002 22:46:09 -0600
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: ---logfile analysis
Message-Id: <slrnars4kh.21h.tadmc@magna.augustmail.com>

Bill zhao <zhaoq@onelink.com.cn> wrote:

> I am processing a log file.

> *Note: Obviously the 2 lines contain the same value of pid belong to one
> consession.
> 
>   I am going to build a file each line of which contain a consession. 


Use a "hash of hashes" (HoH) data structure. First level keys
are PIDs, second level keys are START and EXIT:

--------------------------------------------------
#!/usr/bin/perl
use warnings;
use strict;

my %log;
while ( <DATA> ) {
   next unless /(START|EXIT):.*?pid=(\d+)/;
   $log{$2}{$1} = $_;
}

foreach my $pid ( sort keys %log ) {
   print $log{$pid}{START};
   print $log{$pid}{EXIT};
}

__DATA__
Oct 28 18:13:26 intra xinetd[504]: START: smtp pid=18217 from=192.168.0.87
Oct 28 18:13:27 intra xinetd[504]: EXIT: smtp status=0 pid=18217 duration=1(sec)
Oct 28 18:13:27 intra xinetd[504]: START: smtp pid=18218 from=192.168.0.87
Oct 28 18:13:33 intra xinetd[504]: EXIT: smtp status=0 pid=18218 duration=6(sec)
Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18458 from=192.168.0.252
Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18459 from=192.168.0.252
Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18460 from=192.168.0.252
Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18461 from=192.168.0.252
Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18458 duration=6(sec)
Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18461 duration=6(sec)
Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18459 duration=6(sec)
Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18460 duration=6(sec)
Oct 29 08:58:33 intra xinetd[504]: START: smtp pid=19344 from=192.168.0.252
Oct 29 08:58:35 intra xinetd[504]: EXIT: smtp status=0 pid=19344 duration=2(sec)
Oct 29 09:07:20 intra xinetd[504]: START: smtp pid=19673 from=192.168.0.39
Oct 29 09:07:20 intra xinetd[504]: START: smtp pid=19675 from=192.168.0.92
Oct 29 09:07:24 intra xinetd[504]: EXIT: smtp status=0 pid=19675 duration=4(sec)
Oct 29 09:07:25 intra xinetd[504]: EXIT: smtp status=0 pid=19673 duration=5(sec)
--------------------------------------------------


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


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

Date: Tue, 29 Oct 2002 14:49:33 +0800
From: "Bill zhao" <zhaoq@onelink.com.cn>
Subject: Re: ---logfile analysis
Message-Id: <aplb1b$jr6$1@mail.cn99.com>

  Thank you very much, it work perfectly, I will need to learn more
about hash of hashes(HoH)
But by the way I also need to know why "use warnings;" does not work on
my pc RH6.2. the pc is has rpm perl (perl-5.00503-12), I did add some cpan
modules(cannot remember in details,at least including
Time::HiRes)previously.
Actually I can find the module file /usr/local/lib/perl5/5.8.0/warnings.pm
exist there.

"Tad McClellan" <tadmc@augustmail.com> wrote in message
news:slrnars4kh.21h.tadmc@magna.augustmail.com...
> Bill zhao <zhaoq@onelink.com.cn> wrote:
>
> > I am processing a log file.
>
> > *Note: Obviously the 2 lines contain the same value of pid belong to one
> > consession.
> >
> >   I am going to build a file each line of which contain a consession.
>
>
> Use a "hash of hashes" (HoH) data structure. First level keys
> are PIDs, second level keys are START and EXIT:
>
> --------------------------------------------------
> #!/usr/bin/perl
> use warnings;
> use strict;
>
> my %log;
> while ( <DATA> ) {
>    next unless /(START|EXIT):.*?pid=(\d+)/;
>    $log{$2}{$1} = $_;
> }
>
> foreach my $pid ( sort keys %log ) {
>    print $log{$pid}{START};
>    print $log{$pid}{EXIT};
> }
>
> __DATA__
> Oct 28 18:13:26 intra xinetd[504]: START: smtp pid=18217 from=192.168.0.87
> Oct 28 18:13:27 intra xinetd[504]: EXIT: smtp status=0 pid=18217
duration=1(sec)
> Oct 28 18:13:27 intra xinetd[504]: START: smtp pid=18218 from=192.168.0.87
> Oct 28 18:13:33 intra xinetd[504]: EXIT: smtp status=0 pid=18218
duration=6(sec)
> Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18458
from=192.168.0.252
> Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18459
from=192.168.0.252
> Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18460
from=192.168.0.252
> Oct 28 19:06:53 intra xinetd[504]: START: smtp pid=18461
from=192.168.0.252
> Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18458
duration=6(sec)
> Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18461
duration=6(sec)
> Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18459
duration=6(sec)
> Oct 28 19:06:59 intra xinetd[504]: EXIT: smtp status=0 pid=18460
duration=6(sec)
> Oct 29 08:58:33 intra xinetd[504]: START: smtp pid=19344
from=192.168.0.252
> Oct 29 08:58:35 intra xinetd[504]: EXIT: smtp status=0 pid=19344
duration=2(sec)
> Oct 29 09:07:20 intra xinetd[504]: START: smtp pid=19673 from=192.168.0.39
> Oct 29 09:07:20 intra xinetd[504]: START: smtp pid=19675 from=192.168.0.92
> Oct 29 09:07:24 intra xinetd[504]: EXIT: smtp status=0 pid=19675
duration=4(sec)
> Oct 29 09:07:25 intra xinetd[504]: EXIT: smtp status=0 pid=19673
duration=5(sec)
> --------------------------------------------------
>
>
> --
>     Tad McClellan                          SGML consulting
>     tadmc@augustmail.com                   Perl programming
>     Fort Worth, Texas




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

Date: Tue, 29 Oct 2002 02:11:35 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: ---logfile analysis
Message-Id: <3DBE34A7.F986B6A5@earthlink.net>

Bill zhao wrote:
> 
>   Thank you very much, it work perfectly, I will need to learn more
> about hash of hashes(HoH)

See perldoc perreftut, perldoc perldsc, and perldoc perlref.

> But by the way I also need to know why "use warnings;" does not work
> on my pc RH6.2. the pc is has rpm perl (perl-5.00503-12),

The warnings pragma is new with perl5.6 ... you cannot install it on an
older perl, it just doesn't work.  The closest you can do on an older
perl is enable warnings on the #! line, with a -w flag, or add a line to
your code:
   BEGIN{ $^W = 1 }
near the beginning.

> I did add some cpan modules(cannot remember in details,at least
> including Time::HiRes)previously.
> Actually I can find the module file
> /usr/local/lib/perl5/5.8.0/warnings.pm
> exist there.

The warnings module merely turns on certain flags -- the actual warnings
that those flags are generated internally, by the perl binary.  Setting
flags that would tell a particular version of perl to produce certain
warnings will have no effect on earlier versions, which don't look at
those flags.

The warnings module which comes with 5.8 sets flags for some warnings
which aren't recognized by earlier versions (even 5.6.1) ... really, you
should just use the version of warnings.pm that comes with your version
of perl.

And if your perl is so old that it doesn't *have* warnings.pm, then
consider getting a newer perl.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: Wed, 23 Oct 2002 21:39:57 -0400
From: Kevin Michael Vail <kevin@vaildc.net>
Subject: [ANN] Tk::Task 1.1 uploaded to CPAN
Message-Id: <3dbe2b6a$1_8@news.teranews.com>

NAME
    Tk::Task - allow multiple "tasks" to proceed at once

DESCRIPTION
    `Tk::Task' is a module to allow a lengthy operation to be 
    subdivided into smaller pieces, with time to process events between 
    pieces. For example, a program that loaded a large number of 
    records from a database could make the load process a task, 
    allowing the program to remain responsive to events--for example, 
    to handle a Stop button!

    The steps of each task are executed at idle time, one step each 
    time, while "normal" processing (handling the event loop) 
    continues. You might use a task to do simple animations such as 
    turning cards over in a game, or for other purposes.

    A Task is *not* the same as a thread. It is more like a "poor 
    man's" version of threading. However, this is often quite good 
    enough.

CHANGES
    Version 1.1 allows a Task to be created from any widget, not just a 
    MainWindow.

AUTHOR
    Kevin Michael Vail <kevin@vaildc.net>
-- 
Kevin Michael Vail | Dogbert: That's circular reasoning.
kevin@vaildc.net   | Dilbert: I prefer to think of it as no loose ends.
http://www.vaildc.net/kevin/




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

Date: Mon, 28 Oct 2002 23:05:02 -0800
From: "Tan Nguyen" <nospam@nospam.com>
Subject: Re: amateur socketeer: long wait
Message-Id: <3dbe328d_7@nopics.sjc>


"Newbie" <mike_constant@yahoo.com> wrote in message
news:apk6br$2f2oo$1@ID-161864.news.dfncis.de...
[snipped]
>           write(STDOUT, $comeback, $length_1) or die "write error: $!\n";
"write" doesn't take the same arguments as "read". It should be something
similar to the following
write $comeback or die "write error: $!\n";

or  simple
print $comeback;




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

Date: Tue, 29 Oct 2002 03:55:11 GMT
From: "Bill Smith" <wksmith@optonline.net>
Subject: Re: Best way to traverse multilevel hash?
Message-Id: <zEnv9.6488$TH6.5027@news4.srv.hcvlny.cv.net>


"bill" <bill_knight2@yahoo.com> wrote in message
news:apjoko$9u4$1@reader1.panix.com...
>
>
> Is there a better (or at least more elegant) way to traverse a
> multilevel hash than something like
>
> for my $v_1 (values %h) {
>   for my $v_2 (values %$v_1) {
>     for my $v_3 (values %$v_2) {
>       .
>        .
>         .
>          while (my ($k, $v) = each %$v_n) {
>            # etc.
>          }
>         .
>        .
>       .
>     }
>   }
> }


Your approach is very good, but I prefer recursion

#! c:\perl\bin\perl.exe -w
use strict;
my %h = (
 I=>{
  A=>{1=>"one",
   2=>"two",
   },
  B=>"Bee",
  },
 II=>"eyeeye",
);
traverse(\%h, \&process);
# normal exit


sub process{
 my ($key, $value) = @_;
 print "$key => $value\n";
}

sub traverse{
 my ($hash, $process) = @_;
 while (my ($k,$v)= each %$hash){
  if ((ref $v) =~ /HASH/){
   traverse($v, $process);
  } else{
   &$process($k, $v);
  }
 }
}

Bill






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

Date: Mon, 28 Oct 2002 21:53:24 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Can package names be supplied on-the-fly?
Message-Id: <3DBDF824.B4C69E6A@earthlink.net>

James E Keenan wrote:
[snip]
> Here's the way I coded it:
> 
>     my $pkg = __PACKAGE__;
>     {
>         no strict 'refs';
>         foreach (sort keys %{ $pkg . "::" } ) {
>             local *sym = *{ $pkg . "::" . $_ };
>             $reprocess_subs{$_}++ if (defined &sym and $_ =~ /^reprocess_/);
>         }
>     }

Although I didn't mention it, there isn't any need to seperately
fetch the glob and test if the subroutine is defined -- one could do:

   foreach (sort keys %{ $pkg . "::" } ) {
      $reprocess_subs{$_}++ if
         $_ =~ /^reprocess_/
            and defined &{ $pkg . "::" . $_ };
   }

Or, if you don't like the syntax defined &foo, which to *me* looks as if
one is calling foo(), then checking if the results are defined, you
could write it as:

   foreach (sort keys %{ $pkg . "::" } ) {
      $reprocess_subs{$_}++ if
         $_ =~ /^reprocess_/
            and defined *{ $pkg . "::" . $_ }{CODE};
   }

Also... since in your code, $pkg is *always* the current package, since
you assign to it from __PACKAGE__, you could shorten it to:

   foreach (sort keys %{ $pkg . "::" } ) {
      $reprocess_subs{$_}++ if
         $_ =~ /^reprocess_/ and defined *{$_}{CODE};
   }

You can also leave out the '$pkg . "::" .' from other versions of the
code, too.

-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: 28 Oct 2002 23:05:40 -0800
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Can package names be supplied on-the-fly?
Message-Id: <86fzupafnf.fsf@red.stonehenge.com>

>>>>> "Benjamin" == Benjamin Goldberg <goldbb2@earthlink.net> writes:

Benjamin>    foreach (sort keys %{ $pkg . "::" } ) {
Benjamin>       $reprocess_subs{$_}++ if
Benjamin>          $_ =~ /^reprocess_/ and defined *{$_}{CODE};
Benjamin>    }

And even simpler, a routine that can be called from any package:

    sub my_reprocess_subs {
      my $caller_package = shift || caller;
      no strict 'refs';
      grep { /^reprocess_/ and defined *{$_}{CODE} }
        sort keys %{ $caller_package . "::" }
    }

print "Just another Perl hacker,"
-- 
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: 28 Oct 2002 18:33:37 -0800
From: Michael Kelly - FMEC ~ <kelly@pcocd2.intel.com>
Subject: Re: deleting a file... kill ???
Message-Id: <us28z0igeim.fsf@dsm0008.fm.intel.com>


	Just to try to get in a last word about unlink...  It's
	considered poor form in our NFS environment to use the UNLINK
	command.  The implimentors gave us the RM command to remove
	files, and the option "r" to recursively remove files and
	directories.  We have seen problems where ROOT has UNLINK'ed
	directories without first removing the files contained in the
	directories.  Yes ROOT can and will remove directories while
	leaving the files hanging in the void.

-- 
I don't speak for Intel
Michael Kelly (the one in Folsom)
"and nobody is fooled except the usual fools."
--Jonah Goldberg


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

Date: 29 Oct 2002 01:58:44 GMT
From: gorilla@elaine.furryape.com (Alan Barclay)
Subject: Re: diff that ignores newlines?
Message-Id: <1035856724.161959@elaine.furryape.com>

In article <cc064bc7.0210281506.5af78cf8@posting.google.com>,
Paul M Lieberman <paulmlieberman@alum.mit.edu> wrote:
>I'm looking for a utility, or perl code, that will compare two html
>files such that , if the two files display identically, this diff
>would consider them identical. Obviously, this means ignoring case
>inside tags, but not in displayed text. Also, <a><b>text</a></b>

Then you should format the html file, then diff it. 

HTML::FormatText would be a good start.



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

Date: Tue, 29 Oct 2002 14:53:02 +1100
From: David Squire <David.Squire@csse.monash.edu.au>
Subject: Exceptions from SOAP::Lite using Google API
Message-Id: <3DBE061E.4BDCC0A1@csse.monash.edu.au>

Hi,

I'm using Google's web service API with the SOAP::Lite package.
Occassionally there is a transient problem with connecting to the sever,
and I get an error message such as:

500 Can't connect to api.google.com:80 (Bad hostname 'api.google.com')
at <myprog> line 736

The line in question is $GoogleResult =
$GoogleService->doGoogleSearch(...), which normally works fine.

My problem is that this error causes the program to die. I would like to
be able to catch the exception, and continue as I see fit. I'm not sure
which package is actually generating the error message, since
SOAP:Lite.pm uses quite a few.

I would be most grateful for any pointers...

Cheers,

D.



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

Date: Tue, 29 Oct 2002 04:44:01 GMT
From: Steve Grazzini <s_grazzini@hotmail.com>
Subject: Re: Exceptions from SOAP::Lite using Google API
Message-Id: <lmov9.54601$gB.12931983@twister.nyc.rr.com>

David Squire <David.Squire@csse.monash.edu.au> wrote:
> 
> I'm using Google's web service API with the SOAP::Lite package.
> Occassionally there is a transient problem with connecting to the sever,
> and I get an error message such as:
> 
> 500 Can't connect to api.google.com:80 (Bad hostname 'api.google.com')
> at <myprog> line 736
> 
> The line in question is $GoogleResult =
> $GoogleService->doGoogleSearch(...), which normally works fine.
> 
> My problem is that this error causes the program to die. I would like to
> be able to catch the exception, and continue as I see fit. I'm not sure
> which package is actually generating the error message, since
> SOAP:Lite.pm uses quite a few.
> 
> I would be most grateful for any pointers...

The standard way to trap exceptions is with eval() and $@.

  eval {
    ... code that dies ...
  };

  if ($@) {
    ... handle error ...
  }


Check:

  $ perldoc -f eval

-- 
Steve

perldoc -qa.j | perl -lpe '($_)=m("(.*)")'


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

Date: 28 Oct 2002 18:02:46 -0800
From: Michael Kelly - FMEC ~ <kelly@pcocd2.intel.com>
Subject: Re: exclusive execution of a perl script
Message-Id: <us2bs5egfy1.fsf@dsm0008.fm.intel.com>

"Saket Rungta" <saketrungta@hotmail.com> writes:

> If cron runs perl script ocassionally and we need to check whether previous
> run finished, how should it be done (elegantly)?
> 
> (without temp files writing usage, without killing all perl on ps etc.)

	Saket,

	I take another approach.  Assuming your cron job is only going
	to die in a system call, and not in PERL.  When I want to make
	a system call, I set an alarm, then allow 300 seconds (5
	minutes) for the command to complete.  If the command does not
	complete in five minutes, I get a mail message.  Could be a
	page if needed.  Here is the code:

sub RshCommand {
my ($Rexecutable, $Rhost, $Rtimeout) = @_;
my $executable = $$Rexecutable;
my $host = $$Rhost;
my $timeout = $$Rtimeout;
eval {
    local $SIG{ALRM} = sub { &SendMail($host, $executable, $@, "died in alarm");
        die "alarm\n" };
    alarm $timeout;
#### open(RSH, "rsh $host $executable")or warn '"', __FILE__, '", \n ', __LINE__, ", \n\n$@\n$!\n";
     open(RSH, "rsh $host $executable");
     @local_data = <RSH>;
#### close(RSH)or warn '"', __FILE__, '", ', __LINE__, ", \ncannot close\n$!\n";
     close(RSH);
    alarm 0;
    };
    if ($@ ) { &SendMail($host, $executable, $@);
    } else {
&Print_SIGs;
    return(\@local_data);
}};

	Here is how I call the subroutine:

# if ($opt_x > 0) {print "host=$_ data=@data\n"};
$timeout = 60; #set 1 minute
$executable = "/usr/budtool/bin/btvolls -l -t | ";
$ref_data = &RshCommand(\$executable, \$Machine_Name, \$timeout);
@data = @$ref_data;

	This code is designed to return the results of a rsh to a
	backup server, and return a list of data.

( Yeah, BudTool is end of life, but I never clean up old scripts, I
tend to re-use the ideas. )



-- 
I don't speak for Intel
Michael Kelly (the one in Folsom)
"and nobody is fooled except the usual fools."
--Jonah Goldberg


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

Date: Mon, 28 Oct 2002 21:55:15 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: filehandles in reference array within reference hash
Message-Id: <3DBDF893.6E2BF725@earthlink.net>

X Onon wrote:
[snip]
>              # how do I dereference the filehandle?
>              # i was trying:
>              print $FH{$item}[0] $line;

See perldoc -f print, and you will learn that this needs to be written
as:

   print { $FH{$item}[0] } $line


-- 
my $n = 2; print +(split //, 'e,4c3H r ktulrnsJ2tPaeh'
 ."\n1oa! er")[map $n = ($n * 24 + 30) % 31, (42) x 26]


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

Date: Tue, 29 Oct 2002 09:34:29 +0200
From: "Teh (tî'pô)" <teh@mindless.com>
Subject: Re: flock question addendum
Message-Id: <gdesruk76j3tdvc5s9hjkn06a8mcqqu4be@4ax.com>

TBN bravely attempted to attach 40 electrodes of knowledge to the
nipples of comp.lang.perl.misc by saying:
>> Have you read the manual at all?
>
>Yes, but my computer is down for the afternoon, so I'm working with pen and
>paper *gasp* for a few hours and I was trying to work through the problem
>while I waited for the I.S. goons to come fix my machine.  :-)

*blink* *blink*

Good job posting with nothing but pen and paper.

You'll have to teach me that trick someday...


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

Date: Tue, 29 Oct 2002 06:28:19 +0100
From: Koos Pol <koos_pol@NO.nl.JUNK.compuware.MAIL.com>
Subject: Re: HTML Text Substitution CGI
Message-Id: <newscache$7v9q4h$wdl$1@news.emea.compuware.com>

Craig Dovey wrote (Monday 28 October 2002 14:51):

> Hi
> I want to have a database with various quotations in it.  eg Hi [_____]
> how
> are you. OR Thanks [_____] see you again.  These quotations will be on an
> HTML page, and the reader can enter their name in to a field, the page
> will
> then reopen with their name substituted into the phrase.  Does anyone know
> where I could find a script to help me do this, as my CGI skills are not
> very hot.  I would assume I'll have to use SQL database if I have many
> quotes.
> Thanks

If you run "perldoc CGI" you'll find a complete example at the very end. 
That should help you get started.

HTH.
-- 
KP



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

Date: 28 Oct 2002 20:44:02 -0800
From: izco@hotmail.com (RP)
Subject: Re: newbie LWP redirect/cookie question
Message-Id: <9e7779b4.0210282044.193aa29c@posting.google.com>

Pierre Asselin <pa@panix.com> wrote in message news:<apffea$s9l$1@reader1.panix.com>...
> In <9e7779b4.0210261646.10918db9@posting.google.com> izco@hotmail.com (RP) writes:
> 
> >Hi all.  Here's my problem:  I'm using LWP::UserAgent, and I'm trying
> >to grab the data from a url and parse out what I need.  I keep getting
> >a 302 Object Moved message.  So from reading the messages here, I've
> >taken that to mean that I need to write a subroutine to handle a
> >redirect on the page.
> 
> No, LWP takes care of that.  However, you're doing a POST, and redirects
> for those are normally not honored, per one of the RFCs.
> 
> Your two choices are:  1) do a GET.  2) if you know for a fact that
> the server expects a POST, enable redirects like this:
> 
>     push @{ua->requests_redirectable}, 'POST';
> 
> Alternatively, put it in your constructor call:
> 
>     my $ua= LWP::UserAgent->new(
> 	requests_redirectable => ['GET', 'HEAD', 'POST'],
> 	cookie_jar => HTTP::Cookies->new(),
>     );
> 
> That one will do cookies too.  Full doc is at
> http://search.cpan.org/author/GAAS/libwww-perl-5.65/lib/LWP/UserAgent.pm .

Well, the server is expecting a POST, so the first idea is ruled out. 
I would try #2, but I don't know where to put that line of code!  I
tried sticking it everywhere, but it never would work.  Where should I
put it?  I tried solution #3, but still get a 302 Object Moved
message.  What am I doing wrong?  I feel like this shouldn't be as
hard as I'm making it.  Any direction/help is so greatly appreciated,
words can't describe...


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

Date: 28 Oct 2002 23:46:10 -0800
From: herbert@sasshofer.com (hsasshofer)
Subject: POST filter
Message-Id: <87548ceb.0210282346.3dd22819@posting.google.com>

Hi,

I want to write a CGI-script that filters some values of a POST
request and then re-POSTS the data to another script. How do I
transfer the param() values to a HTTP:request with the new post? Do I
have to build an escaped string for the $request->content() call
manually or is there an easier way to pass a hash to a POST request?

Thanks for any help.


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

Date: Tue, 29 Oct 2002 06:25:22 GMT
From: "techcog@acme.N3T" <techcog@acme.N3T>
Subject: Re: setreuid on AIX 5.1 with perl 5.6.1
Message-Id: <4178283.QlpYd5TBz2@gryphon>

Villy Kruse wrote:
 
> 
> Translated into ($<, $>) = (12345, 12345);
> That sometimes works, sometimes it leaves the saved user id,
> which may or may not be a problem.  This all depends on the OS
> in question.
> 

Thanks for attempting to answer the original question.  But you've
only just danced around the issue setting up strawmen along the way.
(or if you prefer, since it's halloween, scarecrows)

But the problem lies with perl not AIX.  I will fix perl to behave
with AIX.




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

Date: Tue, 29 Oct 2002 02:27:20 -0000
From: Andreas =?iso-8859-1?Q?K=E4h=E4ri?= <ak@freeshell.org.REMOVE>
Subject: Re: significance of 42 for perl, any?!?
Message-Id: <slrnarrsfj.hqa.ak@otaku.freeshell.org>

Submitted by "Daniel Berger" to comp.lang.perl.misc:
> Bob Dover wrote:
> 
>> "Michele Dondi" wrote...
>> > Is there any particular significance of 42 for perl or is it just my impression?
>>
>> Its the answer to the question about Life, the Universe, and Everything.  We
>> don't know what the question is, but when we do, its answer will be 42.
> 
> I thought the question was, 'What is 8x7?'

AFAIK, 8x7 is "8888888".  You probably meant 8*7.

-- 
(                  )
 ) Andreas Kähäri (
(                  )


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

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 4041
***************************************


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