[23957] in Perl-Users-Digest
Perl-Users Digest, Issue: 6158 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Feb 18 18:15:59 2004
Date: Wed, 18 Feb 2004 15:15:21 -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 Wed, 18 Feb 2004 Volume: 10 Number: 6158
Today's topics:
Re: understanding perl "get ($url) " function (KK)
Re: understanding perl "get ($url) " function <uri@stemsystems.com>
Re: understanding perl "get ($url) " function <glex_nospam@qwest.invalid>
Re: understanding perl "get ($url) " function <usenet@c0s.org>
Re: UNIX Find on Windows <tc@no.public.email>
Re: Using fork() with a telnet-esque socket connection <usenet@morrow.me.uk>
Re: Using fork() with a telnet-esque socket connection <uri@stemsystems.com>
Re: Using fork() with a telnet-esque socket connection <exide@comcast.net>
Want password hack for Matt's old calendar script (Butch)
Re: Want password hack for Matt's old calendar script <tc@no.public.email>
Re: Want password hack for Matt's old calendar script <uri@stemsystems.com>
Re: Want password hack for Matt's old calendar script <tc@no.public.email>
Re: Want password hack for Matt's old calendar script <uri@stemsystems.com>
Re: Want password hack for Matt's old calendar script <tc@no.public.email>
Re: Why is Perl losing ground? <spamtrap@dot-app.org>
Re: Why is Perl losing ground? <uri@stemsystems.com>
Re: Why is Perl losing ground? <dwall@fastmail.fm>
Re: Why is Perl losing ground? <spamtrap@dot-app.org>
Re: Why is Perl losing ground? <uri@stemsystems.com>
XML::DOM Encoding UTF-8 and ISO-8859-1 (Addy)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 18 Feb 2004 12:55:45 -0800
From: kewlkarun@yahoo.com (KK)
Subject: Re: understanding perl "get ($url) " function
Message-Id: <c8fd5039.0402181255.5d31d9e5@posting.google.com>
Thank you one & all, for the ideas. In my previous missive, as I
mentioned, the problem I'm facing is the 'login concurrency'. I could
conclude that the site is keeping track of my navigation through
cookies. One of the replies, suggested to save/resend the cookie
through get($url) function. Apparently CPAN/other documentation of
get($url) I've referred, does not contain any such feature. Now my
question boils down to implentation of save/resend of cookies with
modules get($url) & getstore($url,$filename) (my program uses both).
I'm a newbie to perl programming and would like to request for a
little detailed explaination. Thank you fellow-perls.
> actually, this depends on exactly how the site is tracking sessions.
> 2 things come to mind: referer and cookies (most likely)
> you should figure if the site is using one of these, and alter your
> program accordingly
>
> when you have a perl question come back to this group, but
> there are other groups more suited to HTTP discussions.
>
> gnari
------------------------------
Date: Wed, 18 Feb 2004 21:05:02 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: understanding perl "get ($url) " function
Message-Id: <x73c98t7y9.fsf@mail.sysarch.com>
>>>>> "K" == KK <kewlkarun@yahoo.com> writes:
K> Thank you one & all, for the ideas. In my previous missive, as I
K> mentioned, the problem I'm facing is the 'login concurrency'. I could
K> conclude that the site is keeping track of my navigation through
K> cookies. One of the replies, suggested to save/resend the cookie
K> through get($url) function. Apparently CPAN/other documentation of
K> get($url) I've referred, does not contain any such feature. Now my
K> question boils down to implentation of save/resend of cookies with
K> modules get($url) & getstore($url,$filename) (my program uses both).
K> I'm a newbie to perl programming and would like to request for a
K> little detailed explaination. Thank you fellow-perls.
it is in LWP::UserAgent. get and getstore are only in LWP::Simple and as
that name implies, it doesn't support fancier stuff like using cookies.
and if you want to make your life much easier, use WWW::Mechanize which
will do the cookies, fetching, and parsing all for you in one nice clean
api. it is designed to do what you are attempting.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 18 Feb 2004 15:18:15 -0600
From: "J. Gleixner" <glex_nospam@qwest.invalid>
Subject: Re: understanding perl "get ($url) " function
Message-Id: <rEQYb.92$TL5.74616@news.uswest.net>
KK wrote:
>>actually, this depends on exactly how the site is tracking sessions.
>>2 things come to mind: referer and cookies (most likely)
>>you should figure if the site is using one of these, and alter your
>>program accordingly
>>
>>when you have a perl question come back to this group, but
>>there are other groups more suited to HTTP discussions.
>>
>>gnari
>[...] Apparently CPAN/other documentation of
> get($url) I've referred, does not contain any such feature. Now my
> question boils down to implentation of save/resend of cookies with
> modules get($url) & getstore($url,$filename) (my program uses both).
> I'm a newbie to perl programming and would like to request for a
> little detailed explaination. Thank you fellow-perls.
You actually looked on CPAN for "cookies" and didn't find anything???
How odd.. :-)
Check the documentation for LWP and look for helpful examples in the LWP
cookbook:
perldoc lwpcook
look for "cookies". Could also check the documentation for
HTTP::Cookies and you'll see examples of using the cookie_jar method.
------------------------------
Date: 18 Feb 2004 14:40:53 -0800
From: gabe anzelini <usenet@c0s.org>
Subject: Re: understanding perl "get ($url) " function
Message-Id: <86fzd8ko3u.fsf@tyler.c0s.org>
what about www::mechanize? have you tried that?
------------------------------
Date: Wed, 18 Feb 2004 13:05:09 -0800
From: "Trent Curry" <tc@no.public.email>
Subject: Re: UNIX Find on Windows
Message-Id: <c10jum$lhi$1@news.astound.net>
I.E. wrote:
> On Tue, 10 Feb 2004 23:13:36 GMT, Brian
> <brian.getridofthis.bygland@boeingDELETEthis.com> wrote:
>
>> I'm fairly new to using Perl on Windows. I need to find all of the
>> files in a folder and its sub folders that match a pattern. On UNIX
>> I'd do:
>>
>> $FOUND = `find $DIRROOT -name "$PATTERN" -print`;
>>
>> Is there a way to do this on Windows using Perl and/or native Windows
>> commands?
>>
>> Brian
>
> Have you given Cygwin a try? www.cygwin.com
Find seems to work well in cygwin, but be aware some commands are
actually wrappers of the built-in Windows equivelent. Such as netstat.
This may be going a little off scope, I just mean it a warning to anyone
who mistakenly has the impression that everything in it is pure Unix.
There was a discussion on this a while ago in one of the Unix groups.
--
Trent Curry
perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1
)!eg;print(reverse("$s")."\n");'
------------------------------
Date: Wed, 18 Feb 2004 19:06:24 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: Using fork() with a telnet-esque socket connection
Message-Id: <c10d3g$a0u$7@wisteria.csv.warwick.ac.uk>
Uri Guttman <uri@stemsystems.com> wrote:
> >>>>> "BM" == Ben Morrow <usenet@morrow.me.uk> writes:
>
> BM> There are four ways to handle multiple simultaneous connections:
>
> BM> 1. Single-process. You have one process, which handles creating new
> BM> connections and all existing connections, using select(). This is
> BM> usually the most efficient solution for small numbers of connections,
> BM> but scales badly.
>
> where did you get the scales badly from?
Err... I was under the impression it was conventional wisdom. I've read
it in lots of places (CS textbooks). Thinking about it anew, though, you
are (of course) correct; even in the multi-processor case, the advantage
of forking can only be at best of the order of the number of processors.
> unfortunately we have a world of kiddies spoonfed that
> threads are the only solution to any multiplexing
...and Unix users (such as myself) spoonfed that 'fork is an easy way to
improve performance' :).
So, to the OP: try POE (probably what I should have said in the first
place).
Ben
--
don't get my sympathy hanging out the 15th floor. you've changed the locks 3
times, he still comes reeling though the door, and soon he'll get to you, teach
you how to get to purest hell. you do it to yourself and that's what really
hurts is you do it to yourself just you, you and noone else * ben@morrow.me.uk
------------------------------
Date: Wed, 18 Feb 2004 19:13:12 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Using fork() with a telnet-esque socket connection
Message-Id: <x77jykurp4.fsf@mail.sysarch.com>
>>>>> "BM" == Ben Morrow <usenet@morrow.me.uk> writes:
>> where did you get the scales badly from?
BM> Err... I was under the impression it was conventional wisdom. I've read
BM> it in lots of places (CS textbooks). Thinking about it anew, though, you
BM> are (of course) correct; even in the multi-processor case, the advantage
BM> of forking can only be at best of the order of the number of processors.
>> unfortunately we have a world of kiddies spoonfed that
>> threads are the only solution to any multiplexing
BM> ...and Unix users (such as myself) spoonfed that 'fork is an easy
BM> way to improve performance' :).
well, it was and still is a good way to work around blocking issues. in
old unix days it was the only way to do that. threads are more recent
and have taken over as the current spoonfed pablum.
BM> So, to the OP: try POE (probably what I should have said in the first
BM> place).
or stem which you should check out at stemsystems.com or on cpan.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 18 Feb 2004 12:30:41 -0800
From: Exide Arabellan <exide@comcast.net>
Subject: Re: Using fork() with a telnet-esque socket connection
Message-Id: <LamdnXziR67vVq7dRVn-sA@comcast.com>
Uri Guttman wrote:
> BM> So, to the OP: try POE (probably what I should have said in the first
> BM> place).
>
> or stem which you should check out at stemsystems.com or on cpan.
>
> uri
Did some preliminary research on Stem, and it looks like somethin i may
use. If nothing else im going to play around with it and get familiar. I
see it solving alot of 'reinventing the wheel' scenarios as advertised.
Thanks to the both of you for this enlightening discussion :)
------------------------------
Date: 18 Feb 2004 12:16:20 -0800
From: webmaster@2clones.com (Butch)
Subject: Want password hack for Matt's old calendar script
Message-Id: <1921f571.0402181216.5f436731@posting.google.com>
I am using Matt Kruse's old calendar script [no version number in the
comments] and want to have multiple user/password capability to allow
more than one person to administer it without sharing the
username/passwords. Has any one already written this hack and would
be willing to share it?
Thanks,
Butch
------------------------------
Date: Wed, 18 Feb 2004 12:40:21 -0800
From: "Trent Curry" <tc@no.public.email>
Subject: Re: Want password hack for Matt's old calendar script
Message-Id: <c10ig6$l1i$1@news.astound.net>
Butch wrote:
> I am using Matt Kruse's old calendar script [no version number in the
> comments] and want to have multiple user/password capability to allow
> more than one person to administer it without sharing the
> username/passwords. Has any one already written this hack and would
> be willing to share it?
>
> Thanks,
> Butch
Well for starters using any of Matt's scripts as been long deemed flawed
in anything reguarding security. If you want to modify the script, I'd
suggest usign a data base and doing lookups. Mysql works well, as a
quick and free solution.
Some moduels to handle Mysql lookups:
Mysql.pm
perl -MCPAN -e 'install Mysql'
http://search.cpan.org/author/RUDY/DBD-mysql-2.9003/lib/Mysql.pm
DBD::mysql.pm
perl -MCPAN -e 'install DBD::mysql'
http://search.cpan.org/~rudy/DBD-mysql-2.9003/lib/DBD/mysql.pm
Just create your tables, then right a query to see if the user exists
and if the password (I'd recommends a crypt'ed or a md5-hex'ed password)
matches.
MD5.pm
perl -MCPAN -e 'install MD5'
http://search.cpan.org/~gaas/MD5-2.03/MD5.pm
--
Trent Curry
perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1
)!eg;print(reverse("$s")."\n");'
------------------------------
Date: Wed, 18 Feb 2004 20:45:16 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Want password hack for Matt's old calendar script
Message-Id: <x7brnwt8v7.fsf@mail.sysarch.com>
>>>>> "T" == Trent Curry <tc@no.public.email> writes:
T> Butch wrote:
>> I am using Matt Kruse's old calendar script [no version number in the
>> comments] and want to have multiple user/password capability to allow
>> more than one person to administer it without sharing the
>> username/passwords. Has any one already written this hack and would
>> be willing to share it?
T> Well for starters using any of Matt's scripts as been long deemed flawed
T> in anything reguarding security. If you want to modify the script, I'd
T> suggest usign a data base and doing lookups. Mysql works well, as a
T> quick and free solution.
different matt. this is kruse and the bad kiddie scripter is write.
and to the OP, fix it on line 17.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 18 Feb 2004 12:50:47 -0800
From: "Trent Curry" <tc@no.public.email>
Subject: Re: Want password hack for Matt's old calendar script
Message-Id: <c10j3p$lb1$1@news.astound.net>
Uri Guttman wrote:
>>>>>> "T" == Trent Curry <tc@no.public.email> writes:
>
>> Butch wrote:
> >> I am using Matt Kruse's old calendar script [no version number
> in the >> comments] and want to have multiple user/password
> capability to allow >> more than one person to administer it
> without sharing the >> username/passwords. Has any one already
> written this hack and would >> be willing to share it?
>
>
>> Well for starters using any of Matt's scripts as been long deemed
>> flawed in anything reguarding security. If you want to modify the
>> script, I'd suggest usign a data base and doing lookups. Mysql works
>> well, as a quick and free solution.
>
> different matt. this is kruse and the bad kiddie scripter is write.
>
> and to the OP, fix it on line 17.
Thanks for clearing that up Uri.
--
Trent Curry
perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1
)!eg;print(reverse("$s")."\n");'
------------------------------
Date: Wed, 18 Feb 2004 20:54:10 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Want password hack for Matt's old calendar script
Message-Id: <x77jykt8ge.fsf@mail.sysarch.com>
>>>>> "T" == Trent Curry <tc@no.public.email> writes:
>> different matt. this is kruse and the bad kiddie scripter is write.
wright. should at least spell his name correctly when dissing him.
T> Thanks for clearing that up Uri.
not that the calendar script the OP is using is any better. i would
wager many quatloos that it is of the same crap quality of wright's
scripts. it sounds like it is free and unsupported and of use only to
kiddies who don't know perl.
if you want a decent perl based web calendar, then check out
webevent.com. there are others out there too.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 18 Feb 2004 12:59:29 -0800
From: "Trent Curry" <tc@no.public.email>
Subject: Re: Want password hack for Matt's old calendar script
Message-Id: <c10jk2$lcc$1@news.astound.net>
Uri Guttman wrote:
>>>>>> "T" == Trent Curry <tc@no.public.email> writes:
>
> >> different matt. this is kruse and the bad kiddie scripter is
> write.
>
> wright. should at least spell his name correctly when dissing him.
>
>> Thanks for clearing that up Uri.
>
> not that the calendar script the OP is using is any better. i would
> wager many quatloos that it is of the same crap quality of wright's
> scripts. it sounds like it is free and unsupported and of use only to
> kiddies who don't know perl.
Bawaa, how many script kiddies named Matt that freely destribute bad
scripts are there... jeepers.
> if you want a decent perl based web calendar, then check out
> webevent.com. there are others out there too.
I've seen that one in action, very nice. Good call.
--
Trent Curry
perl -e
'($s=qq/e29716770256864702379602c6275605/)=~s!([0-9a-f]{2})!pack("h2",$1
)!eg;print(reverse("$s")."\n");'
------------------------------
Date: Wed, 18 Feb 2004 16:13:05 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Why is Perl losing ground?
Message-Id: <Sp6dnVnct6P5SK7dRVn-uQ@adelphia.com>
G Klinedinst wrote:
> I meant the former, the number of variables is fine, it's just the
> naming conventions are cryptic. Some sort of mnemonic naming
> convention might help people learn.
If you 'use English;', most of the cryptic variables are given more friendly
aliases. For example:
$_ : $ARG
$? : $CHILD_ERROR
$! : $OS_ERROR
$@ : $EVAL_ERROR
$$ : $PROCESS_ID or $PID
$| : $OUTPUT_AUTOFLUSH
sherm--
------------------------------
Date: Wed, 18 Feb 2004 21:17:10 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Why is Perl losing ground?
Message-Id: <x7u11orstl.fsf@mail.sysarch.com>
>>>>> "SP" == Sherm Pendley <spamtrap@dot-app.org> writes:
SP> G Klinedinst wrote:
>> I meant the former, the number of variables is fine, it's just the
>> naming conventions are cryptic. Some sort of mnemonic naming
>> convention might help people learn.
SP> If you 'use English;', most of the cryptic variables are given
SP> more friendly aliases. For example:
friendly? i have never seen decent code written with english. learning
the common perl vars is easy. find a module on cpan which uses
english. there might be a couple but not many more.
SP> $_ : $ARG
SP> $? : $CHILD_ERROR
SP> $! : $OS_ERROR
SP> $@ : $EVAL_ERROR
SP> $$ : $PROCESS_ID or $PID
SP> $| : $OUTPUT_AUTOFLUSH
my eyes!!! i can't see!!!!
$i_will_switch_to_super_long_variable_names_too
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Wed, 18 Feb 2004 22:02:15 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Why is Perl losing ground?
Message-Id: <Xns9493AD50D74F2dkwwashere@216.168.3.30>
Sherm Pendley <spamtrap@dot-app.org> wrote:
> G Klinedinst wrote:
>
>> I meant the former, the number of variables is fine, it's just the
>> naming conventions are cryptic. Some sort of mnemonic naming
>> convention might help people learn.
>
> If you 'use English;', most of the cryptic variables are given more
> friendly aliases. For example:
They're already in mnemonic form. :-)
> $_ : $ARG
Fill in the blank. "Is this the right room for an argument?"
> $? : $CHILD_ERROR
Children are a mystery.
> $! : $OS_ERROR
What the hell was that?!
> $@ : $EVAL_ERROR
D00d, it's an 3v@l 3rr30r. S#%$*&!!
^
> $$ : $PROCESS_ID or $PID
That'll cost you.
> $| : $OUTPUT_AUTOFLUSH
Flush that crap down the pipe.
--
David Wall
------------------------------
Date: Wed, 18 Feb 2004 17:33:30 -0500
From: Sherm Pendley <spamtrap@dot-app.org>
Subject: Re: Why is Perl losing ground?
Message-Id: <6-2dneRxPZShda7d4p2dnA@adelphia.com>
Uri Guttman wrote:
> friendly?
It's subjective.
My post was aimed at countering the "$@ variables are too terse and cryptic"
argument by showing that more verbose alternatives are available. Someone
who makes such an argument might well consider the longer forms to be more
friendly.
sherm--
------------------------------
Date: Wed, 18 Feb 2004 22:38:09 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: Why is Perl losing ground?
Message-Id: <x7isi4rp2n.fsf@mail.sysarch.com>
>>>>> "SP" == Sherm Pendley <spamtrap@dot-app.org> writes:
SP> Uri Guttman wrote:
>> friendly?
SP> It's subjective.
no it isn't. no perl hacker with even a little experience uses
English. like i said, find it being used on cpan.
SP> My post was aimed at countering the "$@ variables are too terse
SP> and cryptic" argument by showing that more verbose alternatives
SP> are available. Someone who makes such an argument might well
SP> consider the longer forms to be more friendly.
that module is not a proper response to it. the answer is they the
variables are not cryptic as you can learn them as you need too. larry
actually picke nmemonic chars for them as well. and perldoc perlvar is a
click away.
rtfm is the proper response. and if they want handholding all the time
choose basic.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: 18 Feb 2004 11:54:52 -0800
From: aclaure@zethon.net (Addy)
Subject: XML::DOM Encoding UTF-8 and ISO-8859-1
Message-Id: <d2bc135c.0402181154.3b1e82b9@posting.google.com>
I'm a little confused as to why I'm getting these results. Consider
the XML file:
<?xml version="1.0" encoding="ISO-8859-1" ?>
<foo>
<string>Sécurité</string>
</foo>
Through a CGI script, I load up the file, grab the encoding and put in
the CGI header:
my ($parser) = new XML::DOM::Parser();
my ($doc) = $parser->parsefile('foo.xml');
my ($encoding) = $doc->getXMLDecl()->getEncoding();
print header(-charset => $encoding);
However, when I traverse through the XML and print out the above
"string" element, I see grabled text like "Sécurité"
If I change the CGI header encoding to UTF-8 like such:
print header(-charset => 'UTF8');
The text shows up properly. It would seem to me that the text would
show up properly by using the same encoding on the HTML page as is in
the XML file. This is the case when using other encodings, namely
'x-sjis-cp932'.
Could someome help me understand what I'm overlooking?
Thank you,
Addy
------------------------------
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 6158
***************************************