[29244] in Perl-Users-Digest
Perl-Users Digest, Issue: 488 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jun 6 16:10:10 2007
Date: Wed, 6 Jun 2007 13:09:07 -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 Wed, 6 Jun 2007 Volume: 11 Number: 488
Today's topics:
Re: FAQ 9.1 What is the correct form of response from a <jgibson@mail.arc.nasa.gov>
Re: FAQ 9.1 What is the correct form of response from a <noreply@gunnar.cc>
Re: How to verify a usnername and password? <sbryce@scottbryce.com>
improper return value from net::ping? <bubslg@gmail.com>
Re: improper return value from net::ping? <noreply@gunnar.cc>
MySQL through DBI to XML - module advice wanted <evillen@gmail.com>
Re: Need suggestions on a good locking module <ignoramus27187@NOSPAM.27187.invalid>
Probs Building Perl on HP-UX 11.23 andrew.fabbro@gmail.com
Re: Probs Building Perl on HP-UX 11.23 andrew.fabbro@gmail.com
regular expression ignore example? vorticitywolfe@gmail.com
Re: regular expression ignore example? <mritty@gmail.com>
Re: regular expression ignore example? vorticitywolfe@gmail.com
Re: Search and Replace with perl <jgibson@mail.arc.nasa.gov>
Re: Sending RTF email with Perl? <simon.andrews@bbsrc.ac.uk>
system call xlue897@rogers.com
Re: system call hendedav@gmail.com
Re: Using DateTime <baxter.brad@gmail.com>
Re: using LWP::UserAgent Get method <stoupa@practisoft.cz>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 06 Jun 2007 09:07:38 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: FAQ 9.1 What is the correct form of response from a CGI script?
Message-Id: <060620070907382455%jgibson@mail.arc.nasa.gov>
In article <6kogj4-gdf.ln1@blue.stonehenge.com>, PerlFAQ Server
<brian@stonehenge.com> wrote:
> This is an excerpt from the latest version perlfaq9.pod, which
> comes with the standard Perl distribution. These postings aim to
> reduce the number of repeated questions as well as allow the community
> to review and update the answers. The latest version of the complete
> perlfaq is at http://faq.perl.org .
>
> --------------------------------------------------------------------
>
> 9.1: What is the correct form of response from a CGI script?
>
> (Alan Flavell <flavell+www@a5.ph.gla.ac.uk> answers...)
>
> The Common Gateway Interface (CGI) specifies a software interface
> between a program ("CGI script") and a web server (HTTPD). It is not
> specific to Perl, and has its own FAQs and tutorials, and usenet group,
> comp.infosystems.www.authoring.cgi
That last sentence is not punctuated correctly. I suggest:
"It is not specific to Perl and has its own FAQs, tutorials, and usenet
group (comp.infosystems.www.authoring.cgi)."
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Wed, 06 Jun 2007 18:23:53 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: FAQ 9.1 What is the correct form of response from a CGI script?
Message-Id: <5co5hqF31rhc0U1@mid.individual.net>
Jim Gibson wrote:
> That last sentence is not punctuated correctly. I suggest:
>
> "It is not specific to Perl and has its own FAQs, tutorials, and usenet
> group (comp.infosystems.www.authoring.cgi)."
The punctuation left aside, ciwac is still broken, isn't it?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 06 Jun 2007 10:06:26 -0600
From: Scott Bryce <sbryce@scottbryce.com>
Subject: Re: How to verify a usnername and password?
Message-Id: <FY6dnRdY7PEcRvvbnZ2dnUVZ_rTinZ2d@comcast.com>
nightcats@gmail.com wrote:
> Yes, it's a web-based discussion board. It is an old WWWboard Board,
> written by a guy Matt from Matt's Script website long tme ago.
Do yourself a huge favor and replace it with an updated version found here.
http://nms-cgi.sourceforge.net/scripts.shtml
------------------------------
Date: Wed, 06 Jun 2007 17:13:09 -0000
From: bubslg <bubslg@gmail.com>
Subject: improper return value from net::ping?
Message-Id: <1181149989.953022.88450@q19g2000prn.googlegroups.com>
Help! I have a script that does a pingprobe on a list of servers. I
works fine with perl v5.6.1, but does not work with 5.8.8. It looks
like the return value from net::ping has changed. In 5.6.1 I always
get a return of either 1 or 0. In 5.8.8 I get a 1 or 0 with a bunch
of other data including the ip being pinged appended, meaning my
return value is alway going to be non-0. As a result a simple test
like
use Net::Ping;
my $p = Net::Ping->new("icmp");
print $p->ping("somehost");
$p->close();
is never going to work. Why the change in the return value, and how
do I fix it?
------------------------------
Date: Wed, 06 Jun 2007 19:41:07 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: improper return value from net::ping?
Message-Id: <5coa2lF31nssaU1@mid.individual.net>
bubslg wrote:
> Help! I have a script that does a pingprobe on a list of servers. I
> works fine with perl v5.6.1, but does not work with 5.8.8. It looks
> like the return value from net::ping has changed. In 5.6.1 I always
> get a return of either 1 or 0. In 5.8.8 I get a 1 or 0 with a bunch
> of other data including the ip being pinged appended, meaning my
> return value is alway going to be non-0. As a result a simple test
> like
>
> use Net::Ping;
> my $p = Net::Ping->new("icmp");
> print $p->ping("somehost");
> $p->close();
>
> is never going to work. Why the change in the return value, and how
> do I fix it?
In the latest version of Net::Ping, what the ping() method returns is
context dependent.
perldoc Net::Ping
Evaluate ping() in scalar context:
print scalar $p->ping("somehost");
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Wed, 06 Jun 2007 10:26:16 -0700
From: "evillen@gmail.com" <evillen@gmail.com>
Subject: MySQL through DBI to XML - module advice wanted
Message-Id: <1181150776.017150.47210@i13g2000prf.googlegroups.com>
I am looking for the most appropriate module to do some basic MySQL
through DBI to XML translation.
A bit of searching has found DBIx::XML_RDB which looks like just the
kind of thing I need however I wonder whether anyone could suggest any
other modules that may be better.
Thanks
NJH
------------------------------
Date: Wed, 06 Jun 2007 08:13:38 -0500
From: Ignoramus27187 <ignoramus27187@NOSPAM.27187.invalid>
Subject: Re: Need suggestions on a good locking module
Message-Id: <cvadnbiYO4yfLvvbnZ2dnUVZ_gmdnZ2d@giganews.com>
On Tue, 05 Jun 2007 20:39:09 -0000, trwww <waveright@gmail.com> wrote:
> On Jun 5, 4:23 am, Heinrich.Mis...@univie.ac.at (Heinrich Mislik)
> wrote:
>> In article <MP6dndxNyasrifnbnZ2dnUVZ_v-tn...@giganews.com>, ignoramus27...@NOSPAM.27175.invalid says...
>>
>> >I have a script that I want to run, but only one instance. So I want
>> >to set up crontab to start it every minute, but if it is already
>> >running, I would exit.
>>
>> Look at Proc::PID::File
>
> Theres also File::Pid. A (very) quick glance at the source for both
> leads me to believe File::Pid is cleaner.
>
> Looks like Proc::PID::File isnt portable (uses ps in backticks).
> File::Pid uses perl's kill().
>
> Anyone got any opinions on which is better?
>
> Todd W.
>
I like this module a lot. What I discovered is that there is a program
called "lockfile" (I believe, part of procmail package) that does what
I want. So, my crontab entries look like this:
*/5 04-18 * * * if lockfile -r 1 /tmp/WatchDog.lock ; then $HOME/smile/support/WatchDog.pl; rm /tmp/WatchDog.lock ; fi > ~/log/watchdog.log 2>&1
This means that every 5 minutes I check the lock, and if it is
available, it gets locked and my process runs.
in /etc/rc.d/rc.local I remove these locks when I boot.
i
------------------------------
Date: 6 Jun 2007 10:16:30 -0700
From: andrew.fabbro@gmail.com
Subject: Probs Building Perl on HP-UX 11.23
Message-Id: <1181150140.777280.117830@i38g2000prf.googlegroups.com>
I'm working on building perl 5.8.8 on HP-UX 11.23. I'm using this
configuration...
CC=/opt/ansic/bin/cc Configure -Duselargefiles -Dusethreads -
Duse64bitall -de
...which was derived from the README.HPUX. The system is an Itanium-
based system.
I've made some good progress, but four tests always fail:
Failed Test Stat Wstat Total Fail Failed List
of Failed
-----------------------------------------------------------------------------------------------------------------------
../lib/ExtUtils/t/Constant.t 272 270 99.26% 3-272
../lib/ExtUtils/t/PL_FILES.t 5 1280 9 5 55.56% 3-7
../lib/ExtUtils/t/recurs.t 2 512 25 2 8.00% 6 14
../lib/Net/Ping/t/510_ping_udp.t 2 1 50.00% 2
(2 subtests UNEXPECTEDLY SUCCEEDED), 30 tests and 258 subtests
skipped.
Failed 4/992 test scripts, 99.60% okay. 278/117588 subtests failed,
99.76% okay.
I am not building as root, as I do not have root on this system. I
looked at the .t files but the code is a bit beyond me...how best to
proceed? Looking for some bread crumbs.
Details below. Thanks.
../lib/ExtUtils/t/Constant..................FAILED tests 3-272
Failed 270/272 tests, 0.74% okay
# Failed test in ../lib/ExtUtils/t/PL_FILES.t at line 38.
../lib/ExtUtils/t/PL_FILES..................NOK 3# got: '256'
# expected: '0'
# Makefile out-of-date with respect to Makefile.PL
# Cleaning current config before rebuilding Makefile...
# make -f Makefile.old clean > /dev/null 2>&1
# /app/common/oracle/perl/src/perl-5.8.8/t/perl "-I../../lib" "-
I../../lib" Makefile.PL
# Writing Makefile for PL_FILES::Module
# ==> Your Makefile has been rebuilt. <==
# ==> Please rerun the make command. <==
# false
# *** Error exit code 1
#
# Stop.
# Failed test 'single.out was created'
../lib/ExtUtils/t/PL_FILES..................NOK 4lib/ExtUtils/t/
PL_FILES.t at line 41.
# Failed test '1.out was created'
../lib/ExtUtils/t/PL_FILES..................NOK 5t at line 41.
# Failed test '2.out was created'
# in ../lib/ExtUtils/t/PL_FILES.t at line 41.
../lib/ExtUtils/t/PL_FILES..................NOK 6
# Failed test 'blib/lib/PL/Bar.pm was created'
# in ../lib/ExtUtils/t/PL_FILES.t at line 41.
../lib/ExtUtils/t/PL_FILES..................NOK 7# Looks like you
failed 5 tests of 9.
../lib/ExtUtils/t/PL_FILES..................dubious
Test returned status 5 (wstat 1280, 0x500)
DIED. FAILED tests 3-7
Failed 5/9 tests, 44.44% okay
../lib/ExtUtils/t/recurs....................ok 1/25
# Failed test 'recursive make exited normally'
# in ../lib/ExtUtils/t/recurs.t at line 61.
# got: '256'
# expected: '0'
# Makefile out-of-date with respect to Makefile.PL
# Cleaning current config before rebuilding Makefile...
# make -f Makefile.old clean > /dev/null 2>&1
# /app/common/oracle/perl/src/perl-5.8.8/t/perl "-I../../lib" "-
I../../lib" Makefile.PL
# Writing Makefile for Recurs::prj2
# Writing Makefile for Recurs
# ==> Your Makefile has been rebuilt. <==
# ==> Please rerun the make command. <==
# false
# *** Error exit code 1
#
# Stop.
../lib/ExtUtils/t/recurs....................ok 7/25
../lib/ExtUtils/t/recurs....................NOK 14# Failed test
'recursive make exited normally'
# in ../lib/ExtUtils/t/recurs.t at line 84.
# got: '256'
# expected: '0'
../lib/ExtUtils/t/recurs....................ok 15/25# Looks like you
failed 2 tests of 25.
../lib/ExtUtils/t/recurs....................dubious
Test returned status 2 (wstat 512, 0x200)
DIED. FAILED tests 6, 14
Failed 2/25 tests, 92.00% okay
../lib/Net/Ping/t/510_ping_udp..............ok 1/2# Failed test 2
in ../lib/Net/Ping/t/510_ping_udp.t at line 22
# ../lib/Net/Ping/t/510_ping_udp.t line 22 is: ok $p-
>ping("127.0.0.1");
../lib/Net/Ping/t/510_ping_udp..............FAILED test 2
Failed 1/2 tests, 50.00% okay
------------------------------
Date: Wed, 06 Jun 2007 12:18:38 -0700
From: andrew.fabbro@gmail.com
Subject: Re: Probs Building Perl on HP-UX 11.23
Message-Id: <1181157518.022341.64840@q19g2000prn.googlegroups.com>
On Jun 6, 10:16 am, andrew.fab...@gmail.com wrote:
> I'm working on building perl 5.8.8 on HP-UX 11.23. I'm using this
> configuration...
>
> CC=/opt/ansic/bin/cc Configure -Duselargefiles -Dusethreads -
> Duse64bitall -de
Also, building perl on HP-UX 11.11 on a PA-RISC system also fails
510_ping_udp:
lib/Net/Ping/t/510_ping_udp...............# Failed test 2 in ../lib/
Net/Ping/t/510_ping_udp.t at line 22
# ../lib/Net/Ping/t/510_ping_udp.t line 22 is: ok $p-
>ping("127.0.0.1");
FAILED at test 2
------------------------------
Date: Wed, 06 Jun 2007 11:15:53 -0700
From: vorticitywolfe@gmail.com
Subject: regular expression ignore example?
Message-Id: <1181153753.960157.254820@i38g2000prf.googlegroups.com>
Hello,
I have looked all over trying to find an example of how to grab
certain parts of a text file while ignoring others in the same line.
the file:
*************test.txt*************************
CREATED AT: Wed-June6-17:50 2007
NUM OBS: 1440
Values of two numbers:30.0/45.0 More text
that can be disregarded.
***********************************************
Here is what I want to grab from it:
**************output************************
CREATED AT: Wed-June6-17:50 2007
VALUE: 30.0/45.0
**********************************************
Of course, the file is much larger than this, but I just want the
general syntax of how to accomplish this.
I've just started to use reg ex's, so bear with me...here is what I
have thusfar:
while(<file>){
if ($_=~ /(\d+)/)
{
print $_;
}
}
Thanks for your help!
Jonathan
------------------------------
Date: Wed, 06 Jun 2007 11:42:08 -0700
From: Paul Lalli <mritty@gmail.com>
Subject: Re: regular expression ignore example?
Message-Id: <1181155328.909290.242700@o11g2000prd.googlegroups.com>
On Jun 6, 2:15 pm, vorticitywo...@gmail.com wrote:
> Hello,
>
> I have looked all over trying to find an example of how to grab
> certain parts of a text file while ignoring others in the same line.
>
> the file:
>
> *************test.txt*************************
> CREATED AT: Wed-June6-17:50 2007
> NUM OBS: 1440
> Values of two numbers:30.0/45.0 More text
> that can be disregarded.
> ***********************************************
>
> Here is what I want to grab from it:
>
> **************output************************
> CREATED AT: Wed-June6-17:50 2007
> VALUE: 30.0/45.0
> **********************************************
>
> Of course, the file is much larger than this, but I just want the
> general syntax of how to accomplish this.
>
> I've just started to use reg ex's, so bear with me...here is what I
> have thusfar:
>
> while(<file>){
> if ($_=~ /(\d+)/)
> {
> print $_;
>
> }
> }
A regular expression has two intentions. First, it determines whether
or not a given string of text "matches" some pattern. Second, it is
used to "pull" certain parts of that match out to be stored
elsewhere. You are only using the first intent - you're determining
whether or not the line matches one or more digits.
What you should instead do is find out if this text matches the actual
format of the line, and secondarily pull out from that match the data
you want to keep:
#!/usr/bin/perl
use strict;
use warnings;
while (my $line = <DATA>) {
if ($line =~ /^CREATED AT:/) {
#If line starts with that text, print the entire line
print $line;
}
if ($line =~ /^Values of.*?(\d+\.\d+\/\d+\.\d+)/) {
#If line starts with Values of, pull out
#the relevant text that you want to print
print "VALUE: $1\n";
}
}
__DATA__
CREATED AT: Wed-June6-17:50 2007
NUM OBS: 1440
Values of two numbers:30.0/45.0 More text
that can be disregarded.
The above program outputs:
CREATED AT: Wed-June6-17:50 2007
VALUE: 30.0/45.0
For more information on using meta characters and quantifiers (ie,
the .*? above) and the captured submatches (the $1), please have a
read of:
perldoc perlretut
perldoc perlre
perldoc perlreref
Paul Lalli
------------------------------
Date: Wed, 06 Jun 2007 11:53:21 -0700
From: vorticitywolfe@gmail.com
Subject: Re: regular expression ignore example?
Message-Id: <1181156001.702919.5020@q19g2000prn.googlegroups.com>
On Jun 6, 6:42 pm, Paul Lalli <mri...@gmail.com> wrote:
> On Jun 6, 2:15 pm, vorticitywo...@gmail.com wrote:
>
>
>
> > Hello,
>
> > I have looked all over trying to find an example of how to grab
> > certain parts of a text file while ignoring others in the same line.
>
> > the file:
>
> > *************test.txt*************************
> > CREATED AT: Wed-June6-17:50 2007
> > NUM OBS: 1440
> > Values of two numbers:30.0/45.0 More text
> > that can be disregarded.
> > ***********************************************
>
> > Here is what I want to grab from it:
>
> > **************output************************
> > CREATED AT: Wed-June6-17:50 2007
> > VALUE: 30.0/45.0
> > **********************************************
>
> > Of course, the file is much larger than this, but I just want the
> > general syntax of how to accomplish this.
>
> > I've just started to use reg ex's, so bear with me...here is what I
> > have thusfar:
>
> > while(<file>){
> > if ($_=~ /(\d+)/)
> > {
> > print $_;
>
> > }
> > }
>
> A regular expression has two intentions. First, it determines whether
> or not a given string of text "matches" some pattern. Second, it is
> used to "pull" certain parts of that match out to be stored
> elsewhere. You are only using the first intent - you're determining
> whether or not the line matches one or more digits.
>
> What you should instead do is find out if this text matches the actual
> format of the line, and secondarily pull out from that match the data
> you want to keep:
>
> #!/usr/bin/perl
> use strict;
> use warnings;
>
> while (my $line = <DATA>) {
> if ($line =~ /^CREATED AT:/) {
> #If line starts with that text, print the entire line
> print $line;
> }
> if ($line =~ /^Values of.*?(\d+\.\d+\/\d+\.\d+)/) {
> #If line starts with Values of, pull out
> #the relevant text that you want to print
> print "VALUE: $1\n";
> }}
>
> __DATA__
> CREATED AT: Wed-June6-17:50 2007
> NUM OBS: 1440
> Values of two numbers:30.0/45.0 More text
> that can be disregarded.
>
> The above program outputs:
> CREATED AT: Wed-June6-17:50 2007
> VALUE: 30.0/45.0
>
> For more information on using meta characters and quantifiers (ie,
> the .*? above) and the captured submatches (the $1), please have a
> read of:
> perldoc perlretut
> perldoc perlre
> perldoc perlreref
>
> Paul Lalli
Excellent! That is just the information that I need to get me going.
I thought there may be a way to first pull in all the lines with
numbers and then clean them up with some code, and that is pretty much
what yours does! Thanks!
Jonathan
------------------------------
Date: Wed, 06 Jun 2007 09:35:26 -0700
From: Jim Gibson <jgibson@mail.arc.nasa.gov>
Subject: Re: Search and Replace with perl
Message-Id: <060620070935262574%jgibson@mail.arc.nasa.gov>
In article <1181134539.470120.313260@a26g2000pre.googlegroups.com>,
Subra <mailursubbu@gmail.com> wrote:
> Hi,
>
> I have a file with entries like
>
> =======================================
> _RWSTD_VALUE_ALLOC(test1,
> test5);
> _RWSTD_VALUE_ALLOC(test1,snm);
> _RWSTD_VALUE_ALLOC(xyz,
> 789);
> _RWSTD_VALUE_ALLOC(test1,sbk);
> _RWSTD_VALUE_ALLOC(abc,
> 123);
>
> :
> ===============================
>
> I want to put 2nd argument to _RWSTD_VALUE_ALLOC as *this .
> So my resultant file should be
> =======================================
> _RWSTD_VALUE_ALLOC(test1,*this,
> test5);
> _RWSTD_VALUE_ALLOC(test1,snm);
> _RWSTD_VALUE_ALLOC(xyz,*this,
> 789);
> _RWSTD_VALUE_ALLOC(test1,sbk);
> _RWSTD_VALUE_ALLOC(abc,*this,
> 123);
>
> :
> ===============================
>
> Please help me to write this script....
Which part are you having trouble with? You are more likely to get help
if you first make an attempt at solving your problem and post only the
code with which you are having trouble. You will be lucky to find
someone who wants to write your program for you.
Note: you are using Google Groups to post to a Usenet group, so many
helpful regulars in comp.lang.perl.misc will not even see your post.
Consider using a regular news reader in the future.
Now to your problem:
Why are the some of your lines split after a comma and some are not? Do
you really want to add "*this," to only those lines that are split? If
so, you can do this with a simple substitution (untested):
if( $line =~ /_RWSTD_VALUE_ALLOC\(.*,\s*$/ ) {
$line .= '*this,';
}
If your cases are more varied, then you will have to use more complex
logic.
Posted Via Usenet.com Premium Usenet Newsgroup Services
----------------------------------------------------------
** SPEED ** RETENTION ** COMPLETION ** ANONYMITY **
----------------------------------------------------------
http://www.usenet.com
------------------------------
Date: Wed, 06 Jun 2007 15:06:08 +0100
From: Simon Andrews <simon.andrews@bbsrc.ac.uk>
Subject: Re: Sending RTF email with Perl?
Message-Id: <f46f0g$glv$1@south.jnrs.ja.net>
J.D. Baldwin wrote:
>
> I am trying to use a module to send an RTF email (because I need to
> use color codes) from Perl. I have been using MIME::Lite to send
> email attachments, but am unable to get it to send the mail itself as
> RTF. I found a FAQ (not a newsgroup one) on sending HTML email:
We've got a system which does this at the moment. The (slightly
modified) relevant bit of code is:
my $msg = MIME::Lite -> new (
From => 'sender@example.com',
To => 'recipiant@example.com',
Subject => "Some title",
Type => 'multipart/mixed',
);
$msg ->attach(Type => 'TEXT',
Data => "This is the text part of the email",
);
# The RTF document is loaded and stored in $rtf
my $rtf_attach = MIME::Lite -> new(
Type => 'application/rtf',
Filename => "name_to_show.rtf",
Data => $rtf
);
$msg -> attach($rtf_attach);
$msg -> send() or print_bug ("Unable to send email request");
Hope this helps
Simon.
------------------------------
Date: Wed, 06 Jun 2007 07:32:47 -0700
From: xlue897@rogers.com
Subject: system call
Message-Id: <1181140367.657805.154200@k79g2000hse.googlegroups.com>
Hi, All:
I have the following perl code intending to open several files using
vi. But it doesn't work.
ls test* | perl -n -e 'chomp; $cmd="vi $_"; unless(system($cmd))
{ print "success\n";}'
it reports error like:
"Input read error
success
"
Thanks for your help.
Steven
------------------------------
Date: Wed, 06 Jun 2007 06:29:56 -0700
From: hendedav@gmail.com
Subject: Re: system call
Message-Id: <1181136596.381209.164170@m36g2000hse.googlegroups.com>
On Jun 6, 8:58 am, "J=FCrgen Exner" <jurge...@hotmail.com> wrote:
> hende...@gmail.com wrote:
> > Or
> > does anyone know a better way to find the pid of a running perl
> > program?
>
> perldoc perlvar:
> $$ The process number of the Perl running this script. You should
> consider this variable read-only, although it will be altered
> across fork() calls. (Mnemonic: same as shells.)
>
> jue
Thanks Jue! Thats much simplier!
------------------------------
Date: Wed, 06 Jun 2007 14:34:09 -0000
From: Brad Baxter <baxter.brad@gmail.com>
Subject: Re: Using DateTime
Message-Id: <1181140449.324958.5320@h2g2000hsg.googlegroups.com>
On Jun 5, 8:58 am, "Jim Scheffler" <jscheffler round a symbol cvnt dot
net> wrote:
> I have loaded the DateTime module according to the install directions but
> when I use it I get this error message when running the program: Can't
> locate Params/Validate.pm in @INC
>
> Does DateTime have this module as a requirement?
http://search.cpan.org/src/DROLSKY/DateTime-0.37/META.yml
--
Brad
------------------------------
Date: Wed, 6 Jun 2007 07:41:33 +0200
From: "Petr Vileta" <stoupa@practisoft.cz>
Subject: Re: using LWP::UserAgent Get method
Message-Id: <f46b6p$omi$1@ns.felk.cvut.cz>
Paul wrote:
> hi, there,
>
> I am learning to use Perl to grab some useful information from
> internet. For example to get specified web page.
>
> I tested several web sites and the code works well. But when I tried
> on www.officedepot.com, the code does not work any more. the returned
> error message is always "Error1: when get http://www.officedepot.com:
> 500 Can't connect to www.officedepot.com:80 (connect: Unknown error)"
>
> I have no idea what is going wrong. please help me on this
>
This code work for me
#!/usr/bin/perl
use strict;
use LWP::UserAgent;
our $ua = LWP::UserAgent->new(timeout => 60);
my $myagent='Mozilla/5.0 (Windows; U; Windows NT 5.1; cs; rv:1.8.1.3)
Gecko/20070309 Firefox/2.0.0.3';
$ua->agent($myagent);
my ($status,$content)=readweb('http://www.officedepot.com');
print $c;
sub readweb
{
my $w=shift;
my $cnt=0;
my ($req,$res);
$req = new HTTP::Request GET => $w;
$req->headers->header(Accept => '*/*');
$req->headers->header(Connection => "Keep-Alive");
$req->headers->header(Accept_language => 'cs,en-us;q=0.7,en;q=0.3');
$req->headers->header(Cache_Control => 'no-cache');
$req->headers->header(Keep_Alive => '300');
$res = $ua->request($req);
if ($res->is_error*1 > 0)
{
return ($res->{_rc},$res->{_msg});
}
my $content=$res->content;
if ($content!~/<\/html>/si)
{
return ($res->{_rc},$res->{_msg});
}
return ($res->{_rc},$content);
}
--
Petr
Skype: callto://fidokomik
Na mail uvedeny v headeru zpravy nema cenu nic posilat, konci to v PR*
:-) Odpovidejte na petr na practisoft cz
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V11 Issue 488
**************************************