[28861] in Perl-Users-Digest
Perl-Users Digest, Issue: 105 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Feb 9 22:11:07 2007
Date: Fri, 9 Feb 2007 19:10:29 -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, 9 Feb 2007 Volume: 11 Number: 105
Today's topics:
Globbing on Win32 annesville@hotmail.com
Re: Globbing on Win32 <bik.mido@tiscalinet.it>
Re: Globbing on Win32 annesville@hotmail.com
Re: Globbing on Win32 <bik.mido@tiscalinet.it>
Re: Globbing on Win32 annesville@hotmail.com
Re: Globbing on Win32 <bik.mido@tiscalinet.it>
How to create a self-referring datastructure in one lin <jdamon@gmail.com>
Re: How to create a self-referring datastructure in one <mark.clementsREMOVETHIS@wanadoo.fr>
Re: How to create a self-referring datastructure in one <attn.steven.kuo@gmail.com>
Re: How to create a self-referring datastructure in one <wahab-mail@gmx.de>
how to forward an array to another cgi? <robertchen117@gmail.com>
Re: how to forward an array to another cgi? (NOSPAM)
Re: how to forward an array to another cgi? <robertchen117@gmail.com>
Re: how to forward an array to another cgi? <spamtrap@dot-app.org>
Re: how to forward an array to another cgi? (NOSPAM)
Re: how to get recipient of email <nobull67@gmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 5 Feb 2007 03:41:04 -0800
From: annesville@hotmail.com
Subject: Globbing on Win32
Message-Id: <1170675664.229023.285460@v45g2000cwv.googlegroups.com>
Hello All,
I am still learning Perl. I am trying to write a script to
recursively list all the directories starting from a specified path.
Unfortunately it seems that the globbing function handles paths with/
without spaces in them very differently as shown by the test case
script below.
Some research seems seems to indicate that I would be better off using
opendir/readdir. Accepted, but I would like, as part of my learning
experience, for someone to explain in simple terms WHY the below
script handles different paths differently. Please note that I have
used literal paths, but in application I would obviously need to use a
variable - so if you suggest escaping the space, it is not so simple
(although it is do-able), and doesn't make any difference anyway.
I am using ActivePerl 5.8.8.820
Regards,
Nicolas
----- START PERL -----
use strict;
use warnings;
my $file;
print "--- Windows, unquoted ---\n"; # Returns a list of all files and
directories in 'C:\Windows'
foreach $file (<c:/windows/*>) {print "$file\n";};
print "--- Windows, quoted ---\n"; # Returns nothing
foreach $file (<"c:/windows/*">) {print "$file\n";};
print "--- Program Files, unquoted ---\n"; # Returns 'c:/program' as
the only result
foreach $file (<c:/program files/*>) {print "$file\n";};
print "--- Program Files, quoted ---\n"; # Returns a list of all the
files and directories in 'C:\Program Files'
foreach $file (<"c:/program files/*">) {print "$file\n";};
----- END PERL -----
------------------------------
Date: Mon, 05 Feb 2007 15:36:56 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Globbing on Win32
Message-Id: <2ffes290lu7pf3j4i3grdimg0pg685j3fo@4ax.com>
On 5 Feb 2007 03:41:04 -0800, annesville@hotmail.com wrote:
>Hello All,
>
>I am still learning Perl. I am trying to write a script to
>recursively list all the directories starting from a specified path.
^^^^^^^^^^^
^^^^^^^^^^^
This calls for File::Find or some of its cousins, like
File::Find::Rule or File::Finder. If you insist on reinventing the
wheel, you may still look into them to see how they are implemented.
>Unfortunately it seems that the globbing function handles paths with/
>without spaces in them very differently as shown by the test case
>script below.
It's all duly explained in
perldoc File::Glob
: Since v5.6.0, Perl's CORE::glob() is implemented in terms of
: bsd_glob(). Note that they don't share the same
: prototype--CORE::glob() only accepts a single argument. Due to
: historical reasons, CORE::glob() will also split its argument on
: whitespace, treating it as multiple patterns, whereas bsd_glob()
: considers them as one pattern.
>Some research seems seems to indicate that I would be better off using
>opendir/readdir. Accepted, but I would like, as part of my learning
In some situations you prefer glob(), in some other opendir/readdir.
The latter is certainly more verbose, but in some cases it may be
needed if you want maximum flexibility.
>experience, for someone to explain in simple terms WHY the below
>script handles different paths differently. Please note that I have
>used literal paths, but in application I would obviously need to use a
>variable - so if you suggest escaping the space, it is not so simple
>(although it is do-able), and doesn't make any difference anyway.
See above.
>print "--- Windows, unquoted ---\n"; # Returns a list of all files and
>directories in 'C:\Windows'
>foreach $file (<c:/windows/*>) {print "$file\n";};
BTW: I would use angular parentheses like that all the time in
one-liners. But definitely *not* in any longer code.
HTH,
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 5 Feb 2007 22:36:22 -0800
From: annesville@hotmail.com
Subject: Re: Globbing on Win32
Message-Id: <1170743782.061158.25190@v45g2000cwv.googlegroups.com>
Thanks for the pointers Michelle.
Nicolas
------------------------------
Date: Tue, 06 Feb 2007 09:12:41 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Globbing on Win32
Message-Id: <51egs2d4erqdolj9gip8bsmiv572lgcfgc@4ax.com>
On 5 Feb 2007 22:36:22 -0800, annesville@hotmail.com wrote:
>Thanks for the pointers Michelle.
Not that I'm bothered or offended, but... Michele (italian masculine
name as opposed to Michelle, which is a french feminine one).
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 6 Feb 2007 06:13:52 -0800
From: annesville@hotmail.com
Subject: Re: Globbing on Win32
Message-Id: <1170771232.506002.27320@s48g2000cws.googlegroups.com>
On Feb 6, 10:12 am, Michele Dondi <bik.m...@tiscalinet.it> wrote:
> On 5 Feb 2007 22:36:22 -0800, annesvi...@hotmail.com wrote:
>
> >Thanks for the pointers Michelle.
>
> Not that I'm bothered or offended, but... Michele (italian masculine
> name as opposed to Michelle, which is a french feminine one).
>
> Michele
> --
> {$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
> (($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
> .'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
> 256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
Whoa! Sorry 'bout that. I obviously don't qualify as a citizen of the
global community yet!
BTW, I am sure there must be a shorter way to write your signiture :-)
Nicolas
------------------------------
Date: Tue, 06 Feb 2007 20:56:42 +0100
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Globbing on Win32
Message-Id: <59nhs21jfj1lec5dnhb9hn0qrgeld5poq8@4ax.com>
On 6 Feb 2007 06:13:52 -0800, annesville@hotmail.com wrote:
>Whoa! Sorry 'bout that. I obviously don't qualify as a citizen of the
>global community yet!
>
>BTW, I am sure there must be a shorter way to write your signiture :-)
I'm not really sure, as it was more of a golfing exercise than an obfu
one. But I would be interested in any possible development.
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 9 Feb 2007 13:50:17 -0800
From: "jdamon@gmail.com" <jdamon@gmail.com>
Subject: How to create a self-referring datastructure in one line
Message-Id: <1171057817.286120.153440@a75g2000cwd.googlegroups.com>
Hi,
I'm trying to create a self referential datastructure in one line.
An example is :
my %tree;
%tree = (
root => {
parent1 => {
child => {
data => "foo",
root => $tree{root} # or even \%{$tree{root}}
}
}
}
);
The problem is that the reference doesn't exist at the time that the
structure is created.
If you are going to post back to this , I DON'T want the solution when
you build this up iteratively. I just want to know if it can be done
in a declaration like stated above.
------------------------------
Date: Fri, 09 Feb 2007 23:06:13 +0100
From: Mark Clements <mark.clementsREMOVETHIS@wanadoo.fr>
Subject: Re: How to create a self-referring datastructure in one line
Message-Id: <45ccf055$0$27411$ba4acef3@news.orange.fr>
jdamon@gmail.com wrote:
> Hi,
>
> I'm trying to create a self referential datastructure in one line.
Why?
> An example is :
>
>
>
> my %tree;
> %tree = (
> root => {
> parent1 => {
> child => {
> data => "foo",
> root => $tree{root} # or even \%{$tree{root}}
> }
> }
> }
> );
>
> The problem is that the reference doesn't exist at the time that the
> structure is created.
use strict; use warnings; my $var; $var = \$var; print "$var ${$var}\n";
Or am I missing the point?
------------------------------
Date: 9 Feb 2007 14:35:07 -0800
From: "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: How to create a self-referring datastructure in one line
Message-Id: <1171060507.878704.276470@j27g2000cwj.googlegroups.com>
On Feb 9, 1:50 pm, "jda...@gmail.com" <jda...@gmail.com> wrote:
> Hi,
>
> I'm trying to create a self referential datastructure in one line.
>
> An example is :
>
> my %tree;
> %tree = (
> root => {
> parent1 => {
> child => {
> data => "foo",
> root => $tree{root} # or even \%{$tree{root}}
> }
> }
> }
> );
>
> The problem is that the reference doesn't exist at the time that the
> structure is created.
>
> If you are going to post back to this , I DON'T want the solution when
> you build this up iteratively. I just want to know if it can be done
> in a declaration like stated above.
use strict;
use warnings;
use Data::Dumper;
$_->{root} = {
parent => {
child => {
data => 'foo',
root => \$$_{root}
}
}
} for \my %tree;
print Dumper \%tree;
__END__
I can't imagine why a one-liner requirement is necessary, however.
--
Hope this helps,
Steven
------------------------------
Date: Sat, 10 Feb 2007 01:36:20 +0100
From: Mirco Wahab <wahab-mail@gmx.de>
Subject: Re: How to create a self-referring datastructure in one line
Message-Id: <eqj4cs$an8$1@mlucom4.urz.uni-halle.de>
attn.steven.kuo@gmail.com wrote:
>
> $_->{root} = {
> parent => {
> child => {
> data => 'foo',
> root => \$$_{root}
> }
> }
> } for \my %tree;
>
> I can't imagine why a one-liner requirement is necessary, however.
Interesting Idea. That one leads directly to the
'one expression initialization' (what I think was meant):
...
my %tree = (
map {
$_->{root} = {
parent => {
child => {
data => 'foo',
root => \$$_{root}
}
}
};
%$_
} {}
);
...
Thanks for this nice idea (didn't know
"this way" of post instantiation-
initialization of hashes)
Regards
M.
------------------------------
Date: 6 Feb 2007 20:40:21 -0800
From: "robertchen117@gmail.com" <robertchen117@gmail.com>
Subject: how to forward an array to another cgi?
Message-Id: <1170823221.326316.193170@q2g2000cwa.googlegroups.com>
I have a CGI, and generate one array, I want to display in another
page, how to forward the array to another cgi?
Thanks.
------------------------------
Date: Tue, 06 Feb 2007 23:25:22 -0600
From: "Mumia W. (NOSPAM)" <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: how to forward an array to another cgi?
Message-Id: <eqbno0$ar8$1@aioe.org>
On 02/06/2007 10:40 PM, robertchen117@gmail.com wrote:
> I have a CGI, and generate one array, I want to display in another
> page, how to forward the array to another cgi?
>
> Thanks.
>
You can store the array in a session using CGI::Session, or you can POST
the array to the other cgi script.
--
Windows Vista and your freedom in conflict:
http://www.badvista.org/
------------------------------
Date: 7 Feb 2007 05:30:34 -0800
From: "robertchen117@gmail.com" <robertchen117@gmail.com>
Subject: Re: how to forward an array to another cgi?
Message-Id: <1170855034.248874.290690@s48g2000cws.googlegroups.com>
Yes, I just do not know how to POST the array value to the other CGI.
I need an example. Thanks.
On 2=D4=C27=C8=D5, =CF=C2=CE=E71=CA=B125=B7=D6, "Mumia W. (NOSPAM)" <paduil=
le.4060.mumia.w
+nos...@earthlink.net> wrote:
> On 02/06/2007 10:40 PM, robertchen...@gmail.com wrote:
>
> > I have a CGI, and generate one array, I want to display in another
> > page, how to forward the array to another cgi?
>
> > Thanks.
>
> You can store the array in a session using CGI::Session, or you can POST
> the array to the other cgi script.
>
> --
> Windows Vista and your freedom in conflict:http://www.badvista.org/
Yes, I just do not know how to POST the array value to the other CGI.
I need an example. Thanks.
------------------------------
Date: Wed, 07 Feb 2007 16:18:06 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: how to forward an array to another cgi?
Message-Id: <m2fy9hzmy9.fsf@Sherm-Pendleys-Computer.local>
"robertchen117@gmail.com" <robertchen117@gmail.com> writes:
> Yes, I just do not know how to POST the array value to the other CGI.
> I need an example. Thanks.
Please don't top-post.
> On 2月7日, 下午1时25分, "Mumia W. (NOSPAM)" <paduille.4060.mumia.w
> +nos...@earthlink.net> wrote:
>>
>> You can store the array in a session using CGI::Session, or you can POST
>> the array to the other cgi script.
>
> Yes, I just do not know how to POST the array value to the other CGI.
> I need an example. Thanks.
Have a look at the LWP::UserAgent module. The specific form element you'll
want to post, and how the array elements are arranged to fit those form
elements, will depend entirely on what the target CGI expects to receive.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Wed, 07 Feb 2007 14:53:28 -0600
From: "Mumia W. (NOSPAM)" <paduille.4060.mumia.w+nospam@earthlink.net>
Subject: Re: how to forward an array to another cgi?
Message-Id: <eqdig8$rjv$1@aioe.org>
On 02/07/2007 07:30 AM, robertchen117@gmail.com wrote:
> On 27, 1ʱ25, "Mumia W. (NOSPAM)" <paduille.4060.mumia.w
> +nos...@earthlink.net> wrote:
>> On 02/06/2007 10:40 PM, robertchen...@gmail.com wrote:
>>
>>> I have a CGI, and generate one array, I want to display in another
>>> page, how to forward the array to another cgi?
>>> Thanks.
>> You can store the array in a session using CGI::Session, or you can POST
>> the array to the other cgi script.
>>
>> --
>> Windows Vista and your freedom in conflict:http://www.badvista.org/
>
> Yes, I just do not know how to POST the array value to the other CGI.
> I need an example. Thanks.
>
Read the perl documentation for the LWP cookbook:
perldoc lwpcook
Get an overview of all of the perl documentation available on your system:
perldoc perl
--
Windows Vista and your freedom in conflict:
http://www.securityfocus.com/columnists/420/2
------------------------------
Date: 2 Feb 2007 23:52:52 -0800
From: "Brian McCauley" <nobull67@gmail.com>
Subject: Re: how to get recipient of email
Message-Id: <1170489172.605198.182920@v45g2000cwv.googlegroups.com>
On Feb 3, 12:13 am, jcha...@hotmail.com wrote:
> Hello I noticed that when amavis quarantines a message adds the X-
> envelop-to tag to the headers of the email. This header has all the
> recipients of the email. Some email files dont have a TO
> or have a BCC. Can anyone tell me how to get all recipients in a eml
> file?
No.
The recipients of an e-mail in transit are written on the envelope,
not in the message itself.
When your MUA send a mail the recipients will often get copied from
the headers to the envelope. At this point the BCC (add BC-like)
headers are removed. But addresses can also get on to the envelope in
other ways.
If a mail has multiple recipients it will, in general, be split and
handled many MTAs. The envelope seen by each MTA will only contain the
recipients for which that MTA is handling delivery.
I'm not familiar with Amavis but I assume it's running on an MTA and
is passed the message and the envelope. Presumably it places a copy of
the envelope-to it sees in the X- header. This is bad because it
potentially allows the To: recepient to see the BCC: recepient. If
Amavis is running on the senders MTA this might be the full list. If
it's running on the recepient's MTA it will only see other recpient's
whose inbound mail is also handled by the same MTA.
None of this, of course, has anything to do with Perl.
------------------------------
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 105
**************************************