[23423] in Perl-Users-Digest
Perl-Users Digest, Issue: 5640 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 9 18:05:39 2003
Date: Thu, 9 Oct 2003 15:05:08 -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 Thu, 9 Oct 2003 Volume: 10 Number: 5640
Today's topics:
Re: Calling parent constructor <coo_t2-NO-LIKE-SPAM@yahoo.com>
Disable automatic URI::Escape in LWP <hakonrk@fys.uio.no>
Re: Disable automatic URI::Escape in LWP <hakonrk@fys.uio.no>
Documentation problems <no-email@home.se>
every combination of letters (roger)
Re: How to get locally configured IP addresses <nospam@nospam.org>
Re: NEWBIE! Please help! (BDK)
Re: Opinions on "new SomeObject" vs. "SomeObject->new() <perl@my-header.org>
Re: Perl Command line for stat <bik.mido@tiscalinet.it>
Perl Examples <kristoffhahns@*NOSPAM*lycos.com>
strip text up to a keyword? (kw)
Re: Teach me how to fish, regexp <dha@panix.com>
Re: trying to understand a hash - understanding has occ (John)
Re: trying to understand a hash - understanding has occ (Tad McClellan)
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 09 Oct 2003 20:24:37 GMT
From: ed <coo_t2-NO-LIKE-SPAM@yahoo.com>
Subject: Re: Calling parent constructor
Message-Id: <ibgbovs6jtgpt22bunbb62i0blens3f94l@4ax.com>
I believe I found out that this is the right way to do it:
$this = $this->SUPER::new(@_);
You just have to make sure you've placed the parent classes into the
@ISA array in the right order.
--ed
------------------------------
Date: Thu, 09 Oct 2003 19:54:23 GMT
From: Haakon Riiser <hakonrk@fys.uio.no>
Subject: Disable automatic URI::Escape in LWP
Message-Id: <slrnbobf7f.af8.hakonrk@s.hn.org>
Is it possible to disable automatic escaping of unsafe characters
in LWP (specifically in the POST and GET commands)?
Thanks in advance!
--
Haakon
------------------------------
Date: Thu, 09 Oct 2003 21:02:20 GMT
From: Haakon Riiser <hakonrk@fys.uio.no>
Subject: Re: Disable automatic URI::Escape in LWP
Message-Id: <slrnbobj6s.bjv.hakonrk@s.hn.org>
(Answering my own posting.)
> Is it possible to disable automatic escaping of unsafe characters
> in LWP (specifically in the POST and GET commands)?
I think I figured it out myself (haven't verified it yet though).
Instead of using LWP::UserAgent->post(...), I have to construct the
POST command manually (using HTTP::Request). Right?
--
Haakon
------------------------------
Date: Thu, 09 Oct 2003 21:23:18 +0200
From: Roger Johansson <no-email@home.se>
Subject: Documentation problems
Message-Id: <k8dbov0ivcpf88fscu1813rv3bg5kgfgkq@4ax.com>
I downloaded "The Mason book" as a tar.gz file together with a .pl
file to compile the pod files into html files.
(I cannot afford to read the book online on a modem line)
From http://www.masonbook.com/book/ which is one of the links at
learn.perl.org
I have problems compiling this book. The book_as_html.pl file seems
not to work. I try to run "perl book_as_html.pl" in the dos window, in
the same folder where I have unpacked the tar.gz file.
I first got a message that it could not find the sample.pm file, so I
copied it to the folder the .pl file seemed to expect it to be.
The .pl file looks like this in the beginning:
.......
#!/usr/bin/perl -w
use strict;
package MasonBook::ToHTML;
use Pod::Simple 0.96;
use base qw( Pod::Simple );
use File::Basename;
use File::Spec;
.......
Then it said that the version and package check failed, in line 7 of
the script.
I changed the version number to the same as in the sample.pm file.
Then it said that the Sample class was empty and said there was a
fault in line 8.
Is there a better way to compile this book, or is there a way to
rewrite this script so it works?
--
Roger J.
(My email address is a spam trap, do not use it)
------------------------------
Date: 9 Oct 2003 11:41:31 -0700
From: rogerroger457@hotmail.com (roger)
Subject: every combination of letters
Message-Id: <1fc1d64d.0310091041.38bf8413@posting.google.com>
Hi Folks,
I need to write two programs for a school assignment. One is an
"efficient" anagram program that will find all anagrams for a given
word by sorting all given letters of the supplied word and dictionary
which will then find all of the matching words.
The next version of the program (the "inefficient" example) is
supposed to try every combination of letters and find anagrams by pure
brute force by trying every combination of letters up to
len($suppliedWord) in length.
I'm not looking for someone to do this for me, I'm looking for advice
on how do I go about trying every possible combination of letters. It
sounds pretty easy on the surface but as I think about it more it
seems to get messier and messier.
Does soemone know of a "clean" method I can use to iterate through
every possible combination of letters?
Thanks,
Roger
------------------------------
Date: Thu, 9 Oct 2003 13:57:52 -0400
From: "Christian Caron" <nospam@nospam.org>
Subject: Re: How to get locally configured IP addresses
Message-Id: <bm47j0$hl826@nrn2.NRCan.gc.ca>
"James Willmore" <jwillmore@remove.adelphia.net> wrote in message
news:20031009131533.10c65bb4.jwillmore@remove.adelphia.net...
>
> More importantly, if you had done the leg work _before_ posting, you
> would not have had to post at all :-)
>
But thanks to him, it will be easier for someone looking for this answer
next time. At least, there will be one more source to find the information
from.
Christian
------------------------------
Date: 9 Oct 2003 14:35:59 -0700
From: bdknoll@runbox.com (BDK)
Subject: Re: NEWBIE! Please help!
Message-Id: <dffcb909.0310091335.3b5e70fe@posting.google.com>
Thanks everyone. I couldn't wait for my original email to be posted,
but I eventually figured it out. I did this:
$word = ki45;
$word =~ s/45/\x24/;
print ($word, "\n");
------------------------------
Date: Thu, 09 Oct 2003 22:03:04 +0200
From: Matija Papec <perl@my-header.org>
Subject: Re: Opinions on "new SomeObject" vs. "SomeObject->new()"
Message-Id: <8lfbov41i5dcs6jnd35dedp220gop2ov3i@4ax.com>
X-Ftn-To: Abigail
Abigail <abigail@abigail.nl> wrote:
><> which should have community consensus? Like perlstyle.pod which could make
><> some guidelines more official?
>
>Please no. *Personal* programming guidelines are ok. But let's not wade
>into the swamps of trying to derive guidelines with community consensus.
>Remember that are hundreds of thousands of Perl programmers, but only a
>few hundred of them are active on Perl forums - but there are dozens of
>those forums.
Ok, a whole community is too wide for such task, but actually I had in mind
smaller group of highly experienced programmers/teachers which can receive
blessings from Larry. Of course, if such guidelines threaten some basic
religious beliefs, they can never be done.
>style guide". If you want a language that comes with a notion on what
>is good style, and what should be avoided, you find it thataway --->
>www.python.org.
There is a difference between enforced standards and guidelines which you
use willingly. Also, freedom is a great thing but first you have to
//understand// implications of your programming decisions. If you're not
sure what you're doing, better grab some guide which will tell you how and
why (otherwise fully enjoy your freedom).
So, how much evil I am, is there some hope for me? :-)
--
Matija
------------------------------
Date: Thu, 09 Oct 2003 20:46:05 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: Perl Command line for stat
Message-Id: <ai7bovg4ric4gho2tt82fo4fv90gjtcnl2@4ax.com>
On Tue, 7 Oct 2003 23:57:13 +0530, Thens <thens@NOSPAMti.com> wrote:
>On 7 Oct 2003 10:52:23 -0700
>nos41@hotmail.com (nos) wrote:
>
># I am trying to use a command line Perl _e to stat a file with in
># Solaris. I was looking for someone that can modify the line so it
># will work from a command line. I have not been able to figure out the
># right format to use. Can someone please help me with this.
>#
># Perl _e _(stat($filename)) [10]' any suggestions
>
>perl -e 'print [stat $ARGV[0]]->[10]' <filename>
perl -le 'print +(stat shift)[10]' <filename>
or slightly more generic,
perl -le 'print for map +(stat)[10], @ARGV' <filename(s)>
but then maybe better something along the lines of
perl -le 'print for map "$_\t".(stat)[10], @ARGV' <filename(s)>
In any case displaying (stat)[10] sounds strange IMHO: isn't it that
what the OP really wants is something of the kind of
perl -le 'print scalar localtime +(stat shift)[10]' <filename>
Michele
--
# This prints: Just another Perl hacker,
seek DATA,15,0 and print q... <DATA>;
__END__
------------------------------
Date: Thu, 09 Oct 2003 11:12:08 -0700
From: Kristoff <kristoffhahns@*NOSPAM*lycos.com>
Subject: Perl Examples
Message-Id: <byhhb.63131$Ms2.27210@fed1read03>
Hi,
Yes, my email for previous posted question is
kristoffhahns@REMOVElycos.com, or just post response here. Thank you.
Kristoff
------------------------------
Date: 9 Oct 2003 13:52:16 -0700
From: anon002001@yahoo.com (kw)
Subject: strip text up to a keyword?
Message-Id: <b7675d5e.0310091252.14d92f05@posting.google.com>
Is there a relatively simple way to strip/delete all text from a file,
up to a keyword? It has to work around linefeeds. I have the webpage
stored in a text variable. Basically I want to remove a bunch of
useless text, ads, scripts, etc from webpage html, and have the
important text content as the result...
$webpage=get_webpage("http://news.yahoo.com/news?tmpl=index&cid=716");
#done
$webpage=strip_html($webpage); #done
$webpage=strip_text_up_to("Top Stories",$webpage);
$webpage=strip_text_after("Top Stories Section",$webpage);
-note, my perl skills are pretty limited so a more simplistic approach
would help me
-note, I've searched and can't find anything to do this, if it exists
already please point me to it
Thanks!
------------------------------
Date: Thu, 9 Oct 2003 20:19:03 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: Teach me how to fish, regexp
Message-Id: <slrnbobgln.7kb.dha@panix2.panix.com>
In article <3ee08638.0310090552.2821c3a4@posting.google.com>, Roy Johnson wrote:
>
> I think a little more significance is being given to the differences
> in versions than is warranted. For most things, the Camel book is a
> fine reference. Particularly for someone just getting acquainted with
> Perl, it is going to be more than adequate. You give the impression
> that there are major compatibility problems between versions of Perl
> 5.
>
> That said, I should have had a caveat that features do change.
That caveat is exactly what makes it a bad *reference*.
I certainly wouldn't say it's not worth reading, but I wouldn't want to
look something up in a source that may be wrong on what ever I'm trying
to do.
Rather than check the book and then check the current docs to make sure
it wasn't something that had changed, I'd rather just read the docs. :-)
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
And finally, it appears that Schwern, Michael is an Alien Drag Queen
- Leon Brocard, London.pm List Weekly Summary 2001-03-19
(This has *something* to do with http://us.imdb.com/Title?0103645)
------------------------------
Date: 9 Oct 2003 13:24:27 -0700
From: jguad98@hotmail.com (John)
Subject: Re: trying to understand a hash - understanding has occured
Message-Id: <a964da31.0310091224.5fc5d0a3@posting.google.com>
tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnbo73cg.k9o.tadmc@magna.augustmail.com>...
>
> This is not a list (as in "email list"). This is a Usenet newsgroup.
>
>
My apologies, Tad, I didn't mean to denigrate this fine old pillar of
the internet ;-).
> > or
> > %hashname(key => value);
> > or
> > %hashname("key","value");
> > but not
> > %hashname{$key}{$other} = value;
>
>
> None of those are Perl (5).
>
What do you mean? The first two structures above are shown in my perl
book which specifically refers to perl 5.005 (the book is from a
programming class I took several years ago ... I know it's old, but
it's still handy). I seem to recall being told that the "=>" (arrow)
sign within a hash structure was a perl v5 feature not found in
previous versions.
O&BTW, what did you mean when you said "perl programmer" versus "Perl
programmer"? Is there some kind of class warfare involving leading
upper-case characters that I wasn't aware of? My pound-bang
specifically says /usr/bin/perl and not /usr/bin/Perl ... :-) ...
anyhow, I'm not a progammer -- I'm a pseudo-sysadmin that hacks out
perl scripts to aid me with my daily grind, but I have not got (nor do
I desire) the depth of knowledge in any programming language to be
termed "a programmer".
No worries ... all the responses to my query were very helpful ... now
I comprehend the hash of hashes structure a bit better than before,
and that is a good thing.
So ... to summarize, the structure
%hashname{$key}{$other} = value;
represents a 'hash of hashes' where the hash defined as
"%hashname{$key}" dereferences to another hashname which is then
referenced by key "$other" to get (or set) the value "value".
It makes sense now that I look at it in that light, but my initial
confusion was probably caused a bit by not understanding the the order
of operation ... to use the HoH as above, the hash has to dereference
from left to right (first complete legal term dereferences before any
further terms are analyzed?) whereas I'm used to reading these things
from right to left ... I was thinking that the "$other" was a
modifier, or reference, to the term "$key", not the hash
"%hashname{$key}", and that was an incorrect belief on my part. Holy
cr@p, batman! Now all of a sudden all kinds of funky hashes I've seen
are starting to make sense!!!!! Whoa ... my head is spinning ...
Best regards,
John
------------------------------
Date: Thu, 9 Oct 2003 16:44:49 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: trying to understand a hash - understanding has occured
Message-Id: <slrnboblmh.3au.tadmc@magna.augustmail.com>
John <jguad98@hotmail.com> wrote:
> tadmc@augustmail.com (Tad McClellan) wrote in message news:<slrnbo73cg.k9o.tadmc@magna.augustmail.com>...
>>
>> This is not a list (as in "email list"). This is a Usenet newsgroup.
>>
>
> My apologies, Tad, I didn't mean to denigrate this fine old pillar of
> the internet ;-).
I point out the distinction not because mailing lists are "bad"
or "worse".
I point out the distinction because they are different dynamics,
with different rules of what is socially acceptable.
>> > or
>> > %hashname(key => value);
>> > or
>> > %hashname("key","value");
>> > but not
>> > %hashname{$key}{$other} = value;
>>
>>
>> None of those are Perl (5).
>>
>
> What do you mean?
$ perl -e '%hashname(key => value)'
syntax error at -e line 1, near "%hashname("
Execution of -e aborted due to compilation errors.
$ perl -e '%hashname("key","value")'
syntax error at -e line 1, near "%hashname("
Execution of -e aborted due to compilation errors.
$ perl -e '%hashname{$key}{$other} = value'
syntax error at -e line 1, near "%hashname{"
Execution of -e aborted due to compilation errors.
I mean that none of them are written in the Perl programming language.
I also mean that they _will_ be part of the Perl programming
language in a few more years, when Perl 6 is released.
> The first two structures above are shown in my perl
> book
It is a crap book then. Syntax errors are inexcusable.
> which specifically refers to perl 5.005 (the book is from a
> programming class I took several years ago ... I know it's old, but
> it's still handy).
If it teaches non-Perl as Perl, then it is moving you _backwards_
in your understanding. Throw it in the trash (or sell it on E-bay).
> I seem to recall being told that the "=>" (arrow)
> sign within a hash structure was a perl v5 feature not found in
^^^^^^^^^^^^^^^^^^^^^^^
> previous versions.
The "fat comma" ( => ) has nothing to do with a hash structure,
it just happens that that is where most people choose to use it.
(and yes, it was introduced in version 5.mumble-mumble).
It is just another way of writing a comma (with a little extra
treatment for the left-hand operand).
print 'hi' , ' ' , 'there';
print 'hi' => ' ' => 'there';
print hi => ' ' => there;
all make the same output.
> O&BTW, what did you mean when you said "perl programmer" versus "Perl
> programmer"?
That Question is Asked Frequently:
What's the difference between "perl" and "Perl"?
A hash in a scalar context is only useful to the C programmers
that work on the perl binary. It is useful for evaluating the
effectiveness of perl's built-in hashing algorithm.
> Is there some kind of class warfare involving leading
> upper-case characters that I wasn't aware of?
No, there is some kind of different semantic between when
you say "perl" and when you say "Perl".
> My pound-bang
> specifically says /usr/bin/perl and not /usr/bin/Perl ... :-) ...
Which illustrates the difference rather nicely, as it is referring
to the perl binary (the interpreter) rather than to the Perl
programming language.
> %hashname{$key}{$other} = value;
That still is not Perl. You must have meant this instead:
$hashname{$key}{$other} = 'value'; # barewords are "bad" too
^
^
> represents a 'hash of hashes' where the hash defined as
> "%hashname{$key}" dereferences to another hashname which is then
^^^^
No, it refers to another hash, whether that hash has a name or not.
The name of something is not the same as the something being named.
You can have named or anonymous hashes in Perl.
> Holy
> cr@p, batman! Now all of a sudden all kinds of funky hashes I've seen
> are starting to make sense!!!!! Whoa ... my head is spinning ...
Welcome to our (Perl) world! :-)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Sat, 19 Jul 2003 01:59:56 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re:
Message-Id: <3F18A600.3040306@rochester.rr.com>
Ron wrote:
> Tried this code get a server 500 error.
>
> Anyone know what's wrong with it?
>
> if $DayName eq "Select a Day" or $RouteName eq "Select A Route") {
(---^
> dienice("Please use the back button on your browser to fill out the Day
> & Route fields.");
> }
...
> Ron
...
--
Bob Walton
------------------------------
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.
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 5640
***************************************