[25720] in Perl-Users-Digest
Perl-Users Digest, Issue: 7960 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Apr 10 18:05:44 2005
Date: Sun, 10 Apr 2005 15:05:12 -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 Sun, 10 Apr 2005 Volume: 10 Number: 7960
Today's topics:
=?iso-8859-1?B?VEhFIEdSRUFURVNUIE5FV1MgRVZFUiEgsLq3Ll8u RonGrossi_38211@yahoo.com
epic debugger and "my" variables (Kiwi)
Re: epic debugger and "my" variables <hendrik_maryns@despammed.com>
Re: FAQ 4.17 How do I find yesterday's date? <user@use.net>
Re: How to create an empty file? (second attempt) <nobull@mail.com>
Re: How to create an empty file? (second attempt) <1usa@llenroc.ude.invalid>
Re: How to create an empty file? <please_post@nomail.edu>
Re: How to create an empty file? <1usa@llenroc.ude.invalid>
if(wantarray){...}else{...} <burlo.stumproot@gmail.com>
Re: if(wantarray){...}else{...} <1usa@llenroc.ude.invalid>
Re: if(wantarray){...}else{...} <1usa@llenroc.ude.invalid>
Re: Login to my hotmail account with LWP <fayland@gmail.com>
Re: Login to my hotmail account with LWP ioneabu@yahoo.com
newbie baffled by de/referencing with subroutines <konradj@mindspring.com>
Re: newbie baffled by de/referencing with subroutines <1usa@llenroc.ude.invalid>
Re: newbie baffled by de/referencing with subroutines <konradj@mindspring.com>
pipes in Windows perlfork emulation <henry.townsend@not.here>
tricks against WWW::Mechanize <noone@nowhere.com>
Re: tricks against WWW::Mechanize ioneabu@yahoo.com
UNIX Script To Remove Hosts from Hosts file <hx_101@hotmail.com>
Re: UNIX Script To Remove Hosts from Hosts file <tadmc@augustmail.com>
Re: Working in a secure site <jimsimpson@cox.net>
WWW::Mechanize problem when logging in Rakuten <noone@nowhere.com>
Re: WWW::Mechanize problem when logging in Rakuten <1usa@llenroc.ude.invalid>
Re: WWW::Mechanize problem when logging in Rakuten <noone@nowhere.com>
Re: WWW::Mechanize problem when logging in Rakuten <1usa@llenroc.ude.invalid>
Re: WWW::Mechanize problem when logging in Rakuten <tadmc@augustmail.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Apr 2005 14:47:13 -0700
From: RonGrossi_38211@yahoo.com
Subject: =?iso-8859-1?B?VEhFIEdSRUFURVNUIE5FV1MgRVZFUiEgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63urBgsLq3Ll8uXy63IChuZXdzZ3JvdXAtcG9zdCAxMzAp?=
Message-Id: <1113169633.458752.141730@z14g2000cwz.googlegroups.com>
The Greatest News Ever! click link
http://groups-beta.google.com/group/alt.politics.bush/browse_thread/thread/=
9b420fd9fc320e49/0215b46e845a8553#0215b46e845a8553
=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7=
._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=B7._._.=B7=BA=B0`=
=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=
=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=
=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=
=B0`=B0=BA=B7._._.=B7=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._.=
_=2E=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._=
.=B7=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=
=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=B7._._.=B7=
=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=
=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=B7._._.=B7=BA=B0`=B0=BA=B7._.=
_=2E=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._=
.=B7=BA=B0`=B0=BA=B7._._.=B7=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=
=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=
=B7._._.=B7=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=
=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=B7._.=
_=2E=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._=
.=B7=BA=B0`=B0=BA=B7._._.=B7=BA=B0`=B0=BA=B7._._.=B7
The reason some people don't know for sure
if they are going to Heaven when they die
is because they just don't know.
The good news is that you can know for
sure that you are going to Heaven which is
described in the Holy Bible as a beautiful
place with no death, sorrow, sickness or
pain.
God tells us in the Holy Bible how simple
it is to be saved so that we can live
forever with Him in Heaven.
"For if you confess with your mouth Jesus
is Lord and believe in your heart that God
raised Him from the dead, you
WILL BE SAVED." (Romans 10:9)
Over 2000 years ago God came from Heaven
to earth in the person of Jesus Christ to
shed His blood and die on a cross to pay
our sin debt in full.
Jesus Christ was born in Israel
supernaturally to a virgin Jewish woman
named Mary and lived a sinless life for
thirty-three years.
At the age of thirty-three Jesus was
scourged and had a crown of thorns pressed
onto His head then Jesus was crucified.
Three days after Jesus died on a cross and
was placed in a grave Jesus rose from the
dead as Jesus said would happen before
Jesus died.
If someone tells you that they are going
to die and in three days come back to life
again and it happens then this person must
be the real deal.
Jesus Christ is the only person that ever
lived a perfect sinless life.
This is why Jesus is able to cover our
sins(misdeeds) with His own blood because
Jesus is sinless.
The Holy Bible says, "In Him(Jesus) we
have redemption through His blood, the
forgiveness of sins..." (Ephesians 1:7)
If you would like God to forgive you of
your past, present and future sins just
ask Jesus Christ to be your Lord and
Saviour.
It doesn't matter how old you are or how
many bad things that you have done in
your life including lying and stealing
all the way up to murder.
Just pray the prayer below with your
mouth and mean it from your heart and
God will hear you and save you.
Dear Jesus Christ, I want to be saved so
that I can have a home in Heaven with You
when I die. I agree with You that I am a
sinner. I believe that You love me and want
to save me. I believe that You bled and
died on the cross to pay the penalty for my
sins and that You rose from the dead.
Please forgive my sins and come into my
heart and be my Lord and Saviour. Thanks
Lord Jesus Christ for forgiving me and
saving me through Your merciful grace.
Amen.
Welcome to the family of God if you just
allowed God to save you. Now you are a real
Christian and you can know for sure that
you will live in Heaven forever when this
life comes to an end.
As a child of God we are to avoid
sin(wrong doing), but if you do sin the
Holy Bible says, "My dear children, I
write this to you so that you will not sin.
But if anybody does sin, we have one who
speaks to the Father in our defense Jesus
Christ, the Righteous One."
Those of you that have not yet decided to
place your trust in the Lord Jesus Christ
may never get another chance to do so
because you do not know when you will die.
This means that if you die without
trusting in Jesus Christ as your Lord and
Saviour you will be forever separated from
the love of God in a place called Hell.
The Holy Bible descibes Hell as a place of
eternal torment, suffering, pain and agony
for all those who have rejected Jesus Christ.
The good news is that you can avoid Hell by
allowing Jesus Christ to save you today.
Only then will you have true peace in your
life knowing that no matter what happens you
are on your way to Heaven.
Servant of the Lord Jesus Christ,
Internet Evangelist
Ronald L. Grossi
____________________________________________________
Got Questions?
http://www.gotquestions.org/archive.html
Other Languages
http://www.godssimpleplan.org/gsps.html
Free Movie: To Hell and Back
http://www.tbn.org/index.php/8/1.html
Animation
http://www.gieson.com/Library/projects/animations/walk/index.html
The Passion Of The Christ
http://www.thepassionofthechrist.com
Beware Of Cults
http://www.carm.org/cults/cultlist.htm
About Hell
http://www.equip.org/free/DH198.htm
Is Jesus God?
http://www.powertochange.com/questions/qna2.html
Free Online Bible
http://www.bibledatabase.net
------------------------------
Date: 10 Apr 2005 11:39:42 -0700
From: kiwi@s05.itscom.net (Kiwi)
Subject: epic debugger and "my" variables
Message-Id: <dc95c98e.0504101039.10e8c765@posting.google.com>
Hello.
I have just installed the epic-0.3.0 eclipse plug-in for Perl.
It seems to be that the debugger can display global and "local" variables
but cannot display meaningful values of "my" variables.
It just displays "..." for all "my" variables.
Is this an expected behavior or is my installation wrong?
Thank you in advance.
------------------------------
Date: Sun, 10 Apr 2005 21:11:20 +0200
From: Hendrik Maryns <hendrik_maryns@despammed.com>
Subject: Re: epic debugger and "my" variables
Message-Id: <1113160298.130413@seven.kulnet.kuleuven.ac.be>
Kiwi schreef:
> Hello.
>
> I have just installed the epic-0.3.0 eclipse plug-in for Perl.
> It seems to be that the debugger can display global and "local" variables
> but cannot display meaningful values of "my" variables.
> It just displays "..." for all "my" variables.
> Is this an expected behavior or is my installation wrong?
You might want to post this on the epic-forum:
http://sourceforge.net/forum/forum.php?forum_id=258688
H.
--
Hendrik Maryns
Interesting websites:
www.lieverleven.be (I cooperate)
www.eu04.com European Referendum Campaign
aouw.org The Art Of Urban Warfare
------------------------------
Date: Sun, 10 Apr 2005 18:46:14 GMT
From: Tim <user@use.net>
Subject: Re: FAQ 4.17 How do I find yesterday's date?
Message-Id: <2005041012461480302%user@usenet>
On 2005-04-08 16:03:01 -0600, PerlFAQ Server <comdog@panix.com> said:
> 4.17: How do I find yesterday's date?
>
> If you only need to find the date (and not the same time), you can use
> the Date::Calc module.
>
> use Date::Calc qw(Today Add_Delta_Days);
>
> my @date = Add_Delta_Days( Today(), -1 );
>
> print "@date\n";
Date::Calc can be used to find the same time of day as well:
use Date::Calc qw(Today_and_Now Add_Delta_DHMS);
my @date_time = Add_Delta_DHMS(Today_and_Now(), -1, 0, 0, 0);
print "@date\n";
------------------------------
Date: 10 Apr 2005 12:25:56 -0700
From: "nobull@mail.com" <nobull@mail.com>
Subject: Re: How to create an empty file? (second attempt)
Message-Id: <1113161156.905943.268680@z14g2000cwz.googlegroups.com>
bill wrote:
> [ My first post on this this question contained a typo that
> made the code included in that post inoperative. Please disregard
> it. ]
Please do not start a new thread to correct an existing post.
Follow-up.
>
> What's the best way to create an empty file? I mean is there
> something less verbose and circuitous than
>
> {
> my $inane;
> open $inane, '>', $empty and close $inane
> or die "Failed to create $empty: $!\n";
> }
Well since you've not written anything after the open() and before the
close() it's probably OK not to check the return value of close() so
you can use an implicit close.
{
open my $inane, '>', $empty
or die "Failed to create $empty: $!\n";
}
------------------------------
Date: Sun, 10 Apr 2005 20:44:39 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: How to create an empty file? (second attempt)
Message-Id: <Xns9634AA4498955asu1cornelledu@127.0.0.1>
"nobull@mail.com" <nobull@mail.com> wrote in
news:1113161156.905943.268680@z14g2000cwz.googlegroups.com:
> bill wrote:
>> [ My first post on this this question contained a typo that
>> made the code included in that post inoperative. Please disregard
>> it. ]
>
> Please do not start a new thread to correct an existing post.
>
> Follow-up.
Ditto.
>> What's the best way to create an empty file? I mean is there
>> something less verbose and circuitous than
>>
>> {
>> my $inane;
>> open $inane, '>', $empty and close $inane
>> or die "Failed to create $empty: $!\n";
>> }
>
> Well since you've not written anything after the open() and before the
> close() it's probably OK not to check the return value of close() so
> you can use an implicit close.
>
> {
> open my $inane, '>', $empty
> or die "Failed to create $empty: $!\n";
> }
I still question the OP's motive for searching for the shortest way of
doing this. If it is because there are many places in his code where
this type of a block appears, then he is better off moving the code to a
subroutine that is named explicitly after its purpose.
If, on the other hand, the code is seldom used, what is the point of
saving a few keystrokes at the expense of correctness. The close can
fail for various reasons. Without knowing the purpose of this code, it
is hard to assert that the possibility of failure should be ignored.
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: Sun, 10 Apr 2005 18:44:56 +0000 (UTC)
From: bill <please_post@nomail.edu>
Subject: Re: How to create an empty file?
Message-Id: <d3bs78$skh$1@reader1.panix.com>
In <d3ao8p$68g$1@pin3.tky.plala.or.jp> ko <kuujinbo@hotmail.com> writes:
>bill wrote:
>> What's the best way to create an empty file? I mean is there
>> something less circuitous than
>>
>> {
>> my $inane;
>> open my $inane, '>', $empty and close $inane
>> or die "Failed to create $empty: $!\n";
>> }
>>
>> and that does not use system(), as in
>>
>> system('touch', $empty);
>>
>> ?
>>
>> Thanks!
>>
>> bill
>>
>perl -MExtUtils::Command -e touch nonexistent_file
Way cool. Thanks!
bill
------------------------------
Date: Sun, 10 Apr 2005 18:51:19 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: How to create an empty file?
Message-Id: <Xns9634970BB523Easu1cornelledu@127.0.0.1>
bill <please_post@nomail.edu> wrote in
news:d3bs78$skh$1@reader1.panix.com:
> In <d3ao8p$68g$1@pin3.tky.plala.or.jp> ko <kuujinbo@hotmail.com>
> writes:
>
>>bill wrote:
>>> What's the best way to create an empty file? I mean is there
>>> something less circuitous than
>>>
>>> {
>>> my $inane;
>>> open my $inane, '>', $empty and close $inane
>>> or die "Failed to create $empty: $!\n";
>>> }
>>>
...
>>perl -MExtUtils::Command -e touch nonexistent_file
>
> Way cool. Thanks!
Of course, you should be careful using it because all the subs in
ExtUtils::Command use @ARGV rather than subroutine arguments.
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: 10 Apr 2005 14:12:28 -0700
From: "Stumproot" <burlo.stumproot@gmail.com>
Subject: if(wantarray){...}else{...}
Message-Id: <1113167548.426110.231150@o13g2000cwo.googlegroups.com>
Posted from/using google news.
I have "return" snippets like this in several funktions
and I'm getting tired of writing them.
Is there a better way?
sub fun1 {
.
.
.
lots going on
.
.
# Start return snippet
if(wantarray) {
my @res = A_Funktion($a1,$a2);
return @res;
} else {
return A_Funktion($a1,$a2);
}
# End return snippet
}
sub fun2 {
.
.
.
lots going on
.
.
# Start return snippet
if(wantarray) {
my @res = Another_Funktion($a1,$a2);
return @res;
} else {
return Another_Funktion($a1,$a2);
}
# End return snippet
}
and several more...
------------------------------
Date: Sun, 10 Apr 2005 21:26:28 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: if(wantarray){...}else{...}
Message-Id: <Xns9634B15B5D7D9asu1cornelledu@127.0.0.1>
"Stumproot" <burlo.stumproot@gmail.com> wrote in
news:1113167548.426110.231150@o13g2000cwo.googlegroups.com:
> Posted from/using google news.
Why is that relevant?
> I have "return" snippets like this in several funktions
> and I'm getting tired of writing them.
OK.
> Is there a better way?
I am not sure because I don't really understand what problem you are
attempting to solve.
> # Start return snippet
> if(wantarray) {
> my @res = A_Funktion($a1,$a2);
> return @res;
> } else {
> return A_Funktion($a1,$a2);
> }
Does A_Funktion behave differenly in scalar versus array context? If it
does not, then you shouldn't worry about wantarray.
#! /usr/bin/perl
my $r = A_Funktion(qw(Hello Goodbye));
my @r = A_Funktion(qw(Hello Goodbye));
print "$r\n@r\n";
sub A_Funktion_Caller {
A_Funktion(@_);
}
sub A_Funktion {
my ($x, $y) = @_;
"$x and $y";
}
__END__
On the other hand, is the following more like the situation above?
#! /usr/bin/perl
my $r = A_Funktion(qw(Hello Goodbye));
my @r = A_Funktion(qw(Hello Goodbye));
print "$r\n@r\n";
sub A_Funktion_Caller {
wantarray ? A_Funktion(@_) : scalar A_Funktion(@_);
}
sub A_Funktion {
my ($x, $y) = @_;
my $r = "$x and $y";
wantarray ? $r : length $r;
}
__END__
Please do read the posting guidelines posted here regularly. The
guidelines contain valuable information on how to help others help you.
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: Sun, 10 Apr 2005 21:37:25 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: if(wantarray){...}else{...}
Message-Id: <Xns9634B3365F9DEasu1cornelledu@127.0.0.1>
"A. Sinan Unur" <1usa@llenroc.ude.invalid> wrote in
news:Xns9634B15B5D7D9asu1cornelledu@127.0.0.1:
Please note the corrections below.
> #! /usr/bin/perl
>
> my $r = A_Funktion(qw(Hello Goodbye));
> my @r = A_Funktion(qw(Hello Goodbye));
my $r = A_Funktion_Caller(qw(Hello Goodbye));
my @r = A_Funktion_Caller(qw(Hello Goodbye));
> print "$r\n@r\n";
>
> sub A_Funktion_Caller {
> A_Funktion(@_);
> }
>
> sub A_Funktion {
> my ($x, $y) = @_;
> "$x and $y";
> }
>
> __END__
>
> On the other hand, is the following more like the situation above?
... is the following a better approximation to your situation?
> #! /usr/bin/perl
>
> my $r = A_Funktion(qw(Hello Goodbye));
> my @r = A_Funktion(qw(Hello Goodbye));
my $r = A_Funktion_Caller(qw(Hello Goodbye));
my @r = A_Funktion_Caller(qw(Hello Goodbye));
> print "$r\n@r\n";
>
> sub A_Funktion_Caller {
> wantarray ? A_Funktion(@_) : scalar A_Funktion(@_);
> }
>
> sub A_Funktion {
> my ($x, $y) = @_;
> my $r = "$x and $y";
> wantarray ? $r : length $r;
> }
>
> __END__
Sorry about the typos.
--
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: Sun, 10 Apr 2005 18:19:44 +0800
From: "fayland" <fayland@gmail.com>
Subject: Re: Login to my hotmail account with LWP
Message-Id: <d3auj9$b6o$1@news.yaako.com>
Try WWW::Mechanize
> I'm trying to do this since a long long time, I really try everything
> before posting here
>
> Is there any perl example about loging to an hotmail email account
> with LWP ? (Not with pop3)
>
> I have some problem to figure out exactly how to pass the "correct"
> query string in the authentification part and dealing with the
> redirection, cookies, https, ...
>
> When trying to login into hotmail , the post part look like this :
>
https://loginnet.passport.com/ppsecure/post.srf?lc=3084&id=2&tw=20&fs=1&cbid=24325&da=passport.com&kpp=2&svc=mail&msppjph=1
>
> Thanks, i really need an example or any clues about how to login in
> such particular webpage (hotmail)
>
> Michel
------------------------------
Date: 10 Apr 2005 06:05:11 -0700
From: ioneabu@yahoo.com
Subject: Re: Login to my hotmail account with LWP
Message-Id: <1113138311.198902.163500@o13g2000cwo.googlegroups.com>
fayland wrote:
> Try WWW::Mechanize
even better:
after learning abouth WWW::Mechanize, use HTTP::Recorder to help write
your script. The only downside of this method is that it will not
record javascript or SSL, which greatly limits its usefulness in tasks
like checking bank statements etc...
It seems like some web sites are just designed to make access via
WWW::Mechanize difficult or impossible. There are a couple that I can
not get to work and I can't use Recorder because they are over SSL.
I'll have to get on their e-mail list.
For your task, a search of search.cpan.org for 'mechanize hotmail'
revealed a promising module named WWW::Hotmail.
wana
------------------------------
Date: 10 Apr 2005 13:21:22 -0700
From: "Jessica" <konradj@mindspring.com>
Subject: newbie baffled by de/referencing with subroutines
Message-Id: <1113164482.542144.242050@o13g2000cwo.googlegroups.com>
I created an elaborate array (my @uniqueParsed) inside a subroutine
and I want to use data from that array after the sub is finished. I
declared a reference inside the sub:
my $uniqueParsed_r = \@uniqueParsed;
then tried to print the data outside the sub by this dereference:
print "dereferenced array is @$uniqueParsed_r \n";
but nothing was returned (i.e., @$uniqueParsed_r is empty). By the
way, if I put the print statement inside the sub, the dereferenced
array prints correctly.
What's wrong with my reference and/or dereference, and how do I fix it?
Thanks!
------------------------------
Date: Sun, 10 Apr 2005 20:38:49 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: newbie baffled by de/referencing with subroutines
Message-Id: <Xns9634A947040DDasu1cornelledu@127.0.0.1>
"Jessica" <konradj@mindspring.com> wrote in
news:1113164482.542144.242050@o13g2000cwo.googlegroups.com:
> I created an elaborate array (my @uniqueParsed) inside a subroutine
> and I want to use data from that array after the sub is finished. I
> declared a reference inside the sub:
>
> my $uniqueParsed_r = \@uniqueParsed;
>
> then tried to print the data outside the sub by this dereference:
>
> print "dereferenced array is @$uniqueParsed_r \n";
>
> but nothing was returned (i.e., @$uniqueParsed_r is empty). By the
> way, if I put the print statement inside the sub, the dereferenced
> array prints correctly.
>
> What's wrong with my reference and/or dereference, and how do I fix
> it?
Have you seen the posting guidelines posted here regularly?
The guidelines contain valuable information on how to help others help
you, do read them.
I have a feeling you are missing:
use warnings;
use strict;
in your code.
I will venture to guess that you are not returning the reference from
your sub. In that case, $uniqueParsed_r only exists within the lexical
scope of the subroutine.
Please post a short example script that exhibits the problem so that we
don't have to guess what you are actually doing.
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: 10 Apr 2005 14:53:47 -0700
From: "Jessica" <konradj@mindspring.com>
Subject: Re: newbie baffled by de/referencing with subroutines
Message-Id: <1113170027.017229.15810@g14g2000cwa.googlegroups.com>
Thanks for your reply, Sinan. You're right, I haven't checked the
posting guidelines (abject apologies from this thoroughly befuddled
newbie). Also I did not use warnings or strict, as that's not what our
instructor has us do, for better or worse.
As far as sample code, here's a sketch. The actual code that generates
@uniqueParsed is long and probably irrelevant, so I'll kinda skip over
it:
sub parseGff
{
do lots of stuff ...
my @uniqueParsed = ();
put stuff into @uniqueParsed ...
my $uniqueParsed_r = \@uniqueParsed;
some more stuff that doesn't matter here ...
}
parseGff
print "dereferenced array is @{$uniqueParsed_r} \n";
So you're right, I don't return anything - and that's the part that has
me baffled. How do I return a reference from the sub? (I have zero
background in programming, it's only the 5th lecture and we're doing
references - the instructor is going too fast for newbies like me.)
Thanks again for your help!
------------------------------
Date: Sun, 10 Apr 2005 08:43:14 -0400
From: Henry Townsend <henry.townsend@not.here>
Subject: pipes in Windows perlfork emulation
Message-Id: <RKKdnZRZR4v_gsTfRVn-3A@comcast.com>
Does anyone here have any background info about the following paragraph
which appears in "perldoc perlfork" regarding the emulation of fork()
for Windows?
In certain cases, the OS-level handles created by
the pipe(), socket(), and accept() operators are
apparently not duplicated accurately in
pseudo-processes. This only happens in some
situations, but where it does happen, it may result
in deadlocks between the read and write ends of pipe
handles, or inability to send or receive data across
socket handles.
I'm running into a deadlock situation involving pipes which seems much
like that described. But before I attribute it to a Perl/Win32 bug I
want to do some research. Unfortunately the phrasing above ("certain
cases") is so general as to cover just about anything.
--
Henry Townsend
------------------------------
Date: Sun, 10 Apr 2005 17:48:26 +0200
From: noone <noone@nowhere.com>
Subject: tricks against WWW::Mechanize
Message-Id: <pan.2005.04.10.15.48.26.655678@nowhere.com>
Hi,
It seems some websites are designed not to work woth WWW::Mechanize,
especially when it involves cookies. What kind of tricks are used? How to
get around them?
Thanks,
David
------------------------------
Date: 10 Apr 2005 12:23:09 -0700
From: ioneabu@yahoo.com
Subject: Re: tricks against WWW::Mechanize
Message-Id: <1113160989.575021.167250@o13g2000cwo.googlegroups.com>
noone wrote:
> Hi,
>
> It seems some websites are designed not to work woth WWW::Mechanize,
> especially when it involves cookies. What kind of tricks are used?
How to
> get around them?
>
> Thanks,
>
> David
I just got into playing around with WWW::Mechanize too. It has worked
for me on at least one site that requires cookies (yp.yahoo.com).
I have had trouble with two sites that use SSL. I did install
IO::Socket::SSL and was able to work with some sites, but two of them
would not submit the username and password to the next page.
I have been using HTTP::Recorder to help, but it does not work over
SSL. Javascript maybe the problem also.
I doubt that cookies are used intentionally to stop WWW::Mechanize, but
I would guess that javascript might be used to do this.
wana
------------------------------
Date: Sun, 10 Apr 2005 09:53:06 -0400
From: Bla <hx_101@hotmail.com>
Subject: UNIX Script To Remove Hosts from Hosts file
Message-Id: <qtbi51h35d3ccvfdeu59dedkcnguqp6t9r@4ax.com>
Hello,
Does anyone have a script that would remove the appropriate line from
the hosts file on a UNIX box. This might be a tricky one?
Let's say we have a list of hosts and associated ip's we wanted
removed from the hosts file on a UNIX box....
MAybe sed would do it? Would like a few suggestions.
Thanks
------------------------------
Date: Sun, 10 Apr 2005 11:14:59 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: UNIX Script To Remove Hosts from Hosts file
Message-Id: <slrnd5ik83.m22.tadmc@magna.augustmail.com>
Bla <hx_101@hotmail.com> wrote:
> Does anyone have a script that would remove the appropriate line from
> the hosts file on a UNIX box.
> MAybe sed would do it?
Then you are in the wrong newsgroup. This is the Perl newsgroup.
> Would like a few suggestions.
1) Check the Perl FAQ before posting to the Perl newsgroup.
perldoc -q file
How do I change one line in a file/delete a line in a file/insert a
line in the middle of a file/append to the beginning of a file?
(note that this is the very same FAQ that I pointed out to you in July 2000,
(assuming that you are that Mr. Horse Nuts), are you just now getting around
to addressing that old task?
)
2) Show us the code you've written so far and we will help you fix it.
Have you seen the Posting Guidelines that are posted here frequently?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sun, 10 Apr 2005 10:37:40 -0400
From: "jim simpson" <jimsimpson@cox.net>
Subject: Re: Working in a secure site
Message-Id: <PSa6e.785$5J3.474@lakeread01>
Thanks Sherm for your help.
After accessing the site I will have several POST's to run to download my
data.
Jim
"Sherm Pendley" <spamtrap@dot-app.org> wrote in message
news:WPidnRhfQqMpssXfRVn-pg@adelphia.com...
> jim simpson wrote:
> > I want to write Perl script that will allow me to get my data from a
secure
> > site after I have manually entered the site using the proper user name
and
> > password. I think this means that I must first get from the browser, the
> > code and cookie that have been returned by the server.
>
> No, it means you want to write a user agent (aka browser) in Perl. It's
> easier than you might think, because the "heavy lifting" has already
> been done for you. Have a look at these CPAN modules:
>
> LWP
> WWW::Mechanize
>
> sherm--
>
> --
> Cocoa programming in Perl: http://camelbones.sourceforge.net
> Hire me! My resume: http://www.dot-app.org
------------------------------
Date: Sun, 10 Apr 2005 19:18:46 +0200
From: noone <noone@nowhere.com>
Subject: WWW::Mechanize problem when logging in Rakuten
Message-Id: <pan.2005.04.10.17.17.46.19091@nowhere.com>
I have a problem with the simple script which follows:
#!/usr/bin/perl
use strict;
use warnings;
use WWW::Mechanize;
my $mech = WWW::Mechanize->new(autocheck => 1);
$mech->agent_alias( 'Windows IE 6' );
$mech->get('http://my.plaza.rakuten.co.jp');
$mech->field('u', 'mylogin');
$mech->field('p', 'mypassword');
$mech->submit();
Here I get the webpage telling me I am logged. It's OK!
my $url = 'http://plaza.rakuten.co.jp/hennamono/';
$mech->get ($url);
Here it happens I am not logged! It is not the behaviour I get from a
"traditional" browser.
Any clue?
David.
------------------------------
Date: Sun, 10 Apr 2005 17:45:04 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: WWW::Mechanize problem when logging in Rakuten
Message-Id: <Xns96348BD1C5C12asu1cornelledu@127.0.0.1>
noone <noone@nowhere.com> wrote in
news:pan.2005.04.10.17.17.46.19091@nowhere.com:
> #!/usr/bin/perl
>
> use strict;
> use warnings;
...
> my $url = 'http://plaza.rakuten.co.jp/hennamono/';
> $mech->get ($url);
>
> Here it happens I am not logged! It is not the behaviour I get from
> a "traditional" browser.
>
> Any clue?
I don't think there is a Perl question here.
The action element of the login form specifies a session id and also has
some hidden fields:
<form name="LoginForm" method="post"
action="./login;jsessionid=CZjB9LGXrdYGfHX0Ko4SObuvTrMVzl8JzHo1zX2eCOZ5K
1
H46YMH!388032509!d12h222s01.ap.rakuten.co.jp!7103!-1"
autocomplete="off"> <input type="hidden" name="service_id"
value="59"><input type="hidden" name="return_url" value="index.phtml?">
You presumably need to incorporate the appropriate session id in your
subsequent requests.
This task, however, has nothing to do with Perl.
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: Sun, 10 Apr 2005 20:11:08 +0200
From: noone <noone@nowhere.com>
Subject: Re: WWW::Mechanize problem when logging in Rakuten
Message-Id: <pan.2005.04.10.18.11.07.469796@nowhere.com>
On Sun, 10 Apr 2005 17:45:04 +0000, A. Sinan Unur wrote:
> You presumably need to incorporate the appropriate session id in your
> subsequent requests.
How can I do that?
When I use my usual browser (Mozilla), I do not need to incorporate the
appropriate session id in my subsequent requests. If it is done
automatically by the browser, then WWW::Mechanize should do the same
because it is supposed to be a virtual browser.
Thanks,
David.
------------------------------
Date: Sun, 10 Apr 2005 18:49:28 GMT
From: "A. Sinan Unur" <1usa@llenroc.ude.invalid>
Subject: Re: WWW::Mechanize problem when logging in Rakuten
Message-Id: <Xns963496BB98E36asu1cornelledu@127.0.0.1>
noone <noone@nowhere.com> wrote in news:pan.2005.04.10.18.11.07.469796
@nowhere.com:
> On Sun, 10 Apr 2005 17:45:04 +0000, A. Sinan Unur wrote:
>
>> You presumably need to incorporate the appropriate session id in your
>> subsequent requests.
>
> How can I do that?
I am not sure as I do not have the ability to log on to that site. You
are the only one who can browse the site and see what gets passed around
as you navigate the site.
> When I use my usual browser (Mozilla), I do not need to incorporate
> the appropriate session id in my subsequent requests.
I find it hard to believe that the session id does not get passed around
once you log in.
> automatically by the browser, then WWW::Mechanize should do the same
> because it is supposed to be a virtual browser.
I am not sure what it does and what it does not, especially in the
context of the specific web site you are trying to access.
You might want to install the web scraping proxy to figure out exactly
what needs to be replicated.
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: Sun, 10 Apr 2005 14:30:02 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: WWW::Mechanize problem when logging in Rakuten
Message-Id: <slrnd5ivlq.mm7.tadmc@magna.augustmail.com>
noone <noone@nowhere.com> wrote:
> On Sun, 10 Apr 2005 17:45:04 +0000, A. Sinan Unur wrote:
>
>> You presumably need to incorporate the appropriate session id in your
>> subsequent requests.
>
> How can I do that?
Ask a proxy to write the code you need for you:
Web Scraping Proxy
http://www.research.att.com/~hpk/wsp/
> When I use my usual browser (Mozilla), I do not need to incorporate the
> appropriate session id in my subsequent requests. If it is done
> automatically by the browser, then WWW::Mechanize should do the same
> because it is supposed to be a virtual browser.
When you load a URL that incorporates dozens of other links, the
browser fetches all dozens-plus-one URLs.
WWW::Mechanize should do the same because it is supposed to be
a virtual browser?
I don't want 50 fetches for one request. If I want 50 fetches
I'll make 50 requests. I like control.
--
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 7960
***************************************