[28527] in Perl-Users-Digest
Perl-Users Digest, Issue: 9891 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 26 00:05:51 2006
Date: Wed, 25 Oct 2006 21: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, 25 Oct 2006 Volume: 10 Number: 9891
Today's topics:
Re: Automatic login to a web page <tadmc@augustmail.com>
Re: binmode and <> <rvtol+news@isolution.nl>
Re: binmode and <> <DJStunks@gmail.com>
Re: binmode and <> <jl_post@hotmail.com>
Re: binmode and <> <rvtol+news@isolution.nl>
Re: binmode and <> <someone@example.com>
Re: binmode and <> <someone@example.com>
Re: can someone unban me from freenode irc? #perl ? <sisyphus1@nomail.afraid.org>
Re: can someone unban me from freenode irc? #perl ? <bootiack@yahoo.com>
Perl Developer Position - AT&T,Chicago or Raleigh, 22 m <tripuranenis@gmail.com>
Re: Perl Developer Position - AT&T,Chicago or Raleigh, <sigzero@gmail.com>
Re: Setting permissions on remote directory using Net:: <joe@inwap.com>
Re: stop encoding of href in anchor meyerto@gmail.com
Re: stop encoding of href in anchor (Randal L. Schwartz)
Re: stop encoding of href in anchor xhoster@gmail.com
Re: stop encoding of href in anchor meyerto@gmail.com
Re: stop encoding of href in anchor meyerto@gmail.com
Re: stop encoding of href in anchor <noreply@gunnar.cc>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 25 Oct 2006 17:20:26 -0500
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Automatic login to a web page
Message-Id: <slrnejvopa.dvv.tadmc@tadmc30.august.net>
Jagjeet_Singh <jagjeet.malhi@gmail.com> wrote:
> my $url = 'http://210.7.90.193/indexmain.php'
^^
> my $mech = WWW::Mechanize->new(autocheck => 1);
[snip]
> syntax error at a.pl line 15, near "my "
> Global symbol "$mech" requires explicit package name at a.pl line 15.
The semicolon character serves as a statement separator in Perl.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 26 Oct 2006 01:13:55 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: binmode and <>
Message-Id: <ehp290.1mo.1@news.isolution.nl>
Larry schreef:
> [perl -n, binmode]
> I know the handle is ARGV, but knowing the name won't help. The
> handle won't be open before the "while" loop so I can't "bindmode" it
> then. Inside the "while" loop, it will already be too late to call
> "binmode", since the line has already been read.
You might not need binmode().
C:\> perl -e "binmode STDOUT; print qq{AB\nCDE\nEFGH\r\n}" > bm.in
C:> debug bm.in
-d
14BB:0100 41 42 0A 43 44 45 0A 45-46 47 48 0D 0A xx xx xx
AB.CDE.EFGH..xxx
-q
C:\> perl -ne "print qq{<$_>}" bm.in
<AB
><CDE
><EFGH
>
C:\> perl -ne "BEGIN{binmode STDOUT; $/=qq{\r\n}} print qq{<$_>}" bm.in
<AB
CDE
EFGH
>
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: 25 Oct 2006 16:20:38 -0700
From: "DJ Stunks" <DJStunks@gmail.com>
Subject: Re: binmode and <>
Message-Id: <1161818438.913209.38730@e3g2000cwe.googlegroups.com>
Larry wrote:
> Dr.Ruud wrote:
> > Larry schreef:
> > > Larry:
> >
> > >> Is there any way to get "while (<>)" to use binmode? I can't figure
> > >> it out since binmode is supposed to be called after the file is
> > >> already open but before it is read for the first time, so you can't
> > >> call it before the loop, nor can you call it inside the loop.
> > >>
> > >> I would also like to use binmode for 1-liners using -n or -p
> > >> switches.
> > >
> > > P.S. ... in case anyone is wondering why I would want to use <>
> > > together with binmode (they usually don't go together) is that I have
> > > a .csv file generated by Excel. Each record is terminated by "\r\n",
> > > however inside each record there are some "\n" characters,
> > > representing multi-line cells in the spreadsheet. So I want to set
> > > $/ = "\r\n" and turn on binmode.
> >
> > Try
> >
> > perl -MO=Deparse -ne1
> >
> > and you'll find the name of the handle.
> >
>
> I know the handle is ARGV, but knowing the name won't help. The handle
> won't be open before the "while" loop so I can't "bindmode" it then.
> Inside the "while" loop, it will already be too late to call "binmode",
> since the line has already been read.
I think he meant you could binmode ARGV in a BEGIN block (untested) but
John's suggestion was, as usual, The Right Answer :P
-jp
------------------------------
Date: 25 Oct 2006 16:57:53 -0700
From: "jl_post@hotmail.com" <jl_post@hotmail.com>
Subject: Re: binmode and <>
Message-Id: <1161820672.992382.94340@f16g2000cwb.googlegroups.com>
DJ Stunks wrote:
>
> I think he meant you could binmode ARGV in a BEGIN block (untested) but
> John's suggestion was, as usual, The Right Answer :P
I don't think you can binmode ARGV in a BEGIN block, because ARGV
isn't attached to any file before the first call of <>.
A quick test is this (on Win32 platforms):
If 'blah.txt' is a file that only contains one line (which is blank and
ends in a newline), we can verify that it contains two bytes with a
"DIR blah.txt" command.
Running the following perl one-liner:
perl -ne "BEGIN{binmode(ARGV)} print length" blah.txt
prints "1", meaning that it didn't properly read the two bytes as two
separate characters, since the binmode(ARGV) didn't "take."
But running the follong perl one-liner:
perl -Mopen=IO,:raw -ne "print length" blah.txt
prints "2", signifying that the ARGV filehandle is in binmode().
Incidentally, John's solution (which leaves off the "IO," part)
doesn't seem to work for me (I'm not sure why). When I type:
perl -Mopen=:raw -ne "print length" blah.txt
I get the following error:
Unknown PerlIO layer class ':raw' at -e line 0
BEGIN failed--compilation aborted.
(In case you're interested, I'm using Binary build 816 [255195]
provided by ActiveState -- Built Mar 1 2006 18:00:52.)
------------------------------
Date: Thu, 26 Oct 2006 02:36:16 +0200
From: "Dr.Ruud" <rvtol+news@isolution.nl>
Subject: Re: binmode and <>
Message-Id: <ehp7aa.1r4.1@news.isolution.nl>
jl_post@hotmail.com schreef:
> Running the following perl one-liner:
>
> perl -ne "BEGIN{binmode(ARGV)} print length" blah.txt
>
> prints "1", meaning that it didn't properly read the two bytes as two
> separate characters, since the binmode(ARGV) didn't "take."
With "warnings" activated:
$ perl -wne "BEGIN{binmode ARGV} 1" < /dev/null
binmode() on unopened filehandle ARGV at -e line 1.
--
Affijn, Ruud
"Gewoon is een tijger."
------------------------------
Date: Thu, 26 Oct 2006 01:34:23 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: binmode and <>
Message-Id: <zgU%g.71965$E67.64564@clgrps13>
jl_post@hotmail.com wrote:
>
> But running the follong perl one-liner:
>
> perl -Mopen=IO,:raw -ne "print length" blah.txt
>
> prints "2", signifying that the ARGV filehandle is in binmode().
>
> Incidentally, John's solution (which leaves off the "IO," part)
> doesn't seem to work for me (I'm not sure why). When I type:
>
> perl -Mopen=:raw -ne "print length" blah.txt
>
> I get the following error:
>
> Unknown PerlIO layer class ':raw' at -e line 0
> BEGIN failed--compilation aborted.
The documentation states:
perldoc open
[ snip ]
These are equivalent
use open ’:utf8’;
use open IO => ’:utf8’;
as are these
use open ’:locale’;
use open IO => ’:locale’;
and these
use open ’:encoding(iso-8859-7)’;
use open IO => ’:encoding(iso-8859-7)’;
So the only thing I could think of was that this may have changed in a more
recent version.
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
------------------------------
Date: Thu, 26 Oct 2006 01:50:36 GMT
From: "John W. Krahn" <someone@example.com>
Subject: Re: binmode and <>
Message-Id: <MvU%g.37007$P7.23111@edtnps89>
John W. Krahn wrote:
> jl_post@hotmail.com wrote:
>>But running the follong perl one-liner:
>>
>> perl -Mopen=IO,:raw -ne "print length" blah.txt
>>
>>prints "2", signifying that the ARGV filehandle is in binmode().
>>
>> Incidentally, John's solution (which leaves off the "IO," part)
>>doesn't seem to work for me (I'm not sure why). When I type:
>>
>> perl -Mopen=:raw -ne "print length" blah.txt
>>
>>I get the following error:
>>
>>Unknown PerlIO layer class ':raw' at -e line 0
>>BEGIN failed--compilation aborted.
>
> The documentation states:
>
> perldoc open
> [ snip ]
> These are equivalent
>
> use open ’:utf8’;
> use open IO => ’:utf8’;
>
> as are these
>
> use open ’:locale’;
> use open IO => ’:locale’;
>
> and these
>
> use open ’:encoding(iso-8859-7)’;
> use open IO => ’:encoding(iso-8859-7)’;
>
>
> So the only thing I could think of was that this may have changed in a more
> recent version.
It looks like it only recognises the 'utf8' layer:
$ perl -Mopen -le'print $open::VERSION'
open: needs explicit list of PerlIO layers at -e line 0
BEGIN failed--compilation aborted.
$ perl -Mopen=:raw -le'print $open::VERSION'
Unknown PerlIO layer class ':raw' at -e line 0
BEGIN failed--compilation aborted.
$ perl -Mopen=:bytes -le'print $open::VERSION'
Unknown PerlIO layer class ':bytes' at -e line 0
BEGIN failed--compilation aborted.
$ perl -Mopen=:utf8 -le'print $open::VERSION'
1.04
$ perl -Mopen=IO -le'print $open::VERSION'
1.04
$ perl -Mopen=IO,:raw -le'print $open::VERSION'
1.04
John
--
Perl isn't a toolbox, but a small machine shop where you can special-order
certain sorts of tools at low cost and in short order. -- Larry Wall
------------------------------
Date: Thu, 26 Oct 2006 10:40:08 +1000
From: "Sisyphus" <sisyphus1@nomail.afraid.org>
Subject: Re: can someone unban me from freenode irc? #perl ?
Message-Id: <4540050b$0$2917$afc38c87@news.optusnet.com.au>
"John Bokma" <john@castleamber.com> wrote in message
news:Xns9867ABDE871D4castleamber@130.133.1.4...
> "gavino" <bootiack@yahoo.com> wrote:
>
> > ok this sucks lol
> > damn it jim!
> > ok
> > 15 naked virgins for whoever lets me back in
>
> This is a Perl group, payments should be made in camels only (either with
> one or two humps).
>
Humping camels is illegal .... in this country, anyway ;-)
Cheers,
Rob
------------------------------
Date: 25 Oct 2006 19:02:28 -0700
From: "gavino" <bootiack@yahoo.com>
Subject: Re: can someone unban me from freenode irc? #perl ?
Message-Id: <1161828148.128836.143250@m73g2000cwd.googlegroups.com>
I think perl is nicer than ja-vaaa!
------------------------------
Date: 25 Oct 2006 18:26:29 -0700
From: "Siva" <tripuranenis@gmail.com>
Subject: Perl Developer Position - AT&T,Chicago or Raleigh, 22 months contract
Message-Id: <1161825989.591431.214880@i42g2000cwa.googlegroups.com>
I currently have 22 month contract position with AT&T in Raleigh.
Please let me know if you would be interested. If you are, send me a
copy of your resume or contact me at 630-364-4117, Siva@TalentedIT.com
Development position supporting internal and external at&t customers.
Candidate will work in the Chicago or Raleigh area supporting
development efforts. The candidate needs to be self motivated with the
ability to meet deadlines and adapt to rapid change
Skill Experience Need
1) Perl Expert Required
2) Perl-CGI Expert Required
3) Python Expert Required
4) Apache troubleshooting Expert Required
HTML
Strong SQL experience
Database Development experience (Oracle a plus)
PHP
Java
_Java Script
--
Siva
Talented IT, Inc
630-364-4117
Siva@TalentedIT.com
------------------------------
Date: 25 Oct 2006 19:05:40 -0700
From: "Robert Hicks" <sigzero@gmail.com>
Subject: Re: Perl Developer Position - AT&T,Chicago or Raleigh, 22 months contract
Message-Id: <1161828340.249618.213600@m7g2000cwm.googlegroups.com>
Siva wrote:
> I currently have 22 month contract position with AT&T in Raleigh.
> Please let me know if you would be interested. If you are, send me a
> copy of your resume or contact me at 630-364-4117, Siva@TalentedIT.com
>
> Development position supporting internal and external at&t customers.
> Candidate will work in the Chicago or Raleigh area supporting
> development efforts. The candidate needs to be self motivated with the
> ability to meet deadlines and adapt to rapid change
>
> Skill Experience Need
> 1) Perl Expert Required
> 2) Perl-CGI Expert Required
> 3) Python Expert Required
> 4) Apache troubleshooting Expert Required
>
> HTML
> Strong SQL experience
> Database Development experience (Oracle a plus)
> PHP
> Java
> _Java Script
>
> --
> Siva
> Talented IT, Inc
> 630-364-4117
> Siva@TalentedIT.com
http://jobs.perl.org
------------------------------
Date: Wed, 25 Oct 2006 15:36:16 -0700
From: Joe Smith <joe@inwap.com>
Subject: Re: Setting permissions on remote directory using Net::SFTP
Message-Id: <paCdnUo4Jem5eqLYnZ2dnUVZ_sednZ2d@comcast.com>
timothy.hill@gmail.com wrote:
> $attrs->perm(16895);
>
> The 16895 value you see is the mode value I have obtained from doing a
> stat on a directory that has the required permissions,
stat() returns the 12 bits of permissions and 4 bits of other stuff.
You should mask off that other stuff when working with permissions.
$perm = (stat _)[2] & 0777;
> but running this code only produces drwxr-xr-x premissions.
> This is driving me potty...
That's normal behavior. For
mkdir $remote_dir,0777;
the actual permissions will be (0777 && ! umask()); with the
typical umask of 0022, the result is 0755.
Have you tried $sftp->do_setstats($remote_dir, $attrs) after
the directory has been created?
-Joe
------------------------------
Date: 25 Oct 2006 15:12:11 -0700
From: meyerto@gmail.com
Subject: Re: stop encoding of href in anchor
Message-Id: <1161814331.008992.25440@i3g2000cwc.googlegroups.com>
>
> Why would you want to?
>
The sample I provided is simplified demostration of the problem. Here
is a more realistic example where you don't want the encoding to
happen:
a({href=>"record?uid=4&gid=6"}, "View record")
yields:
<a href="record?uid=4&gid=6">View record</a>
but I want:
<a href="record?uid=4&gid=6">View record</a>
------------------------------
Date: 25 Oct 2006 15:42:03 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
To: meyerto@gmail.com
Subject: Re: stop encoding of href in anchor
Message-Id: <86d58gxbk4.fsf@blue.stonehenge.com>
>>>>> "meyerto" == meyerto <meyerto@gmail.com> writes:
>>
>> Why would you want to?
>>
meyerto> The sample I provided is simplified demostration of the problem. Here
meyerto> is a more realistic example where you don't want the encoding to
meyerto> happen:
meyerto> a({href=>"record?uid=4&gid=6"}, "View record")
meyerto> yields:
meyerto> <a href="record?uid=4&gid=6">View record</a>
meyerto> but I want:
meyerto> <a href="record?uid=4&gid=6">View record</a>
You want something that isn't legal HTML and is broken? Why?
It's doing the right thing for you. Even if you don't want it. :)
print "Just another Perl hacker,"; # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
--
Posted via a free Usenet account from http://www.teranews.com
------------------------------
Date: 25 Oct 2006 22:43:33 GMT
From: xhoster@gmail.com
Subject: Re: stop encoding of href in anchor
Message-Id: <20061025184412.276$k2@newsreader.com>
meyerto@gmail.com wrote:
> This:
>
> use CGI qw(:standard);
> print a({href=>'cats&dogs'},pets);
>
> produces:
>
> <a href="cats&dogs">pets</a>
That's funny, it shouldn't. The docs say that only form-generating
functions autoEscape, and I wouldn't think that a() is a form-generating
function.
> How can I stop the & from being encoded to & ?
autoEscape(0) turns it off (as well as any other autoEscaping)
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: 25 Oct 2006 17:49:49 -0700
From: meyerto@gmail.com
Subject: Re: stop encoding of href in anchor
Message-Id: <1161823789.743794.102550@k70g2000cwa.googlegroups.com>
> autoEscape(0) turns it off (as well as any other autoEscaping)
>
> Xho
Ah, autoEscape(), thanks Xho.
Just for the record though, this function doesn't appear to work in
older perl versions (or maybe older CGI modules). See:
[tmeyer@aztec tmeyer]$ perl #perl v5.8.0
use CGI ':standard';
autoEscape(0);
print a({href=>'dogs&cats'},yowza)."\n";
<a href="dogs&cats">yowza</a>
Yet, with a newer perl on a different machine (and proabably different
CGI):
tmeyer@olof:~$ perl #perl v5.8.7
use CGI ':standard';
autoEscape(0);
print a({href=>'dogs&cats'},yowza)."\n";
<a href="dogs&cats">yowza</a>
Bah! Time to manually create anchor tags myself.
------------------------------
Date: 25 Oct 2006 17:53:36 -0700
From: meyerto@gmail.com
Subject: Re: stop encoding of href in anchor
Message-Id: <1161824016.123216.258920@m73g2000cwd.googlegroups.com>
Randal L. Schwartz wrote:
> >>>>> "meyerto" == meyerto <meyerto@gmail.com> writes:
>
> >>
> >> Why would you want to?
> >>
>
> meyerto> The sample I provided is simplified demostration of the problem. Here
> meyerto> is a more realistic example where you don't want the encoding to
> meyerto> happen:
>
> meyerto> a({href=>"record?uid=4&gid=6"}, "View record")
> meyerto> yields:
> meyerto> <a href="record?uid=4&gid=6">View record</a>
> meyerto> but I want:
> meyerto> <a href="record?uid=4&gid=6">View record</a>
>
> You want something that isn't legal HTML and is broken? Why?
>
> It's doing the right thing for you. Even if you don't want it. :)
>
> print "Just another Perl hacker,"; # the original
>
> --
> Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
> <merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
> Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
> See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
>
> --
> Posted via a free Usenet account from http://www.teranews.com
LOL. You are further proof that you have to have a good sense of humor
to be a Perl hacker. :)
------------------------------
Date: Thu, 26 Oct 2006 03:26:45 +0200
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: stop encoding of href in anchor
Message-Id: <4qah2sFlh779U1@individual.net>
meyerto@gmail.com wrote:
> Randal L. Schwartz wrote:
>
>>>>>>>"meyerto" == meyerto <meyerto@gmail.com> writes:
>>meyerto> Here
>>meyerto> is a more realistic example where you don't want the encoding to
>>meyerto> happen:
>>
>>meyerto> a({href=>"record?uid=4&gid=6"}, "View record")
>>meyerto> yields:
>>meyerto> <a href="record?uid=4&gid=6">View record</a>
>>meyerto> but I want:
>>meyerto> <a href="record?uid=4&gid=6">View record</a>
>>
>>You want something that isn't legal HTML and is broken? Why?
>>
>>It's doing the right thing for you. Even if you don't want it. :)
>
> LOL. You are further proof that you have to have a good sense of humor
> to be a Perl hacker. :)
Yes, it's pretty humorous that you still don't seem to understand what
people have been trying to explain to you.
Did you possibly try the 'unwanted' encoding in your browser?
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
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 9891
***************************************