[18886] in Perl-Users-Digest
Perl-Users Digest, Issue: 1054 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Jun 4 14:11:02 2001
Date: Mon, 4 Jun 2001 11:10:20 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <991678220-v10-i1054@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 4 Jun 2001 Volume: 10 Number: 1054
Today's topics:
Module Question <mriehl@home.com>
Re: Module Question <buggs-clpm@splashground.de>
Re: Module Question <tony_curtis32@yahoo.com>
New posters to comp.lang.perl.misc <gbacon@cs.uah.edu>
Passing XML string to the URL <m.astrakhanskaya@gte.net>
Perl Script (Jeff)
Re: Perl Script <rsherman@ce.gatech.edu>
Re: perl/cgi and dynamic hyperlink <godzilla@stomp.stomp.tokyo>
Re: perl/cgi and dynamic hyperlink <peb@bms.umist.ac.uk>
Re: perl/cgi and dynamic hyperlink <peb@bms.umist.ac.uk>
Re: perl/cgi and dynamic hyperlink (krakle)
Re: perlre: delete content of $1 (Tad McClellan)
Re: perlre: delete content of $1 <wyzelli@yahoo.com>
Re: perlre: delete content of $1 <godzilla@stomp.stomp.tokyo>
Re: Posting Etiquette <mischief@velma.motion.net>
Re: Posting Etiquette (Tad McClellan)
Re: Reading mail <a.v.a@home.nl>
Re: Recursing a directory tree <nwang@shell3.shore.net>
Re: Recursing a directory tree <iltzu@sci.invalid>
Re: Recursing a directory tree <nwang@shell3.shore.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 04 Jun 2001 14:46:58 GMT
From: "Mark Riehl" <mriehl@home.com>
Subject: Module Question
Message-Id: <CbNS6.196922$K5.20271264@news1.rdc1.nj.home.com>
All,
I'm running ActiveState on Win2k and I'm trying to use the Net::IP module.
Pulling the sample off the docs page, I have the following:
#!perl -w
use Net::IP;
my $ip = new IP ('193.0.1/24') or die (Net::IP::Error());
print ("IP : ".$ip->ip()."\n");
print ("Sho : ".$ip->short()."\n");
print ("Bin : ".$ip->binip()."\n");
print ("Int : ".$ip->intip()."\n");
...
When I run, I get the following error:
Can't locate object method "new" via package "IP" at iptools.pl line 5.
I've installed the module using ppm, and it shows up as being installed
using ppm query.
Any ideas why Perl can't find the new subroutine? It is present in the
module.
Thanks,
Mark
------------------------------
Date: Mon, 4 Jun 2001 17:03:23 +0200
From: buggs <buggs-clpm@splashground.de>
Subject: Re: Module Question
Message-Id: <9fg81v$6gd$03$1@news.t-online.com>
Mark Riehl wrote:
- my $ip = new IP ('193.0.1/24') or die (Net::IP::Error());
+ my $ip = new Net::IP ('193.0.1/24') or die (Net::IP::Error()
Buggs
------------------------------
Date: 04 Jun 2001 10:11:32 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Module Question
Message-Id: <87n17offff.fsf@limey.hpcc.uh.edu>
>> On Mon, 04 Jun 2001 14:46:58 GMT,
>> "Mark Riehl" <mriehl@home.com> said:
> All, I'm running ActiveState on Win2k and I'm trying to
> use the Net::IP module. Pulling the sample off the docs
> page, I have the following:
> use Net::IP;
> my $ip = new IP ('193.0.1/24') ...
> Can't locate object method "new" via package "IP" at
> iptools.pl line 5.
It's called "Net::IP" not just "IP", cf. the "use" line.
Looks like a typo in the module's documentation. cc'ed to
author of module.
hth
t
--
Just reach into these holes. I use a carrot.
------------------------------
Date: Mon, 04 Jun 2001 16:08:41 -0000
From: Greg Bacon <gbacon@cs.uah.edu>
Subject: New posters to comp.lang.perl.misc
Message-Id: <thnck98780l5db@corp.supernews.com>
Following is a summary of articles from new posters spanning a 7 day
period, beginning at 28 May 2001 17:04:49 GMT and ending at
04 Jun 2001 14:39:32 GMT.
Notes
=====
- A line in the body of a post is considered to be original if it
does *not* match the regular expression /^\s{0,3}(?:>|:|\S+>|\+\+)/.
- All text after the last cut line (/^-- $/) in the body is
considered to be the author's signature.
- The scanner prefers the Reply-To: header over the From: header
in determining the "real" email address and name.
- Original Content Rating (OCR) is the ratio of the original content
volume to the total body volume.
- Find the News-Scan distribution on the CPAN!
<URL:http://www.perl.com/CPAN/modules/by-module/News/>
- Please send all comments to Greg Bacon <gbacon@cs.uah.edu>.
- Copyright (c) 2001 Greg Bacon.
Verbatim copying and redistribution is permitted without royalty;
alteration is not permitted. Redistribution and/or use for any
commercial purpose is prohibited.
Totals
======
Posters: 125 (36.2% of all posters)
Articles: 206 (18.2% of all articles)
Volume generated: 347.7 kb (16.7% of total volume)
- headers: 164.7 kb (3,387 lines)
- bodies: 177.4 kb (5,988 lines)
- original: 118.6 kb (4,225 lines)
- signatures: 5.3 kb (147 lines)
Original Content Rating: 0.668
Averages
========
Posts per poster: 1.6
median: 1 post
mode: 1 post - 90 posters
s: 1.9 posts
Message size: 1728.2 bytes
- header: 818.9 bytes (16.4 lines)
- body: 881.8 bytes (29.1 lines)
- original: 589.4 bytes (20.5 lines)
- signature: 26.5 bytes (0.7 lines)
Top 10 Posters by Number of Posts
=================================
(kb) (kb) (kb) (kb)
Posts Volume ( hdr/ body/ orig) Address
----- -------------------------- -------
12 18.0 ( 10.0/ 8.0/ 3.4) John Imrie <07950232225@one2one.net>
9 13.2 ( 7.3/ 5.8/ 4.4) buggs <buggs-clpm@splashground.de>
7 10.9 ( 5.6/ 5.3/ 2.8) "Stefan Weiss" <der.prinz@gmx.net>
6 11.9 ( 5.2/ 6.7/ 3.3) "Daniel van den Oord" <daniel304@planet.nl>
6 9.6 ( 4.6/ 4.5/ 2.2) Dmitry Epstein <mitia.nospam@northwestern.edu.invalid>
5 7.0 ( 3.4/ 3.6/ 2.5) "Muddy Cat" <muddycat@hotmail.com>
5 9.0 ( 4.6/ 4.4/ 3.3) Tim <timster@worldnet.att.net>
4 8.1 ( 2.9/ 5.1/ 4.5) krakle <krakle@visto.com>
4 7.3 ( 4.3/ 3.0/ 1.1) "Maya" <m.astrakhanskaya@gte.net>
4 8.3 ( 3.9/ 4.3/ 2.9) Robert Sherman <rsherman@ce.gatech.edu>
These posters accounted for 5.5% of all articles.
Top 10 Posters by Volume
========================
(kb) (kb) (kb) (kb)
Volume ( hdr/ body/ orig) Posts Address
-------------------------- ----- -------
18.0 ( 10.0/ 8.0/ 3.4) 12 John Imrie <07950232225@one2one.net>
13.2 ( 7.3/ 5.8/ 4.4) 9 buggs <buggs-clpm@splashground.de>
11.9 ( 5.2/ 6.7/ 3.3) 6 "Daniel van den Oord" <daniel304@planet.nl>
10.9 ( 5.6/ 5.3/ 2.8) 7 "Stefan Weiss" <der.prinz@gmx.net>
9.6 ( 4.6/ 4.5/ 2.2) 6 Dmitry Epstein <mitia.nospam@northwestern.edu.invalid>
9.0 ( 4.6/ 4.4/ 3.3) 5 Tim <timster@worldnet.att.net>
8.5 ( 1.8/ 6.8/ 3.1) 2 Shadow <news@quickdirect.com>
8.3 ( 3.9/ 4.3/ 2.9) 4 Robert Sherman <rsherman@ce.gatech.edu>
8.1 ( 2.9/ 5.1/ 4.5) 4 krakle <krakle@visto.com>
7.3 ( 4.3/ 3.0/ 1.1) 4 "Maya" <m.astrakhanskaya@gte.net>
These posters accounted for 5.0% of the total volume.
Top 10 Posters by OCR (minimum of three posts)
==============================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.939 ( 1.6 / 1.8) 3 chickenmilkbomb@hotmail.com
0.871 ( 4.5 / 5.1) 4 krakle <krakle@visto.com>
0.761 ( 4.4 / 5.8) 9 buggs <buggs-clpm@splashground.de>
0.755 ( 3.3 / 4.4) 5 Tim <timster@worldnet.att.net>
0.696 ( 2.5 / 3.6) 5 "Muddy Cat" <muddycat@hotmail.com>
0.663 ( 2.9 / 4.3) 4 Robert Sherman <rsherman@ce.gatech.edu>
0.577 ( 2.7 / 4.7) 3 "Steven Michaels" <smichae@ilstu.edu>
0.519 ( 2.8 / 5.3) 7 "Stefan Weiss" <der.prinz@gmx.net>
0.496 ( 2.2 / 4.5) 6 Dmitry Epstein <mitia.nospam@northwestern.edu.invalid>
0.488 ( 3.3 / 6.7) 6 "Daniel van den Oord" <daniel304@planet.nl>
Bottom 10 Posters by OCR (minimum of three posts)
=================================================
(kb) (kb)
OCR orig / body Posts Address
----- -------------- ----- -------
0.696 ( 2.5 / 3.6) 5 "Muddy Cat" <muddycat@hotmail.com>
0.663 ( 2.9 / 4.3) 4 Robert Sherman <rsherman@ce.gatech.edu>
0.577 ( 2.7 / 4.7) 3 "Steven Michaels" <smichae@ilstu.edu>
0.519 ( 2.8 / 5.3) 7 "Stefan Weiss" <der.prinz@gmx.net>
0.496 ( 2.2 / 4.5) 6 Dmitry Epstein <mitia.nospam@northwestern.edu.invalid>
0.488 ( 3.3 / 6.7) 6 "Daniel van den Oord" <daniel304@planet.nl>
0.458 ( 1.2 / 2.7) 3 Nan Wang <nwang@shell3.shore.net>
0.423 ( 3.4 / 8.0) 12 John Imrie <07950232225@one2one.net>
0.423 ( 1.0 / 2.5) 3 "Simon McCaughey" <simonmcc@nortelnetworks.com.nospam>
0.376 ( 1.1 / 3.0) 4 "Maya" <m.astrakhanskaya@gte.net>
14 posters (11%) had at least three posts.
Top 10 Targets for Crossposts
=============================
Articles Newsgroup
-------- ---------
24 comp.lang.perl.modules
21 alt.perl
12 comp.object
10 comp.lang.perl
7 de.comp.lang.perl.cgi
6 comp.lang.perl.tk
5 comp.databases.informix
4 alt.ascii-art.animation
4 alt.ascii-art
3 pl.comp.programming
Top 10 Crossposters
===================
Articles Address
-------- -------
5 Jan-Pieter Cornet <johnpc@xs3.xs4all.nl>
4 Tim <timster@worldnet.att.net>
4 John Imrie <07950232225@one2one.net>
4 "Daniel van den Oord" <daniel304@planet.nl>
3 Tom Grenier <tom@sqlman.com>
3 "Andrew Hamm" <NOahammSPAN@sanderson.net.au>
2 Shadow <news@quickdirect.com>
2 llizard@idirct.ca
2 ldb <shedragon@lycos.com>
1 "Chris Twiner" <NOtwiner@atcableinet.you'llco.seeuk>
------------------------------
Date: Mon, 04 Jun 2001 15:45:12 GMT
From: "Maya" <m.astrakhanskaya@gte.net>
Subject: Passing XML string to the URL
Message-Id: <c2OS6.254$2g7.84917@dfiatx1-snr1.gtei.net>
Could anybody give me a friendly helping hand?
I am trying send XML formatted string ( which should become the part of
URL )
$XMLReq = new HTTP::Request POST =>
'http://host/path/CreateAppcount.aspMetaData=';
$XMLReq->content_type ('text/xml');
$XMLReq->content($XML_string); #XML_string is 1146 char long
$Resp = $TheAgent->request($XMLReq);
if ($Resp->is_success)
{ print STDERR $Resp->content; }
else
{ print "script failed\n"; }
I am getting the error message :'Incomplete request' . What am I doing
wrong?
--
Maya
------------------------------
Date: 4 Jun 2001 10:05:53 -0700
From: jeff.malmquist@indsys.ge.com (Jeff)
Subject: Perl Script
Message-Id: <b980330f.0106040905.4e9bf39b@posting.google.com>
I am very new to scripting. So new that it is still a foreign
language to me. I am kind of in a bind and need some help. I am
replacing a number of relic NT servers with new high end equipment.
They are strictly file and print servers for field users and offices.
I am using the "Scopy" function to migrate the data from Server A
(old) to Server B (new). This accomplishes part of the job. The area
I am interested in finding a script for is how to copy all of the
shares (including hidden) and their associated permissions from Server
A to Server B. Any help, direction, or scripts would be greatly
appreciated.
------------------------------
Date: Mon, 04 Jun 2001 13:56:30 +0500
From: Robert Sherman <rsherman@ce.gatech.edu>
Subject: Re: Perl Script
Message-Id: <3B1B4D3E.6E877281@ce.gatech.edu>
Jeff wrote:
> I am very new to scripting. So new that it is still a foreign
> language to me. I am kind of in a bind and need some help. I am
> replacing a number of relic NT servers with new high end equipment.
> They are strictly file and print servers for field users and offices.
> I am using the "Scopy" function to migrate the data from Server A
> (old) to Server B (new). This accomplishes part of the job. The area
> I am interested in finding a script for is how to copy all of the
> shares (including hidden) and their associated permissions from Server
> A to Server B. Any help, direction, or scripts would be greatly
> appreciated.
look at these modules:
Win32::NetResource
Win32::AdminMisc
Win32::NetAdmin
you can ppm them or get them from CPAN
dave roth's books might be helpful to you...http://www.roth.net/books/
-rob
------------------------------
Date: Mon, 04 Jun 2001 07:00:28 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: perl/cgi and dynamic hyperlink
Message-Id: <3B1B947C.8F3E7361@stomp.stomp.tokyo>
Paul Boardman wrote:
> Godzilla! wrote:
> > buggs wrote:
> > > krakle wrote:
(snipped)
> <snip troll rant>
> There's no offence meant here, I'm just curious.
It is not my customary habit to be responsive
to those whom initiate dialog by telling lies.
Godzilla!
------------------------------
Date: Mon, 04 Jun 2001 16:21:02 +0100
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: perl/cgi and dynamic hyperlink
Message-Id: <3B1BA75E.46FB66D4@bms.umist.ac.uk>
"Godzilla!" wrote:
>
> Paul Boardman wrote:
>
> > Godzilla! wrote:
> > > buggs wrote:
> > > > krakle wrote:
>
> (snipped)
>
> > <snip troll rant>
>
> > There's no offence meant here, I'm just curious.
>
> It is not my customary habit to be responsive
> to those whom initiate dialog by telling lies.
so I was right about the paranoia then.
sorry to have bothered you.
not so sorry to have probably entered your kill-file.
Regards
Paul
------------------------------
Date: Mon, 04 Jun 2001 16:55:41 +0100
From: Paul Boardman <peb@bms.umist.ac.uk>
Subject: Re: perl/cgi and dynamic hyperlink
Message-Id: <3B1BAF7D.B9A334DB@bms.umist.ac.uk>
"Godzilla!" wrote:
>
> Paul Boardman wrote:
>
> > Godzilla! wrote:
> > > buggs wrote:
> > > > krakle wrote:
>
> (snipped)
>
> > <snip troll rant>
>
> > There's no offence meant here, I'm just curious.
>
> It is not my customary habit to be responsive
> to those whom initiate dialog by telling lies.
* sigh *
I see where the misunderstanding came from now.
I was not referring to you as the troll. I was just pointing out that I
had cut out a section where you were referring to another poster (one of
those with multiple monikers) as a troll.
I say again, I intended no offence.
Regards
Paul
------------------------------
Date: 4 Jun 2001 10:53:46 -0700
From: krakle@visto.com (krakle)
Subject: Re: perl/cgi and dynamic hyperlink
Message-Id: <237aaff8.0106040953.e58e2a2@posting.google.com>
"Newbies bitching is even worse than regulars bitching."
I come sporadicly to this NewsGroup. Newbie to perl? No, I been
codingin Perl for a couple of years now. Newbie to this group? I dont
care if you classify me under that particular categlory. I only rarely
come here. I dont really have time to come here like Godzilla and post
under every thread. I have what us normal people call a life. A real
life.
------------------------------
Date: Mon, 4 Jun 2001 08:20:07 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: perlre: delete content of $1
Message-Id: <slrn9hmv7n.vhs.tadmc@tadmc26.august.net>
John Lin <johnlin@chttl.com.tw> wrote:
>"Tad McClellan"
>> peter pilsl wrote:
>> >$a=~/$pre(.*)$post/;
>> >
>> > If it fails, $1 should be empty, but in fact it is not set
>> >and therefore has the value of the preceeding patternmatching-operation.
>
>> The dollar-digit variables are only set on successful matches.
>> Unsuccessful matches leave them with their previous values.
>
>I had similar problem with pos().
But pos() is not a dollar-digit variable.
>Once I wrote a piece of code like:
>
>$_ = 'Good evening, sir.';
>if(/Good/g and /\G morning/g and /\G,/g and /\G sir\./) {
> print "Successful\n";
>}
>else {
> print "Mismatch happened near ",pos(),"\n";
>}
>
>Eh, the unsuccessful match didn't leave everything with their
^^^^^^^^^^
>previous values, so my code became buggy.
Doesn't the bug (in _your_ code :-) go away when you add a 'c' option
to the \G matches?
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 4 Jun 2001 23:09:32 +0930
From: "Wyzelli" <wyzelli@yahoo.com>
Subject: Re: perlre: delete content of $1
Message-Id: <z2MS6.7$WV4.2210@vic.nntp.telstra.net>
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:3B19936D.C3AA4FD4@stomp.stomp.tokyo...
> peter pilsl wrote:
>
> You can pull one of my infamous Captain Jamie Kirk
> cheat tricks and have perl core do what you want:
>
> $a =~/()/;
>
> There you have it. $1 has been reset to null. No
> hassle, no problems, quick and easy. Keep this
> rogue method a secret just between you and myself.
I'd be interested to see how you would handle setting $2 through $9 in case
some or any of those had an undesired value from a previous match.
Which is more efficient? Explicitly forcing a variable to become null, or
simply not using it when a match fails. Can you benchmark that?
What are the side effects of forcing $1 to become null, and then using it
later without testing it? Does that generate warnings?
Do you still code with an else condition to ensure the variable has some
default value when a match fails? What about when the match should fail
anyway?
Just wondering...
Wyzelli
--
#Modified from the original by Jim Menard
for(reverse(1..100)){$s=($_==1)? '':'s';print"$_ bottle$s of beer on the
wall,\n";
print"$_ bottle$s of beer,\nTake one down, pass it around,\n";
$_--;$s=($_==1)?'':'s';print"$_ bottle$s of beer on the
wall\n\n";}print'*burp*';
------------------------------
Date: Mon, 04 Jun 2001 06:57:03 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: perlre: delete content of $1
Message-Id: <3B1B93AF.AB852692@stomp.stomp.tokyo>
Wyzelli wrote:
> Godzilla! wrote:
> > peter pilsl wrote:
> > You can pull one of my infamous Captain Jamie Kirk
> > cheat tricks and have perl core do what you want:
> > $a =~/()/;
> > There you have it. $1 has been reset to null. No
> > hassle, no problems, quick and easy. Keep this
> > rogue method a secret just between you and myself.
> I'd be interested to see how you would handle setting $2 through $9 in case
> some or any of those had an undesired value from a previous match.
The originating author did not ask how to do this. How this
could be done is quite obvious.
> Which is more efficient? Explicitly forcing a variable to become null, or
> simply not using it when a match fails. Can you benchmark that?
I have benchmarked two other methods against my method.
However, no other methods posted meet the originating
author's specified criteria of resetting $1 to null.
Is your benchmark module broken?
> What are the side effects of forcing $1 to become null, and then using it
> later without testing it? Does that generate warnings?
At my relative skill level, I have no need for warnings.
> Do you still code with an else condition to ensure the variable has some
> default value when a match fails? What about when the match should fail
> anyway?
Huh?
> Just wondering...
"just wondering"
- Paul Boardman
"just curious"
- Paul Boardman
Godzilla!
------------------------------
Date: Mon, 04 Jun 2001 15:16:46 -0000
From: Chris Stith <mischief@velma.motion.net>
Subject: Re: Posting Etiquette
Message-Id: <thn9iuq5htgi42@corp.supernews.com>
Abigail <abigail@foad.org> wrote:
> Chris Stith (mischief@velma.motion.net) wrote on MMDCCCXXXI September
> MCMXCIII in <URL:news:thg0i1quhdah6e@corp.supernews.com>:
> ||
> || Why do we (yes, "we" -- I've been known to do it too)
> || publicly announce killfiling people on such a regular basis? I mean,
> || if someone has been so blatantly rude that they deserve a slap in
> || the face along with being ignored, that's one thing. Often, though,
> || people get a public *plonk* for things which seem a trifle.
> For two, obvious, reasons:
> 1) To let others know such behaviour isn't appreciated, and what the
> consequences will be.
I find this reason agreeable at some threshold of rudeness by the
person being plonked.
> 2) Because sometimes it feels better to do it publicly than privately.
I find this reason a little questionable in some cases but justifiable
enough if the person being plonked was directly rude to the person
doing the plonking.
These are just my opinions, though, and I don't judge people by how
their opinions differ from mine. I do expect, though, that my view of a
single action based on someone else's opinions would be somewhat shaded
by my opinions. C'est la vie.
> I usually killfile privately; only sometimes publicly.
This makes perfect sense to me.
I know it seems strange that I publicly stated I _wasn't_ plonking
someone. I never claimed to be normal. There are people I think about
plonking but don't, because I give them the benefit of the doubt that
they will learn to be good posters. Being sociable and being interested
in a peaceable discussion help keep non-negative scores in my file. In
fact, I sometimes score people up for being friendly and clueless about
Perl just as much as for being clueful and being moderately sociable.
That way, I can help those people by answering their questions if I
can. All thigns being equal, I prefer to discuss things with someone
who is being pleasant.
Chris
--
For the pleasure of others, please adhere to the following
rules when visiting your park:
No swimming. No fishing. No flying kites. No frisbees.
No audio equipment. Stay off grass. No pets. No running.
------------------------------
Date: Mon, 4 Jun 2001 10:59:23 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Posting Etiquette
Message-Id: <slrn9hn8ib.f8.tadmc@tadmc26.august.net>
Chris Stith <mischief@velma.motion.net> wrote:
>Abigail <abigail@foad.org> wrote:
>> I usually killfile privately; only sometimes publicly.
<aol>Me too!</aol>
>This makes perfect sense to me.
>In
>fact, I sometimes score people up for being friendly and clueless about
>Perl just as much as for being clueful and being moderately sociable.
Lest folks get the wrong idea, since negative scores get more "press"
than positive scores:
I also score up for some folks who are "clueless about Perl
and can follow usual netiquette".
I *like* helping people who are new to Perl programming.
[ I have Subject: "beginner" and "learn" scored up]
I don't like helping folks that won't follow the usual customs
(primary one being "check the docs before posting").
[ I have Subject: "newbie" and "guru" scored down]
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Mon, 04 Jun 2001 14:26:40 GMT
From: AvA <a.v.a@home.nl>
Subject: Re: Reading mail
Message-Id: <3B1B72DE.7458BEF2@home.nl>
David Tandberg-Johansen wrote:
> Hello!
>
> I am trying to make a program tha reads mail thrue Mail::POP3.
> I can read the mail, but when the sender send the mail in HTML format i can
> see all the html stuff and so.
> How can I remove that?Any hint wil be preciated
>
> David
perldoc -q html
------------------------------
Date: Mon, 04 Jun 2001 15:17:59 GMT
From: Nan Wang <nwang@shell3.shore.net>
Subject: Re: Recursing a directory tree
Message-Id: <HENS6.15$iH6.1001@news.shore.net>
Martien Verbruggen <mgjv@tradingpost.com.au> wrote:
> On Mon, 04 Jun 2001 02:45:03 GMT,
> Nan Wang <nwang@shell3.shore.net> wrote:
>> Benjamin Goldberg <goldbb2@earthlink.net> wrote:
>>> Nan Wang wrote:
>>>>
>>>> sub traverse {
>>>> no strict 'refs';
>>>> my ($startdir,$i)=@_;
>>>> $i++;
>>>> my $FH="FH"."$i";
>>>> opendir ("$FH",$startdir) or die "blah";
> [I will try not to repeat what the previous poster already said.]
Oh look, the Perl police is coming to get me now for not using File::Find.
> a local(*FH) would have done much better than the fiddling with symrefs.
> Also, it's probably a bit misleading to call a directory handle FH.
Why? Does it matter? Who cares.
> Under modern Perls, you can just use a lexically scoped variable, like
> the previous poster indicated.. The local or lexical will also
> automatically close the directory when the scope ends.
Wonderful.
> Also, it's adviseable to include $! in the error message for a system
> call.
Like I said, who cares. I don't expect anybody to just copy and paste this
into his or her script.
>>>> my @allfiles=grep !/^\.\.?$/, readdir $FH;
>>>> closedir ($FH);
>>>> my $file='';
> Note that $file is a lexically scoped variable which springs into
> existence here, and will be gone at the end of the sub.
>>>> foreach $file (@allfiles) {
> Why didn't you just do
> foreach my $file (@allfiles)
> or even leave out the whole temporary array?
Why should I? I write the code the way I want to make it easier for me
to read.
>>>> chomp $file;
> Why chomp this? readdir doesn't magically append newlines to your file
> names.
I chomp everything, because I feel like it.
>>>> my $file="$startdir/$file";
> Note that here you have a _new_ lexically scoped variable $file, whose
> existence will end at the end of the foreach loop.
>>>> if (-f $file) {
>>>> # do whatever
>>>> } elsif (-d $file) {
>>>> &traverse ($dir,$i);
>>>> }
>>>> }
>>>> }
>>
>>> And where does $dir come from?
>>
>> $dir = $file. It's part of a much larger program I did, so I snipped out
>> the irrelevant parts and I guess something got lost in the translation.
> Not here, it isn't. $dir is not $file. It first of all depends on which
> $file you think it is, since there are two. Then I would like you to
> point out where in your code $dir gets the value that is stored in the
> lexical $file. If $file was a global, you could have fiddled with
> aliases, but you haven't done that, so... What is $dir?
Replace $file in the elsif block and the assignment statement with $dir,
that's what I meant. Like I said, I snipped a lot of irrelevant parts from
the original, much larger script down to this, something got missed.
> I don't think your code ever worked.
I guess the project I did was just a dream. Nice try.
>> It's possible $i is unnecessary, it's too long ago I can't remember why I
>> did it this way.
> I'd advise you to severely review your code before submitting it again.
> it has some flaws that generally are frowned upon in this newsgroup, and
> it doesn't actually do what you say it is supposed to do. Even if the
> $dir is fixed to read $file, then the program could still use quite a
> bit of cleaning up before being something that you should post here.
Why? Are we only allowed to write code like you?
> If I had to come up with a subroutine that does this, I'd probably write
> it more like:
> sub traverse
> {
> my $dir = shift;
> opendir (my $dh, $dir) or
> warn("Couldn't opendir '$dir': $!\n"), return;
> while (my $file = readdir($dh))
> {
> next if $file eq '.' || $file eq '..';
> if (-d "$dir/$file")
> {
> print "DIR: $dir/$file\n";
> traverse("$dir/$file", @_);
> }
> else
> {
> print "NONDIR: $dir/$file\n";
> }
> }
> }
I don't think your code ever worked, where did you get $dh from? I advise
you to review your code first before sumbitting to this group again.
> But I wouldn't actually use this in production code. You see, it doesn't
> take any symbolic links into account, and it doesn't atke care of
> circularities in the file systems in any way. A set of symlinks pointing
> in the wrong direction could set up an infinite loop.
So add a -l. All I wanted to do was to demonstrate how to recrusively walk
through a directory tree.
> File::Find takes better care of that. While it isn't perfect, it is
> generally much better than anything you quickly can write yourself.
My script did what I wanted it to do, I wasn't aiming to win any "Martien
Verbruggen Perl Programming Style" award.
------------------------------
Date: 4 Jun 2001 17:25:31 GMT
From: Ilmari Karonen <iltzu@sci.invalid>
Subject: Re: Recursing a directory tree
Message-Id: <991674528.10428@itz.pp.sci.fi>
In article <HENS6.15$iH6.1001@news.shore.net>, Nan Wang wrote:
>
>Like I said, who cares. I don't expect anybody to just copy and paste this
>into his or her script.
Unfortunately, your expectation is very likely to be wrong. Trust me on
that. People _will_ copy sample code posted here, _particularly_ when
they don't understand how it works (or doesn't). Occasionally said code
ends up reposted here for debugging after going a full circle.
This is especially true for sample code like yours, which is ready to be
used as is. That is why people here tend to insist on all posted code
being tested and cleanly written, or else marked as potentially suspect.
As for the rest of your response, I'd suggest a less defensive attitude.
Martien was offering you free (and quite good) advice on improving your
code. That advice may have been given in a tone you didn't like, but
that is hardly a reason to turn it down. You are not your code, and if
someone criticises your code it does not mean they are insulting you.
--
Ilmari Karonen - http://www.sci.fi/~iltzu/
Please ignore Godzilla / Kira -- do not feed the troll.
------------------------------
Date: Mon, 04 Jun 2001 18:03:08 GMT
From: Nan Wang <nwang@shell3.shore.net>
Subject: Re: Recursing a directory tree
Message-Id: <w3QS6.49$iH6.1001@news.shore.net>
Ilmari Karonen <iltzu@sci.invalid> wrote:
> In article <HENS6.15$iH6.1001@news.shore.net>, Nan Wang wrote:
>>
>>Like I said, who cares. I don't expect anybody to just copy and paste this
>>into his or her script.
> Unfortunately, your expectation is very likely to be wrong. Trust me on
> that. People _will_ copy sample code posted here, _particularly_ when
> they don't understand how it works (or doesn't). Occasionally said code
> ends up reposted here for debugging after going a full circle.
> This is especially true for sample code like yours, which is ready to be
> used as is. That is why people here tend to insist on all posted code
> being tested and cleanly written, or else marked as potentially suspect.
If someone just copies whatever he sees on USENET into his script without
testing, that's his problem.
> As for the rest of your response, I'd suggest a less defensive attitude.
> Martien was offering you free (and quite good) advice on improving your
> code. That advice may have been given in a tone you didn't like, but
> that is hardly a reason to turn it down. You are not your code, and if
> someone criticises your code it does not mean they are insulting you.
I don't know why you think I was being defensive, I have nothing to be
ashamed off. Like I said I write scripts to get things done, not for
people to frame it and stick it on the wall and boggle at how few lines it
took. I was rather pissed off at his nitpicking, anal retentiveness and
his holier-than-thou attitude. Can I improve my code? Definitely, but
I'll improve it the way I want, not as Martien mandates.
------------------------------
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 1054
***************************************