[26282] in Perl-Users-Digest
Perl-Users Digest, Issue: 8464 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Sep 28 09:05:31 2005
Date: Wed, 28 Sep 2005 06:05:06 -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, 28 Sep 2005 Volume: 10 Number: 8464
Today's topics:
Re: FAQ . <jurgenex@hotmail.com>
Re: Help - How do I install Perl (CPAN) on Windows ? <Harry@Steppenwolf.com>
Re: Help - How do I install Perl (CPAN) on Windows ? <1usa@llenroc.ude.invalid>
Re: Help - How do I install Perl (CPAN) on Windows ? <matthew.garrish@sympatico.ca>
Re: Help - How do I install Perl (CPAN) on Windows ? <1usa@llenroc.ude.invalid>
Re: Matching Multiple Patters In A Regex In Any Order <nobull@mail.com>
Re: Shell script <tadmc@augustmail.com>
Re: Use of hash variables in module call - puzzling beh (Anno Siegel)
Re: Using perl with Inetd <nospam@427.thetrash.org.uk>
Re: Using perl with Inetd <vek@station02.ohout.pharmapartners.nl>
Re: Using perl with Inetd <nospam@427.thetrash.org.uk>
Re: Using perl with Inetd <tadmc@augustmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 28 Sep 2005 01:57:23 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: FAQ .
Message-Id: <7Mm_e.13039$TQ3.8894@trnddc05>
Zeno wrote:
> It would be far more useful for me to get 1 large FAQ - rather
> than countless small ones.
Is there anything not working with "perldoc perlfaq"?
jue
------------------------------
Date: Wed, 28 Sep 2005 05:40:24 GMT
From: Harry Haller <Harry@Steppenwolf.com>
Subject: Re: Help - How do I install Perl (CPAN) on Windows ?
Message-Id: <umakj114sn8123ocgbf4b8ufnhe7q0ailo@4ax.com>
On Tue, 27 Sep 2005 21:07:36 +0200, Gunnar Hjalmarsson
<noreply@gunnar.cc> wrote:
>Zeno wrote:
>> I downloaded the ActiveState perl msi from: ActiveState (ver.
>> 5.8.7). It installed. But now I find that I am, naturally,
>> missing a load of CPAN modules.
>>
>> I can find these things quite easily but how do I install them?
>>
>> The instructions are simple, but unfortunately these
>> instructions involve running either of these 2 command line
>> options:
>>
>> Perl -MCPAN -e shell
>> or
>> cpanp
>
>Haven't you missed ppm?
I surely did - but I blame ActiveState for that - they should've
listed all the pre-installation requirements in their MSI. The MSI
should check whether various components are present on the system and
warn when it finds something missing.
I definitely DO NOT have a C++ or C compiler installed.
>http://ppm.activestate.com/PPMPackages/5.8-windows/
>
>I think there is a simple command for downloading and installing those
>packages if you have installed ActiveState Perl. (I'm using IndigoPerl,
>with a slightly different interface to ActiveState's ppm.)
Thanks but I think a link to this may be more appropriate:
http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/faq/ActivePerl-faq2.html
From reading this document it looks like I need to install C++, which
is what I suspected. Well it would've been nice if people had told me
that beforehand - don't you think so? I assumed that Perl was some
kind of stand-alone language as everything I had read implied as much.
Foolish me.
------------------------------
Date: Wed, 28 Sep 2005 10:57:55 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Help - How do I install Perl (CPAN) on Windows ?
Message-Id: <Xns96DF46DC3828Dasu1cornelledu@127.0.0.1>
Harry Haller <Harry@Steppenwolf.com> wrote in
news:umakj114sn8123ocgbf4b8ufnhe7q0ailo@4ax.com:
> On Tue, 27 Sep 2005 21:07:36 +0200, Gunnar Hjalmarsson
> <noreply@gunnar.cc> wrote:
>
>>Zeno wrote:
>>> I downloaded the ActiveState perl msi from: ActiveState (ver.
>>> 5.8.7). It installed. But now I find that I am, naturally,
>>> missing a load of CPAN modules.
>>>
>>> I can find these things quite easily but how do I install them?
>>>
>>> The instructions are simple, but unfortunately these
>>> instructions involve running either of these 2 command line
>>> options:
>>>
>>> Perl -MCPAN -e shell
>>> or
>>> cpanp
>>
>>Haven't you missed ppm?
>
> I surely did - but I blame ActiveState for that - they should've
> listed all the pre-installation requirements in their MSI. The MSI
> should check whether various components are present on the system and
> warn when it finds something missing.
Directory of C:\Documents and Settings\All Users\Start
Menu\Programs\ActivePerl 5.8.7 Build 813
06/13/2005 03:05 PM <DIR> .
06/13/2005 03:05 PM <DIR> ..
06/13/2005 03:05 PM 685 Documentation.lnk
06/13/2005 03:05 PM 747 OLE-Browser.lnk
06/13/2005 03:05 PM 696 Perl Package Manager.lnk
3 File(s) 2,128 bytes
2 Dir(s) 28,176,740,352 bytes free
> http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/faq/ActivePerl-
> faq2.html
>
> From reading this document it looks like I need to install C++, which
> is what I suspected.
You might consider actually following that "Documentation" link that is
installed in the start menu.
The whole point of ppm is to enable Windows users to install
modules without having a C compiler.
I don't know what in that document gave you the impression that you need
one.
> Well it would've been nice if people had told me that beforehand -
> don't you think so? I assumed that Perl was some kind of stand-alone
> language as everything I had read implied as much.
> Foolish me.
Foolish you, indeed.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Wed, 28 Sep 2005 08:09:26 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Help - How do I install Perl (CPAN) on Windows ?
Message-Id: <RJv_e.6058$cq2.641845@news20.bellglobal.com>
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
news:Xns96DF46DC3828Dasu1cornelledu@127.0.0.1...
> Harry Haller <Harry@Steppenwolf.com> wrote in
> news:umakj114sn8123ocgbf4b8ufnhe7q0ailo@4ax.com:
>
>
>> http://aspn.activestate.com/ASPN/docs/ActivePerl/5.8/faq/ActivePerl-
>> faq2.html
>>
>> From reading this document it looks like I need to install C++, which
>> is what I suspected.
>
> You might consider actually following that "Documentation" link that is
> installed in the start menu.
>
> The whole point of ppm is to enable Windows users to install
> modules without having a C compiler.
>
> I don't know what in that document gave you the impression that you need
> one.
>
<quote crappy AS documentation>
How do I install PPM?
PPM (ppm) is installed when you install ActivePerl. On Windows systems there
are certain prerequisites for using PPM:
- To use CPAN, install Microsoft's nmake, which is available from:
http://support.microsoft.com/default.aspx?scid=kb;en-us;Q132084
- You also need a C compiler and environment installed, ideally Visual C/C++
6.0.
</quote>
To someone not familiar with Perl, that would read like you need a C
compiler and environmnt in order to use *ppm*. In fact, both points are in
reference to using CPAN. You can certainly use ppm without a nmake or a C
compiler.
Matt
------------------------------
Date: Wed, 28 Sep 2005 12:36:07 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: Help - How do I install Perl (CPAN) on Windows ?
Message-Id: <Xns96DF578188A7Basu1cornelledu@127.0.0.1>
"Matt Garrish" <matthew.garrish@sympatico.ca> wrote in
news:RJv_e.6058$cq2.641845@news20.bellglobal.com:
>
> "A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in message
> news:Xns96DF46DC3828Dasu1cornelledu@127.0.0.1...
...
>> The whole point of ppm is to enable Windows users to install
>> modules without having a C compiler.
>>
>> I don't know what in that document gave you the impression that you
>> need one.
...
> <quote crappy AS documentation>
> How do I install PPM?
>
> PPM (ppm) is installed when you install ActivePerl. On Windows systems
> there are certain prerequisites for using PPM:
>
> - To use CPAN, install Microsoft's nmake, which is available from:
> http://support.microsoft.com/default.aspx?scid=kb;en-us;Q132084
> - You also need a C compiler and environment installed, ideally Visual
> C/C++ 6.0.
> </quote>
>
> To someone not familiar with Perl, that would read like you need a C
> compiler and environmnt in order to use *ppm*. In fact, both points
> are in reference to using CPAN. You can certainly use ppm without a
> nmake or a C compiler.
Indeed. I guess a bug report is in order. Thanks for pointing this out.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/clpmisc/clpmisc_guidelines.html
------------------------------
Date: Wed, 28 Sep 2005 13:20:01 +0100
From: Brian McCauley <nobull@mail.com>
Subject: Re: Matching Multiple Patters In A Regex In Any Order
Message-Id: <dhe1ph$q30$1@redhat2.bham.ac.uk>
Hal Vaughan wrote:
> Is this possible? Is there some way, other than interating through a loop,
> to match multiple patterns?
Yes, but it's generally less efficient[1]. This is why the FAQ[2]
advises a loop. Recent versions do at least show the other way for
completeness.
[1] Benchmark in previous thread "Regex combining /(foo|bar)/ slower
than using foreach (/foo/,/bar/)?"
http://groups.google.com/group/comp.lang.perl.misc/browse_frm/thread/e6511d1fee90f808/cfe769be57f07393
[2] http://faq.perl.org/perlfaq6.html#How_do_I_efficiently
------------------------------
Date: Wed, 28 Sep 2005 07:35:08 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Shell script
Message-Id: <slrndjl3fs.kqo.tadmc@magna.augustmail.com>
[ Newsgroups trimmed.
I don't participate in the alt.* hierarchy and comp.lang.perl
was removed many years ago.
]
Shabam <chalupa@yomama-nospam.com> wrote:
> I'm trying to come up with a script that will take the username, email,
> name, and zip code as arguments.
The command line arguments are available in the @ARGV array.
perldoc perlvar
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 28 Sep 2005 11:44:00 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Use of hash variables in module call - puzzling behaviour
Message-Id: <dhdvm0$28$1@mamenchi.zrz.TU-Berlin.DE>
Henry Law <news@lawshouse.org> wrote in comp.lang.perl.misc:
> I have a piece of code that is to send mail using Mail::Internet from my
> Linux server (Perl 5.8.0). It reads variables - the recipient, the
> outbound mail server and so on - from an XML file into a hash.
>
> Using the variables in the hash causes errors in Mail::Internet; using
> equivalent variables from a hash created from data in the program does
> not cause the same error. Odder still, the error doesn't occur at all
> when I run the same program under ActiveState Perl in Windows.
>
> Can someone help? Firstly I'm at a loss to understand why this might
> be; secondly I've run out of ideas for debugging the thing.
I don't have the modules in question and was unable to install them
in a hurry, so what follows is unfounded speculation.
Are the strings in the hash returned from XMLin normal scalars?
They *could* be objects with overloaded stringification or tied
variables in which case something might rub them the wrong way.
Swap the "Sending with G_server variables" and "Sending with g_server
variables" blocks. It could be the second call that fails instead of
depending on which hash is used. Perhaps one of the objects involved
($mail or $header) is damaged after the first use.
Try mixed calls, for example taking adminuser from %G_server and the
others from %g_server.
Check versions (Perl, the modules) on the linux box against the
windows one.
That's all that comes to mind for now. I have added a couple of remarks
(untested) to the code below, but these are stylistic and have nothing
to do with debugging the problem.
Anno
> The program below simulates the reading of the XML through the use of
> __DATA__; it builds the Mail::Internet structures $header and $mail; it
> then executes the smtp send using first a structure built in the program
> itself ($G_server) and then the XML-derived structure ($g_server). The
> program even checks that the corresponding elements in $g_server and
> $G_server are the same ...
>
> ----------- sample program ------------
> #! /usr/bin/perl
>
> use strict;
> use warnings;
>
> use Mail::Internet;
> use Mail::Header;
> use XML::Simple;
>
> my @data = <DATA>;
> my $xml = XMLin(join (' ',@data));
No need for @data.
my $xml = XMLin join ' ', <DATA>;
or even
my $xml = XMLIN do{ local $/; <DATA> };
should do the same thing. The last one assumes that line feeds and spaces
are interchangeable as separators.
> my %g_server;
>
> $g_server{adminuser} = $xml -> {adminuser};
> $g_server{smtpserver} = $xml -> {smtpserver};
> $g_server{localuser} = $xml -> {localuser};
>
> my %G_server = (localuser=>'nfb@neptune.lawshouse.org',
> adminuser=>'postmaster@lawshouse.org',
> smtpserver=>'smtp.bt.net');
>
> my @message = ("Line 1\n","Line 2");
>
> print ( $g_server{localuser} eq $G_server{localuser} ?
> "localuser same\n" : "localuser different\n");
> print ( $g_server{adminuser} eq $G_server{adminuser} ?
> "adminuser same\n" : "adminuser different\n");
> print ( $g_server{smtpserver} eq $G_server{smtpserver} ?
> "smtpserver same\n" : "smtpserver different\n");
print $g_server{ $_} eq $G_server{ $_} ?
"$_ same\n" : "$_ different\n" for
qw( localuser adminuser smtpserver);
> my $header = Mail::Header->new( ["From:$g_server{localuser}",
> "Sender:$g_server{localuser}",
> "To:$g_server{adminuser}",
> "Subject:Testing"] );
>
> my $mail = Mail::Internet->new(Header=>$header,Body=>\@message);
>
> my @recipients;
>
> print "Sending with G_server variables\n";
> @recipients = $mail->smtpsend(Host=>$G_server{smtpserver},
> MailFrom=>$G_server{localuser},
> To=>$G_server{adminuser});
> print "Mail sent to @recipients\n";
>
> print "Sending with g_server variables\n";
> @recipients = $mail->smtpsend(Host=>$g_server{smtpserver},
> MailFrom=>$g_server{localuser},
> To=>$g_server{adminuser});
> print "Mail sent to @recipients\n";
> __DATA__
> <nfbserver>
> <adminuser>postmaster@lawshouse.org</adminuser>
> <smtpserver>smtp.bt.net</smtpserver>
> <localuser>nfb@neptune.lawshouse.org</localuser>
> </nfbserver>
>
> ----------------- output under Linux ----------------
> [nfb@neptune nfb]$ ./tryit.pl
> localuser same
> adminuser same
> smtpserver same
> Sending with G_server variables
> Mail sent to postmaster@lawshouse.org
> Sending with g_server variables
> Unrecognised line: postmaster@lawshouse.org at blib/lib/Mail/Internet.pm
> (autosplit into blib/lib/auto/Mail/Internet/smtpsend.al) line 616
> ---------------- ends ------------------
>
> OK, I'm braced for someone finding a simple typo in my code ...
--
If you want to post a followup via groups.google.com, don't use
the broken "Reply" link at the bottom of the article. Click on
"show options" at the top of the article, then click on the
"Reply" at the bottom of the article headers.
------------------------------
Date: Wed, 28 Sep 2005 11:41:20 +0100
From: Ben Brown <nospam@427.thetrash.org.uk>
Subject: Re: Using perl with Inetd
Message-Id: <433a7350$0$73599$ed2619ec@ptn-nntp-reader03.plus.net>
Villy Kruse wrote:
> On Tue, 27 Sep 2005 11:16:34 +0100,
> Ben Brown <ben@427.org.uk> wrote:
>
>
>
>>However, when run from telnet, you get this:
>>
>>Y/n: y
>>No match
>>Debugging: $choice = "y"
>>
>>Any assistance will be greatfully recieved!
>>
>
>
> You sure $choice doesn't contain invisible characters? These characters
> could come from the telnet client doing protocol negotiation.
>
> Villy
I'm pretty sure that it does have invisible characters, it's trying to
find out what they are I'm having trouble with.
I've tried $choice =~ s/\s+$//; but it's still the same.
Cheers,
Ben
------------------------------
Date: 28 Sep 2005 11:23:33 GMT
From: Villy Kruse <vek@station02.ohout.pharmapartners.nl>
Subject: Re: Using perl with Inetd
Message-Id: <slrndjkv9l.2fk.vek@station02.ohout.pharmapartners.nl>
On Wed, 28 Sep 2005 11:41:20 +0100,
Ben Brown <nospam@427.thetrash.org.uk> wrote:
>
> I'm pretty sure that it does have invisible characters, it's trying to
> find out what they are I'm having trouble with.
>
> I've tried $choice =~ s/\s+$//; but it's still the same.
>
For example unpack the string:
print unpack('H*', $choice), "\n";
Villy
------------------------------
Date: Wed, 28 Sep 2005 13:04:33 +0100
From: Ben Brown <nospam@427.thetrash.org.uk>
Subject: Re: Using perl with Inetd
Message-Id: <433a86d1$0$16323$ed2619ec@ptn-nntp-reader01.plus.net>
Villy Kruse wrote:
> On Wed, 28 Sep 2005 11:41:20 +0100,
> Ben Brown <nospam@427.thetrash.org.uk> wrote:
>
>
>
>>I'm pretty sure that it does have invisible characters, it's trying to
>>find out what they are I'm having trouble with.
>>
>>I've tried $choice =~ s/\s+$//; but it's still the same.
>>
>
>
>
> For example unpack the string:
>
> print unpack('H*', $choice), "\n";
>
> Villy
Thanks for that. Using that it shows that the following is being added
by telnet at the start of the variable:
fffb25fffd26fffb26fffd03fffb18fffb1ffffb20fffb21fffb22fffb27fffd05
Any ideas how to strip this out?
------------------------------
Date: Wed, 28 Sep 2005 07:30:31 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Using perl with Inetd
Message-Id: <slrndjl377.kqo.tadmc@magna.augustmail.com>
Ben Brown <nospam@427.thetrash.org.uk> wrote:
> Villy Kruse wrote:
>> You sure $choice doesn't contain invisible characters?
> I'm pretty sure that it does have invisible characters, it's trying to
> find out what they are I'm having trouble with.
Then write code that will look for them for you.
Something like:
foreach my $char (split //, $choice) {
my $chnum = ord($char);
next if $chnum >= 32 && $chnum <= 126; # "normal" ASCII
my $hex = sprintf '0x%X', $chnum;
my $oct = sprintf '0%o', $chnum;
print "$chnum $oct ($hex)\n";
}
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
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 8464
***************************************