[28743] in Perl-Users-Digest
Perl-Users Digest, Issue: 10107 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Dec 31 21:05:54 2006
Date: Sun, 31 Dec 2006 18:05:04 -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 Sun, 31 Dec 2006 Volume: 10 Number: 10107
Today's topics:
Re: Assigning pattern matches to an array <noreply@gunnar.cc>
Re: Assigning pattern matches to an array <ben.usenet@bsb.me.uk>
Re: Disable functionality thru commenting out a use (on aioe)
Perl LWP post to password protected script jcharth@hotmail.com
Re: Perl LWP post to password protected script <spamtrap@dot-app.org>
Re: Perl LWP post to password protected script <segraves_f13@mindspring.com>
Re: Perl LWP post to password protected script <john@castleamber.com>
Re: Problem by pushing a String and a Hash on an array! (on aioe)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 31 Dec 2006 11:34:18 +0100
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: Assigning pattern matches to an array
Message-Id: <4vpi52F1cp48tU1@mid.individual.net>
Graham Stow wrote:
> "DJ Stunks" wrote:
> >
> > try (untested):
> >
> > push @matches, map { $_->address } Email::Address->parse($line);
> >
> Using the above line of
> push @matches, map { $_->address } Email::Address->parse($line);
> on a directory including one 'Word' document containing four email
> addresses, I got the output:-
>
> ian@email.co.uk
>
> ian@email.co.uk}}}{\f1\fs20\lang1033\langfe1033\langnp1033
If I have understood it correctly, RFC 822 does not accept backslashes
in the domain part of an address. A bug in Email::Address?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Sun, 31 Dec 2006 14:37:42 +0000
From: Ben Bacarisse <ben.usenet@bsb.me.uk>
Subject: Re: Assigning pattern matches to an array
Message-Id: <87irfsp1vt.fsf@bsb.me.uk>
Gunnar Hjalmarsson <noreply@gunnar.cc> writes:
> Graham Stow wrote:
>> "DJ Stunks" wrote: >
>> > try (untested):
>> >
>> > push @matches, map { $_->address } Email::Address->parse($line);
>> >
>> Using the above line of
>> push @matches, map { $_->address } Email::Address->parse($line);
>> on a directory including one 'Word' document containing four email
>> addresses, I got the output:-
>> ian@email.co.uk
>> ian@email.co.uk}}}{\f1\fs20\lang1033\langfe1033\langnp1033
>
> If I have understood it correctly, RFC 822 does not accept backslashes
> in the domain part of an address. A bug in Email::Address?
The governing RFC is now 2822 and, no, it does not allow \ in the
domain. A quick look at the source suggests that this is a simple
omission. While the RFC defines what *is* allowed in a "dot-atom",
Email::Address lists what is to be excluded (control characters and
"special" characters) and \ is not there. The bug seems to be in the
line:
my $special = q[()<>\\[\\]:;@\\,."];
the intent being, presumably, to have \\\\ rather than to quote the
comma.
To the OP: fixing this will not solve your problem as curly brackets
*are* allowed so even a corrected Email::Address will parse more than
you'd like. If you were to use a package that can pull apart a Word
document so that you match only in the text parts you might not see
this problem since I image that the {}s are part of the document
structure rather than its text. Otherwise your only option is to
match less than the RFC allows. A reasonable heuristic might be that
no TLDs contain { or }.
--
Ben.
------------------------------
Date: Sun, 31 Dec 2006 00:27:03 -0600
From: "Mumia W. (on aioe)" <paduille.4060.mumia.w@earthlink.net>
Subject: Re: Disable functionality thru commenting out a use
Message-Id: <en7uk6$itr$1@aioe.org>
On 12/30/2006 08:49 AM, Robert Nicholson wrote:
> I want to disable some functionality by making it conditional that it's
> use statement is in the script.
>
> How in general can you tell if a module is present or loaded? if
> defined(X) what should X be?
>
> I want to disable some features in a big perl script by
> conditionalizing the code that relies on those modules and be able to
> disable those features by comment out the "use" line for the modules.
>
Here's one way:
use Data::Dumper;
my @watergate = qw(Haldeman Nixon Colson Dean);
if ($INC{'Data/Dumper.pm'}) {
print Dumper(\@watergate);
}
--
paduille.4060.mumia.w@earthlink.net
Windows Vista and your freedom in conflict:
http://www.badvista.org/
------------------------------
Date: 31 Dec 2006 10:49:06 -0800
From: jcharth@hotmail.com
Subject: Perl LWP post to password protected script
Message-Id: <1167590946.324815.252030@s34g2000cwa.googlegroups.com>
Hello i have a form that posts to a password protected script. Is there
a way to enter the username and password and post to a script with LWP?
I manage to get the form out of a password protected link using the LWP
username/password feature. but I dont think ill be lucky to post that
way. thanks
------------------------------
Date: Sun, 31 Dec 2006 14:05:32 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Perl LWP post to password protected script
Message-Id: <m2odpjubr7.fsf@Sherm-Pendleys-Computer.local>
jcharth@hotmail.com writes:
> Hello i have a form that posts to a password protected script. Is there
> a way to enter the username and password and post to a script with LWP?
> I manage to get the form out of a password protected link using the LWP
> username/password feature. but I dont think ill be lucky to post that
> way. thanks
What makes you think it would work differently for POST than for GET? Have
you tried it? What were the results?
If you're trying to make a series of requests as part of a "session", then
you might want to have a look at WWW::Mechanize.
sherm--
--
Web Hosting by West Virginians, for West Virginians: http://wv-www.net
Cocoa programming in Perl: http://camelbones.sourceforge.net
------------------------------
Date: Sun, 31 Dec 2006 22:00:40 GMT
From: "Bill Segraves" <segraves_f13@mindspring.com>
Subject: Re: Perl LWP post to password protected script
Message-Id: <cqWlh.5861$yx6.1754@newsread2.news.pas.earthlink.net>
<jcharth@hotmail.com> wrote in message
news:1167590946.324815.252030@s34g2000cwa.googlegroups.com...
> Hello i have a form that posts to a password protected script. Is there
> a way to enter the username and password and post to a script with LWP?
> I manage to get the form out of a password protected link using the LWP
> username/password feature. but I dont think ill be lucky to post that
> way. thanks
>
Google is your friend.
Check out Randal L. Schwartz' article, "Automatically Testing a Form", Web
Techniques Column 43 (Nov 1999), which you should be able to find on
Randal's web site. It should tell you all you need to know about the answer
to the subject question.
--
Bill Segraves
------------------------------
Date: 31 Dec 2006 23:35:04 GMT
From: John Bokma <john@castleamber.com>
Subject: Re: Perl LWP post to password protected script
Message-Id: <Xns98AAB2E0F1AE3castleamber@130.133.1.4>
jcharth@hotmail.com wrote:
> Hello i have a form that posts to a password protected script. Is there
> a way to enter the username and password and post to a script with LWP?
> I manage to get the form out of a password protected link using the LWP
> username/password feature. but I dont think ill be lucky to post that
> way. thanks
http://johnbokma.com/perl/phpbb-remote-backup.html
has a fine example of this using LWP::UserAgent. However, it might be very
well the case that you safe yourself some pain by using WWW::Mechanize.
--
John Experienced Perl programmer: http://castleamber.com/
Perl help, tutorials, and examples: http://johnbokma.com/perl/
------------------------------
Date: Sun, 31 Dec 2006 00:42:46 -0600
From: "Mumia W. (on aioe)" <paduille.4060.mumia.w@earthlink.net>
Subject: Re: Problem by pushing a String and a Hash on an array!
Message-Id: <en7uk8$itr$2@aioe.org>
On 12/30/2006 03:46 PM, pod69@gmx.net wrote:
> Hello,
>
> I try to push on an array(global) a string and a hash ->
> push(@array,{name => $n_name, hash => \%myhash});
>
> now i try to read out everything but i have a problems with the array?
> I try this to read everything out:
>
> sub println {
> for(my $i = 0; $i < scalar(@array) ; $i++ ){
> print $array[$i]{name};
> my %hash = $array[$i]{hash};
"$Array[$i]{hash}" contains a hash *reference*--not a complete hash. You
must de-reference the hash reference before assigning it to a new hash:
my %hash = %{ $array[$i]{hash} };
> foreach $key ( keys %hash){
> print $key." = ".$hash{$key}."\n"
> }
> }
> }
>
> the name gets printed out but not the hash?
>
> thx
>
I hope this helps.
--
paduille.4060.mumia.w@earthlink.net
Windows Vista and your freedom in conflict:
http://www.badvista.org/
------------------------------
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 10107
****************************************