[25654] in Perl-Users-Digest
Perl-Users Digest, Issue: 7896 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Mar 18 14:05:38 2005
Date: Fri, 18 Mar 2005 11:05:10 -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 Fri, 18 Mar 2005 Volume: 10 Number: 7896
Today's topics:
Re: Anyone understands eval? xhoster@gmail.com
Re: clueless on "use base" pragma <spamtrap@dot-app.org>
help! Mailer <appumail@gmail.com>
Re: help! Mailer <darkon.tdo@gmail.com>
How to find installed Modules <appumail@gmail.com>
Re: How to find installed Modules <theaney@cablespeed.com>
Re: How to use Perl Graph module to solve travel salesp <tzz@lifelogs.com>
IP address, how? <warpman999@netscape.net>
Re: IP address, how? <spamtrap@dot-app.org>
Re: IP address, how? <kkeller-usenet@wombat.san-francisco.ca.us>
Re: IP address, how? <ebohlman@omsdev.com>
Re: IP address, how? <no@email.com>
Re: Is there a perl array for... <nobull@mail.com>
Re: Log files in a Date / Time Stamped Directory <nobull@mail.com>
New article online: 'Embedding Perl in database tables' <davebaker@DELETEMEbenefitslink.com>
Re: Non-blocking socket connect examples on win32 not w <norealaddress@nowhere.com>
Re: Perl Scripting problem - please help <do-not-use@invalid.net>
PHP -> Parrot? (Anyone suspect?) nospam@geniegate.com
reg expr, extract digit from string. (joel)
Re: reg expr, extract digit from string. <phaylon@dunkelheit.at>
Re: reg expr, extract digit from string. <do-not-use@invalid.net>
Re: reg expr, extract digit from string. <tadmc@augustmail.com>
Re: Weird HTTP headers in Html Body <c_klar@c-cs.com>
Re: Weird HTTP heders in Html Body <c_klar@c-cs.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Mar 2005 17:32:25 GMT
From: xhoster@gmail.com
Subject: Re: Anyone understands eval?
Message-Id: <20050318123225.776$W9@newsreader.com>
"shanx" <shanker.neelakantan@gmail.com> wrote:
> eval seems to be way too complicated for simple minded souls.
Then, if you are a simple minded soul, don't use it.
> I really
> can't figure out what eval does behind the scenes even for some simple
> things.
>
> Here are a few samples:
>
> 1.
>
> $a = "my $b = 10; print 'hi $b';";
You are not using strict.
You are not using warnings.
You are not checking to see what was actually stored in $a.
> eval $a;
You are not checking for errors on the eval.
You obviously haven't tried very hard to figure it out.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Fri, 18 Mar 2005 13:04:13 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: clueless on "use base" pragma
Message-Id: <v_udnSx3iOGAhabfRVn-tA@adelphia.com>
babydoe@mailinator.com wrote:
> OO is new stuff to me.
Do you know that several OO tutorials come with Perl?
perldoc perlboot
perldoc perltoot
perldoc perltooc
perldoc perlbot
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Fri, 18 Mar 2005 18:45:28 +0530
From: Murugesh <appumail@gmail.com>
Subject: help! Mailer
Message-Id: <iNA_d.9$oe3.147@news.oracle.com>
Hi,
I tried the following code in Windows after installing Mail::Mailer module
#!/usr/bin/perl
use Mail::Mailer;
$from_address="map\@abcd.com";
$to_address="rek2345\@yahoo.com";
$subject="hi";
$mailer = Mail::Mailer->new();
$mailer->open({ From => $from_address,
To => $to_address,
Subject => $subject,
})
or die "Can't open: $!\n";
print $mailer $body;
$mailer->close();
when compiled it shows,
Died @C:\perl\site\lib/Mail/Mailer.pm
the same program works in Solaris.Could you help what is going on
Thanks,
Appu
------------------------------
Date: Fri, 18 Mar 2005 15:00:14 -0000
From: "David K. Wall" <darkon.tdo@gmail.com>
Subject: Re: help! Mailer
Message-Id: <Xns961D65C3A33BFdkwwashere@216.168.3.30>
Murugesh <appumail@gmail.com> wrote:
> I tried the following code in Windows after installing
> Mail::Mailer module
> #!/usr/bin/perl
> use Mail::Mailer;
> $from_address="map\@abcd.com";
> $to_address="rek2345\@yahoo.com";
> $subject="hi";
> $mailer = Mail::Mailer->new();
> $mailer->open({ From => $from_address,
> To => $to_address,
> Subject => $subject,
> })
> or die "Can't open: $!\n";
> print $mailer $body;
> $mailer->close();
>
> when compiled it shows,
> Died @C:\perl\site\lib/Mail/Mailer.pm
>
> the same program works in Solaris.Could you help what is going on
Check the docs for Mail::Mailer. It tries to send mail using
sendmail or qmail, neither of which is likely to exist on a Windows
system, or by using an SMTP server, but you didn't specify one.
------------------------------
Date: Fri, 18 Mar 2005 17:38:07 +0530
From: Murugesh <appumail@gmail.com>
Subject: How to find installed Modules
Message-Id: <9Oz_d.6$oe3.145@news.oracle.com>
I'm a newbie to Perl.How can we find what are the modules installed? Is
there a way.
Thanks
Appu
------------------------------
Date: Fri, 18 Mar 2005 07:51:46 -0500
From: Tim Heaney <theaney@cablespeed.com>
Subject: Re: How to find installed Modules
Message-Id: <87y8clktgd.fsf@mrbun.watterson>
Murugesh <appumail@gmail.com> writes:
> I'm a newbie to Perl.How can we find what are the modules installed?
There is a FAQ entry for this. You can read it locally
perldoc -q installed
or online
http://faq.perl.org/perlfaq3.html#How_do_I_find_which_
Perhaps the most direct way is to search through @INC looking for
files ending in .pm
perl -MFile::Find -le 'find sub{push @m, $File::Find::name if
/\.pm$/}, $_ for @INC; print for @m'
Since it looks like you're using Windows, you probably want to use
double-quotes on that
perl -MFile::Find -le "find sub{push @m, $File::Find::name if /\.pm$/}, $_ for @INC; print for @m"
I hope this helps,
Tim
------------------------------
Date: Fri, 18 Mar 2005 10:09:07 -0500
From: Ted Zlatanov <tzz@lifelogs.com>
Subject: Re: How to use Perl Graph module to solve travel salesperson problem (TSP)?
Message-Id: <4nzmx1vvn0.fsf@lifelogs.com>
On 17 Mar 2005, m.fangtao@genesis.co.nz wrote:
> But how to do it by Perl Graph module?
Read the documentation. This is verbatim from the Graph module's
documentation. I hope you understand the algorithms involved (read
about them in an algorithms book or online) instead of just blindly
using them. Graph programming is 90% algorithms and data structures
and 10% actual programming :) If you try to just do the programming
without understanding the theory, it will be hard for you to produce
good code, even if you use a library such as the Graph module.
"Minimum Spanning Trees (MST)
Minimum Spanning Trees or MSTs are tree subgraphs derived from an undirected graph. MSTs "span the graph" (covering all the vertices) using as lightly weighted (hence the "minimum") edges as possible.
MST_Kruskal
$mstg = $g->MST_Kruskal;
Returns the Kruskal MST of the graph.
MST_Prim
$mstg = $g->MST_Prim(%opt);
Returns the Prim MST of the graph.
You can choose the first vertex with $opt{ first_root }.
MST_Dijkstra
minimum_spanning_tree
$mstg = $g->MST_Dijkstra;
$mstg = $g->minimum_spanning_tree;
Aliases for MST_Prim."
HTH
Ted
------------------------------
Date: 18 Mar 2005 10:24:20 -0800
From: "warpman" <warpman999@netscape.net>
Subject: IP address, how?
Message-Id: <1111170260.053444.22820@f14g2000cwb.googlegroups.com>
I'm new to perl and need some help. I currently have a guestbook that
when a user posts a message I get the following information.
You have a new entry in your guestbook:
message text area...
city, st country - date and time
My question is how do I get the IP address from the person posting the
message sent to me? Why the IP? Well, because lately I've been getting
a lot of spam on the guestbook. Any help or information would be
appreciated.
------------------------------
Date: Fri, 18 Mar 2005 13:35:11 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: IP address, how?
Message-Id: <ucqdnaP6aef9gqbfRVn-gw@adelphia.com>
Your question is off-topic for a Perl group. It has nothing to do with Perl.
That is, the answer would have been the same if you were writing your CGI
in Python, C, or any other language. It would have been better to post it
to a CGI group such as comp.infosystems.www.authoring.cgi. Having said
that...
warpman wrote:
> My question is how do I get the IP address from the person posting the
> message sent to me?
It's in the REMOTE_ADDR environment variable. It's not very reliable though
- it can be the address of a proxy, for example.
In Perl, environment variables are in %ENV, so you could read it like this:
my $ip = $ENV{'REMOTE_ADDR'};
sherm--
--
Cocoa programming in Perl: http://camelbones.sourceforge.net
Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Fri, 18 Mar 2005 10:34:49 -0800
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: IP address, how?
Message-Id: <vjjrg2x8rg.ln2@goaway.wombat.san-francisco.ca.us>
On 2005-03-18, warpman <warpman999@netscape.net> wrote:
> I'm new to perl and need some help. I currently have a guestbook that
> when a user posts a message I get the following information.
>
> You have a new entry in your guestbook:
> message text area...
> city, st country - date and time
>
> My question is how do I get the IP address from the person posting the
> message sent to me?
Assuming you're trying to detect the IP from a CGI script on a
webserver, look at the remote_host call in CGI.pm.
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://wombat.san-francisco.ca.us/cgi-bin/fom
see X- headers for PGP signature information
------------------------------
Date: 18 Mar 2005 18:44:43 GMT
From: Eric Bohlman <ebohlman@omsdev.com>
Subject: Re: IP address, how?
Message-Id: <Xns961D82193AC1Aebohlmanomsdevcom@130.133.1.4>
"warpman" <warpman999@netscape.net> wrote in news:1111170260.053444.22820
@f14g2000cwb.googlegroups.com:
> I'm new to perl and need some help. I currently have a guestbook that
> when a user posts a message I get the following information.
>
> You have a new entry in your guestbook:
> message text area...
> city, st country - date and time
>
> My question is how do I get the IP address from the person posting the
> message sent to me? Why the IP? Well, because lately I've been getting
> a lot of spam on the guestbook. Any help or information would be
> appreciated.
You get it from the request headers. If you're using CGI.pm, then
remote_host() is probably what you want. Otherwise, it's not really a Perl
question since the way of doing it would be the same in any language.
------------------------------
Date: Fri, 18 Mar 2005 18:52:41 +0000
From: Brian Wakem <no@email.com>
Subject: Re: IP address, how?
Message-Id: <3a0mbpF65mpg5U1@individual.net>
Sherm Pendley wrote:
> Your question is off-topic for a Perl group. It has nothing to do with
> Perl. That is, the answer would have been the same if you were writing
> your CGI in Python, C, or any other language. It would have been better to
> post it to a CGI group such as comp.infosystems.www.authoring.cgi. Having
> said that...
>
> warpman wrote:
>
>> My question is how do I get the IP address from the person posting the
>> message sent to me?
>
> It's in the REMOTE_ADDR environment variable. It's not very reliable
> though - it can be the address of a proxy, for example.
In which case $ENV{'HTTP_X_FORWARDED_FOR'} can sometimes be useful.
--
Brian Wakem
------------------------------
Date: Fri, 18 Mar 2005 17:15:07 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Is there a perl array for...
Message-Id: <d1f205$52i$1@sun3.bham.ac.uk>
advice please wireless 802.11 on RH8 wrote:
> It also seemed inconsistent that whenever Perl "can" capture arrays or
> hashes, i.e. %ENV, @_, @ARGV, etc, it seems to like to do so. Here is a
> case where it would be perfectly natural to capture $1 $2 $3 ... as an
> array and it doesn't.
Yes it does seem odd. But no, there is no such array, the best you have
is @+ or @-.
------------------------------
Date: Fri, 18 Mar 2005 17:29:48 +0000
From: Brian McCauley <nobull@mail.com>
Subject: Re: Log files in a Date / Time Stamped Directory
Message-Id: <d1f2rk$5k1$1@sun3.bham.ac.uk>
Manzoorul Hassan wrote:
> use Time::localtime;
> $time = localtime;
>
> $date = sprintf ("%04d%02d%02d\n", $time->year+1900, $time->mon+1,
> $time->mday);
While at some level there's nothing wrong with doing it long-hand using
the basic sprintf() and addinf the necessary offsets there is a special
sprintf()-like function for fomatting localtime() to be found one of the
standard Perl modules.
For details:
perldoc -f localtime
Oh, and for $DEITY's sake get into the habit of always declaring all
variables as lexically scoped in the smallest applicable scope unless
there is a reson to do otherwise. Do this pre-emptively. Do not wait to
experience the pain that will inevitably result from not doing so.
------------------------------
Date: Fri, 18 Mar 2005 16:31:56 GMT
From: Dave Baker <davebaker@DELETEMEbenefitslink.com>
Subject: New article online: 'Embedding Perl in database tables'
Message-Id: <0oD_d.7400$qW.4364@newsread3.news.atl.earthlink.net>
http://www-128.ibm.com/developerworks/linux/library/l-cpdata.html?ca=dgr-lnxw961PerlDatabase
'Put Perl into your RDBMS design to reach database nirvana'
Level: Introductory
Teodor Zlatanov (tzz bu.edu)
Programmer, Gold Software Systems
09 Mar 2005
"In this installment, Ted looks at Perl and databases. Specifically, he
works with the Class::DBI CPAN module and MySQL to introduce you to
embedding Perl in database tables."
------------------------------
Date: Fri, 18 Mar 2005 16:00:26 GMT
From: Ed W <norealaddress@nowhere.com>
Subject: Re: Non-blocking socket connect examples on win32 not working
Message-Id: <423AFBB2.5070405@nowhere.com>
Rocco Caputo wrote:
> On Fri, 18 Mar 2005 00:36:40 GMT, Ed W wrote:
>
>>OK, yes I know this is practically an FAQ, but I can't get the win32
>>non-blocking socket examples to work on Perl 5.8 on Win XP.
>>
>>See below for my example program. Seems to me that this should show a
>>connect time of near zero seconds. However, it actually takes a time
>>roughly the same as the ping time to the server, indicating to me that
>>it's blocking until connected...
>
>
> Check ActiveState's bug tracker. This issue has come up several times
> and been written off as one of Windows' little quirks. You could try
> Cygwin perl instead...
>
Actually, almost by chance I discovered that the last param to the ioctl
has to be a reference param... Changing the code as follows makes it work:
my $nonblocking = $blocking ? 0 : 1;
ioctl($self, 0x8004667e, \$nonblocking);
I have not seen this explicitly described anywhere, so hopefully it is
useful to someone else if it turns up on a search...
I still don't understand why such a trivial workaround is not part of
INET.pm after all this time though? Seems to be a trivial patch?
Thanks all
Ed W
------------------------------
Date: 18 Mar 2005 12:18:08 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: Perl Scripting problem - please help
Message-Id: <yzd8y4lrymn.fsf@invalid.net>
> rename("/var/www/html/reports/shops/$fnames","/var/www/html/reports/shops/
> $newfile/$newpdf");
>
> I cannot get the rename function to work even if I use the same
> directory. I don't get any errors and the file permissions are set
> correctly on the files.
>
> Anyone know why this does not work?
You would get errors if you checked for them:
rename("/var/www/html/reports/shops/$fnames","/var/www/html/reports/shops/
$newfile/$newpdf") or die "rename failed: $!";
If what you posted is your exact code, I think the problem is in the
nicely formatted call to rename: the indentation in front of the second
line will be part of the argument.
In that case, this is better:
rename("/var/www/html/reports/shops/$fnames",
"/var/www/html/reports/shops/$newfile/$newpdf")
or die "rename failed: $!";
The problem may also be that the $newfile directory component does not
exist. If so, you have to create it before attempting to move files into
it. See 'mkdir'.
------------------------------
Date: Fri, 18 Mar 2005 16:34:45 GMT
From: nospam@geniegate.com
Subject: PHP -> Parrot? (Anyone suspect?)
Message-Id: <Lucy1111159379200390x763fbc@client.tunestar.net>
I wonder... if parrot is supposed to be this virtual machine
for dynamically typed languages and it'll one day do things like
Python..
Do you think there will ever be a PHP to Parrot compiler?
Even if it were limited, it would sure mess things up for the zend business
model. :-(
On the other hand, it sure would be nice, a large problem with mod_perl is that
it can't be used on a shared host.
Seems like mod_parrot could allow perl to get past this problem in a limited
kind of way, (Assuming it can be configured to enforce some degree of isolation
between requests) skipping ahead of PHP.
All that PHP stuff could be 'compiled' for mod_parrot and we could get get back
to doing web stuff in perl.
Would parrot provide the type of isolation between requests (more importantly,
*users*) on a shared apache server?
How likely do you think this is?
Jamie
--
http://www.geniegate.com Custom web programming
guhzo_42@lnubb.pbz (rot13) User Management Solutions
------------------------------
Date: 18 Mar 2005 07:18:48 -0800
From: joelix@gmail.com (joel)
Subject: reg expr, extract digit from string.
Message-Id: <c497870c.0503180718.3c845a94@posting.google.com>
Hi,
I need help with extracting digit from a string.
example:
here is the string i want to split into words and digits.
my $string = "abcd-efgh-ijkl-123.456.789"
i want
$word = "abcd-efgh-ijkl";
and
$digit = "123.456.789";
Thanks in advance,
Joel
------------------------------
Date: Fri, 18 Mar 2005 16:22:28 +0100
From: phaylon <phaylon@dunkelheit.at>
Subject: Re: reg expr, extract digit from string.
Message-Id: <pan.2005.03.18.15.22.28.241632@dunkelheit.at>
joel wrote:
> i want
What have you tried?
--
http://www.dunkelheit.at/
»Better to reign in hell than to serve in heaven«
-- John Milton, »Paradise Lost«
------------------------------
Date: 18 Mar 2005 16:28:13 +0100
From: Arndt Jonasson <do-not-use@invalid.net>
Subject: Re: reg expr, extract digit from string.
Message-Id: <yzd4qf9rn1u.fsf@invalid.net>
joelix@gmail.com (joel) writes:
>
> I need help with extracting digit from a string.
>
> example:
>
> here is the string i want to split into words and digits.
>
> my $string = "abcd-efgh-ijkl-123.456.789"
>
> i want
>
> $word = "abcd-efgh-ijkl";
>
> and
>
> $digit = "123.456.789";
You seem to have split it successfully yourself already. What's the
general pattern for your string and word/digit parts? Does the
digit part contain only digits and periods, and the word part only
letters and hyphens?
------------------------------
Date: Fri, 18 Mar 2005 09:35:39 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: reg expr, extract digit from string.
Message-Id: <slrnd3ltab.1hc.tadmc@magna.augustmail.com>
joel <joelix@gmail.com> wrote:
> my $string = "abcd-efgh-ijkl-123.456.789"
> i want
> $word = "abcd-efgh-ijkl";
> and
> $digit = "123.456.789";
my($word, $digit) = $string =~ /(.*)-(.*)/;
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 18 Mar 2005 10:25:32 -0800
From: "c_klar@c-cs.com" <c_klar@c-cs.com>
Subject: Re: Weird HTTP headers in Html Body
Message-Id: <1111170332.046956.99040@o13g2000cwo.googlegroups.com>
Thanks to everyone, the issue was resolved as you can see the
resolution in my previous posting.
------------------------------
Date: 18 Mar 2005 10:09:46 -0800
From: "c_klar@c-cs.com" <c_klar@c-cs.com>
Subject: Re: Weird HTTP heders in Html Body
Message-Id: <1111169386.038841.135750@l41g2000cwc.googlegroups.com>
ok, in my initial posting i also listed Perl Get as one of the
utilities which got me this error too (it is not a browser strictly
speaking so it does not need to be legal html).
I intentionally made this bare bone script to eliminate all the odds so
I focus on the cause of the issue.
Then I realized that I have a ISAPI compression filter on my webserver
and I guessed let me give it a shot and turn it off maybe the issue has
to do with it, guess what once I turned it off the problem disappeared.
so I contacted the company who wrote this ISAPI filter, and the rest
I'm just attaching.
Chaim,
I have posted a detailed account of this problem to MS IIS news groups
a year ago (a few times) and got no response. My original post
immediately follows this message. Essentially, I believe this to be a
bug in IIS 6. To work around the bug, disable 'Fast data passthru'
PipeBoost option (in Advanced Options).
I think the reason why you only see this in *some* browsers is that
other browsers mistakenly interpret the HTTP header data inside the
response as a start of a *new* response, and I would not blame them for
doing so since there is not Content-Length field in the response, and
they are attempting to implement an (uncommon) extension. Or these
browsers send something in the request that triggers the bug.
...
_________________
Posting: Newsgroups: microsoft.public.inetserver.iis
Sent: Friday, February 13, 2004 3:08 PM
Subject: Problem: IIS 6, external CGI (.exe) + RAW-WRITE ISAPI filter
There seems to be a problem with IIS 6 W3SVC (build 3718; WP Isolation
mode)
under the following conditions:
1) servers is gatewaying to an external CGI processor (perl.exe,
whatever.exe) to process a script;
2) there is an active ISAPI filter present that binds to
SF_NOTIFY_SEND_RAW_DATA notification;
3) this filter calls
ServerSupportFunction(SF_REQ_DISABLE_NOTIFICATIONS) to
disable the SF_NOTIFY_SEND_RAW_DATA notification while processing this
notification
When all these conditions converge, what you get is a really confused
IIS
that starts prepending the HTTP response header to every data packet it
sends out after the filter disables the RAW-WRITE notification (while
processing this request).
Please see attached zip for details and code.
How would I go about reporting this and getting this fixed?
Thanks in advance.
------------------------------
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 V10 Issue 7896
***************************************