[23948] in Perl-Users-Digest
Perl-Users Digest, Issue: 6149 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 17 18:10:34 2004
Date: Tue, 17 Feb 2004 15:10:09 -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 Tue, 17 Feb 2004 Volume: 10 Number: 6149
Today's topics:
Re: Reading & Posting Usenet News Messages <spam-block-@-SEE-MY-SIG.com>
Re: Reading & Posting Usenet News Messages <ignoromnibus@cochon.fr>
Re: Reading & Posting Usenet News Messages <ignoromnibus@cochon.fr>
Re: Reading & Posting Usenet News Messages <tadmc@augustmail.com>
SOAP::Lite install problem <dnp@ams.org>
Re: SOAP::Lite install problem <No_4@dsl.pipex.com>
understanding perl "get ($url) " function (KK)
Re: understanding perl "get ($url) " function (Malcolm Dew-Jones)
Re: understanding perl "get ($url) " function <usenet@morrow.me.uk>
Re: Why is Perl losing ground? (G Klinedinst)
Re: Why is Perl losing ground? <tassilo.parseval@rwth-aachen.de>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 17 Feb 2004 19:09:30 +0000
From: James Taylor <spam-block-@-SEE-MY-SIG.com>
Subject: Re: Reading & Posting Usenet News Messages
Message-Id: <ant17193063dfNdQ@nospam.demon.co.uk>
In article <c0tks60267p@enews4.newsguy.com>,
Camelback Jones <ignoromnibus@cochon.fr> wrote:
>
> Yep, that's ol' # 18.4 from O'Reilly's Perl Cookbook.
>
> It seems to work okay, except that when trying to print the results
> of, for example,
>
> $bodytext = $server->body($first) or die "aaaargh!!!\n";
>
> all I can get is ARRAY(<some memory address>).
>
> I've tried printing $bodytext[0], it's blank.
Err... forgive me if this is wrong because I've never used
Net::NNTP but surely if $bodytext is an array reference then
you shouldn't access it as $bodytext[0], instead you should
access it as either $$bodytext[0] or $bodytext->[0].
--
James Taylor, Cheltenham, Gloucestershire, UK. PGP key: 3FBE1BF9
To protect against spam, the address in the "From:" header is not valid.
In any case, you should reply to the group so that everyone can benefit.
If you must send me a private email, use james at oakseed demon co uk.
------------------------------
Date: Tue, 17 Feb 2004 13:24:27 -0600
From: Camelback Jones <ignoromnibus@cochon.fr>
Subject: Re: Reading & Posting Usenet News Messages
Message-Id: <c0tpvs0aa4@enews1.newsguy.com>
James Taylor wrote:
> In article <c0tks60267p@enews4.newsguy.com>,
> Camelback Jones <ignoromnibus@cochon.fr> wrote:
>>
>> Yep, that's ol' # 18.4 from O'Reilly's Perl Cookbook.
>>
>> It seems to work okay, except that when trying to print the results
>> of, for example,
>>
>> $bodytext = $server->body($first) or die "aaaargh!!!\n";
>>
>> all I can get is ARRAY(<some memory address>).
>>
>> I've tried printing $bodytext[0], it's blank.
>
> Err... forgive me if this is wrong because I've never used
> Net::NNTP but surely if $bodytext is an array reference then
> you shouldn't access it as $bodytext[0], instead you should
> access it as either $$bodytext[0] or $bodytext->[0].
>
Tried those - no joy. See next response.
--
The greatest unsolved theorem in mathematics is why some people are
better at it than others.
------------------------------
Date: Tue, 17 Feb 2004 13:34:07 -0600
From: Camelback Jones <ignoromnibus@cochon.fr>
Subject: Re: Reading & Posting Usenet News Messages
Message-Id: <c0tqi202i9n@enews2.newsguy.com>
Paul Lalli wrote:
> On Tue, 17 Feb 2004, Camelback Jones wrote:
>
> $bodytext has nothing to do with $bodytext[0]. $bodytext, as assigned
> above, is an array reference. $bodytext[0] is the first element of an
> array named @bodytext. $bodytext and @bodytext have nothing to do with
> each other. If you want to print out the array referenced by $bodytext,
> you have a few choices:
>
> Dereference and copy the entire array:
> @body = @$bodytext;
> print "Body: @body\n";
>
> Dereference the array only:
> print "Body: @$bodytext\n";
>
> print just the element of the referenced array you want:
> print "Body line $i: $$bodytext[$i]\n";
> or
> print "Body line $i: $bodytext->[$i]\n";
>
Those work. Thank you.
> Please take a look at
> perldoc perlref
> for more information.
Actually, I did. I was looking for information on array references, and
apparently I wasn't creative enough to give them what they wanted. The
reference on Net::NNTP told me what the methods are returning, but I
couldn't find the dereferencing information.
Again, thank you.
--
The greatest unsolved theorem in mathematics is why some people are
better at it than others.
------------------------------
Date: Tue, 17 Feb 2004 16:12:09 -0600
From: Tad McClellan <tadmc@augustmail.com>
Subject: Re: Reading & Posting Usenet News Messages
Message-Id: <slrnc354dp.4m3.tadmc@magna.augustmail.com>
Camelback Jones <ignoromnibus@cochon.fr> wrote:
> $bodytext = $server->body($first) or die "aaaargh!!!\n";
>
> all I can get is ARRAY(<some memory address>).
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
That is the form for a stringified array reference.
You printed the reference itself, rather that dereferencing the reference.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Tue, 17 Feb 2004 14:44:14 -0500
From: Dan Pelton <dnp@ams.org>
Subject: SOAP::Lite install problem
Message-Id: <c0tqv0$r4k$1@sun06.ams.org>
I am trying to install SOAP::Lite on a Sun box.
I tried installing the module using the following command and got the
error "don't know what it is". I can get it directly from the authors
web site, but I was wondering what my problem is? The author states that
it has been testes under Perl 5.7.1. Does SOAP::Lite version 0.55 work
under Perl 5.8?
perl -MCPAN -e shell
cpan> install SOAP::Lite
Fetching with LWP:
ftp://ftp.perl.org/pub/CPAN/modules/03modlist.data.gz
Going to read /root/.cpan/sources/modules/03modlist.data.gz
Going to write /root/.cpan/Metadata
Warning: Cannot install SOAP::Lite, don't know what it is.
Thanks,
Dan
------------------------------
Date: Tue, 17 Feb 2004 20:01:26 +0000
From: Big and Blue <No_4@dsl.pipex.com>
Subject: Re: SOAP::Lite install problem
Message-Id: <403272db$0$7061$cc9e4d1f@news-text.dial.pipex.com>
Dan Pelton wrote:
> The author states that
> it has been testes under Perl 5.7.1. Does SOAP::Lite version 0.55 work
> under Perl 5.8?
Yes. I have it working for perl5.8.2. (And with only a slight change
with mod_perl1.99...).
--
-*- Just because I've written it here doesn't -*-
-*- mean that you should, or I do, believe it. -*-
------------------------------
Date: 17 Feb 2004 13:36:02 -0800
From: kewlkarun@yahoo.com (KK)
Subject: understanding perl "get ($url) " function
Message-Id: <c8fd5039.0402171336.2a6a617a@posting.google.com>
Hi there,
I need to access several pages of the website viz.,
'www.ieeexplore.ieee.org/Xplore/DynWel.jsp' (only accessable to
members). unfortunately, I cannot open multiple browsers (more than
10) of that website on my PC (a constraint set by the number of
licenses bought). However, one can navigate as many pages as you wish
in a single browser.
Coming to the problem, I have a perl program which browses through
several pages of the above mentioned website through use of get($url)
function. Doing so, after some executions of get($url) function, I run
into the problem of limited licenses (mentioned above). Does this
mean, every time I execute get($url) function, its equivalent to
opening the url in a new browser? If yes,
what is the possible alternative to get around this problem?
awaiting for possible help,
regards,
-KK
------------------------------
Date: 17 Feb 2004 14:33:08 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: understanding perl "get ($url) " function
Message-Id: <403296a4@news.victoria.tc.ca>
KK (kewlkarun@yahoo.com) wrote:
: Hi there,
: I need to access several pages of the website viz.,
: 'www.ieeexplore.ieee.org/Xplore/DynWel.jsp' (only accessable to
: members). unfortunately, I cannot open multiple browsers (more than
: 10) of that website on my PC (a constraint set by the number of
: licenses bought). However, one can navigate as many pages as you wish
: in a single browser.
: Coming to the problem, I have a perl program which browses through
: several pages of the above mentioned website through use of get($url)
: function. Doing so, after some executions of get($url) function, I run
: into the problem of limited licenses (mentioned above). Does this
: mean, every time I execute get($url) function, its equivalent to
: opening the url in a new browser? If yes,
: what is the possible alternative to get around this problem?
:
: awaiting for possible help,
: regards,
It's hard to say without seeing the http traffic between your pc and the
server.
One technique that a server _might_ be using would be to send a cookie to
the browser after the first request so that on later requests the server
knows which browser is contacting it.
_If_ this were the case, then your first get($url) request would have to
save any cookies that the server sends, and then send the same cookie(s)
back to the server with any later requests.
You would have to read the docs for the get($url) function you are using
to see how to add and receive cookies to/from each request.
$0.02
--
Web Work Wanted, Perl Projects Programmed, Database Development Done.
I'm looking for telecommute projects. (Paying that is, various
arrangements possible.)
------------------------------
Date: Tue, 17 Feb 2004 22:57:39 +0000 (UTC)
From: Ben Morrow <usenet@morrow.me.uk>
Subject: Re: understanding perl "get ($url) " function
Message-Id: <c0u693$o0t$1@wisteria.csv.warwick.ac.uk>
yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones) wrote:
> KK (kewlkarun@yahoo.com) wrote:
> : Hi there,
> : I need to access several pages of the website viz.,
> : 'www.ieeexplore.ieee.org/Xplore/DynWel.jsp' (only accessable to
> : members). unfortunately, I cannot open multiple browsers (more than
> : 10) of that website on my PC (a constraint set by the number of
> : licenses bought). However, one can navigate as many pages as you wish
> : in a single browser.
>
> : Coming to the problem, I have a perl program which browses through
> : several pages of the above mentioned website through use of get($url)
> : function. Doing so, after some executions of get($url) function, I run
> : into the problem of limited licenses (mentioned above). Does this
> : mean, every time I execute get($url) function, its equivalent to
> : opening the url in a new browser? If yes,
> : what is the possible alternative to get around this problem?
> :
> : awaiting for possible help,
> : regards,
>
>
> It's hard to say without seeing the http traffic between your pc and the
> server.
>
> One technique that a server _might_ be using would be to send a cookie to
> the browser after the first request so that on later requests the server
> knows which browser is contacting it.
One thing that has to be said at this point is that you must read the
T&C of your license. Are you allowed to get the pages automatically at
all?
Ben
--
The cosmos, at best, is like a rubbish heap scattered at random.
- Heraclitus
ben@morrow.me.uk
------------------------------
Date: 17 Feb 2004 13:52:09 -0800
From: g_klinedinst@hotmail.com (G Klinedinst)
Subject: Re: Why is Perl losing ground?
Message-Id: <168f035a.0402171352.28e57553@posting.google.com>
Ben Morrow <usenet@morrow.me.uk> wrote in message news:
> Exactly. There are far too many 'S&M' object languages, that are more
> interested in forcing you into writing perfect OO than in actually
> getting a job done. Perl's OO is the best I've come across: though
> what I am comparing it to is C++ and Java. The fact that in Java you
> have to have a class just to hold things like Math.sin just shouts
> 'bodge' to me: the world doesn't fit into your little box, so rather
> than let people out of the box you bend the edges until things almost
> fit.
Well, this war has been waging for years. You are on one side and I am
on the other. For OOP I believe it is in the interest of programmers
to shoehorn things into classes a little for the sake of uniformity
and simplicity. However you are far from alone being on the other side
of this.
> print !($_ % 5) || !($_ % 7) || $_;
>
> or
>
> print ( $_ % 5 == 0 or $_ % 7 == 0 or $_ );
>
> Or to solve something closer to the original problem:
>
> print $_ % 5 ?
> $_ % 7 ?
> $_ :
> "buzz" :
> "fizz";
>
> I find all three of those more readable than that mess of brackets and
> studlyCaps.
Of course you do, however judging from you posts you are an expert at
Perl. A language which is aiming for broader acceptance also has to be
readable and understandable to the vast majority of coders out there.
In my opinion english and english-like names, as well as less cryptic
symbols makes other languages easier to read to people in the low to
medium skill category. Shortening the learning curve would certainly
help bring more people to Perl.
> > This GREAT for one-liners, etc but for anything which you have to read
> > it later, it slows development to a crawl. Even on this newsgroup, if
> > you try to write readable code, people tell you your variables are too
> > long, you are using too many methods, etc.
>
> ..I don't think so. Examples?
Sure, from an article you wrote:
----------------------------------------------------------------
>> ltrim( $value ) - Removes leading whitespace from a string.
>>$value =~ s/^\s*//;
>> rtrim( $value ) - Removes trailing whitespace from a string.
>$value =~ s/\s*$//;
>> trim( $value ) - Combines ltrim() and rtrim().
>$value =~ s/^\s*(.*?)\s*$/$1/;
----------------------------------------------------------------
Forgive me if I'm wrong but will all of you examples it certainly
looks like you are advocating Tore not use the functions he wrote, and
instead use regexps that are common to all of perl. If you are only
saying that these shouldn't be part of the Perl base, then I agree
with you and please forgive me, but it looks to me like you are
rewriting everything Tore wrote in regexps rather than function calls
with names that make sense to him. There is another example which I
can't find of someone saying basically "after removing excessively
long variable names here is what your code looks like...".
> OK, yes, there's one *hell* of a lot of really badly written Perl out
> there. Perl is a tool which treats the programmer as a responsible
> adult, capable of making sensible decisions about the compromise
> between readability and brevity, between getting the thing working now
> and keeping it working later. All too many programmers abuse that
> responsibility, but that doesn't make Perl a bad language, it makes
> tham bad programmers.
This is covered in detail below in this thread, however I am in favor
of structured coding for the same reasons as Charlton is. Too many
people, to much chaos, wasting too much time trying to decipher what
should be done virtually the same in all cases across the board. Or
just wasting time trying to decide on coding guidelines in the first
place. Yucky.
BTW, I have no illusions that I am going to convert anyone here. All I
am hoping is that the Perl gods hear that some people say "There Are
Too Many Ways To Do It", which hurts readability. :-)
-Greg
------------------------------
Date: 17 Feb 2004 22:17:11 GMT
From: "Tassilo v. Parseval" <tassilo.parseval@rwth-aachen.de>
Subject: Re: Why is Perl losing ground?
Message-Id: <c0u3t7$62t$1@nets3.rz.RWTH-Aachen.DE>
Also sprach G Klinedinst:
> Ben Morrow <usenet@morrow.me.uk> wrote in message news:
>> > This GREAT for one-liners, etc but for anything which you have to read
>> > it later, it slows development to a crawl. Even on this newsgroup, if
>> > you try to write readable code, people tell you your variables are too
>> > long, you are using too many methods, etc.
>>
>> ..I don't think so. Examples?
> Sure, from an article you wrote:
> ----------------------------------------------------------------
>>> ltrim( $value ) - Removes leading whitespace from a string.
>>>$value =~ s/^\s*//;
>>> rtrim( $value ) - Removes trailing whitespace from a string.
>>$value =~ s/\s*$//;
>>> trim( $value ) - Combines ltrim() and rtrim().
>>$value =~ s/^\s*(.*?)\s*$/$1/;
> ----------------------------------------------------------------
> Forgive me if I'm wrong but will all of you examples it certainly
> looks like you are advocating Tore not use the functions he wrote, and
> instead use regexps that are common to all of perl. If you are only
> saying that these shouldn't be part of the Perl base, then I agree
> with you and please forgive me, but it looks to me like you are
> rewriting everything Tore wrote in regexps rather than function calls
> with names that make sense to him. There is another example which I
> can't find of someone saying basically "after removing excessively
> long variable names here is what your code looks like...".
Whenever the topic of readability is discussed, sooner or later regexps
will be mentioned as the one big evil of unreadability. I would like to
point out that the concept of regular expressions is far older than
Perl. Originally they were a different notation for deterministic (or
indeterministic) finite automata and are able to describe the same
languages (namely regular languages, hence the name).
It has nothing to do with the programming languages. Regular expressions
look the same in every programming language (minus some extended
features that regular expression engines tend to offer; Perl has quite a
lot of them). Therefore I could argue that using simple regexps is
actually more readable than a function because anyone with an even
moderate background in computer science should be able to read them.
Unlike functions. Since function names differ wildly across programming
languages, the programmer will very likely have to look it up in the
docs.
Tassilo
--
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval
------------------------------
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 6149
***************************************