[22331] in Perl-Users-Digest
Perl-Users Digest, Issue: 4552 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Feb 11 18:10:52 2003
Date: Tue, 11 Feb 2003 15:10:13 -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, 11 Feb 2003 Volume: 10 Number: 4552
Today's topics:
Perl 5.8 Module Win32 for Listening to Multicast UDP? <Greg.Jackson@noaa.gov>
Perl+Tk+MySQL for Win32 that *works*? (Jim Seymour)
PersistentPerl never resolves first time through (Todd Boss)
Prompt to Save Locally <mememe@meme.com>
Raw Access to the Parallelport (=?ISO-8859-1?Q?Arno_T=F6ll?=)
Re: Security bug in CGI::Lite::escape_dangerous_chars() <goldbb2@earthlink.net>
Re: strict and warnings <abigail@abigail.nl>
Re: strict and warnings <abigail@abigail.nl>
Re: strict and warnings <noreply@gunnar.cc>
Re: trailing conditional - apparently inconsistent synt <goldbb2@earthlink.net>
Re: trailing conditional - apparently inconsistent synt <uri@stemsystems.com>
Re: Two annoying Perl syntax issues (Malcolm Dew-Jones)
Re: Variation on iterating through a string <qumsieh@cim.mcgill.ca>
Re: Variation on iterating through a string (Anno Siegel)
Re: Variation on iterating through a string <pinyaj@rpi.edu>
Re: Why won't my for loop work? <abigail@abigail.nl>
Re: Why won't my for loop work? (Anno Siegel)
Re: Why won't my for loop work? <goldbb2@earthlink.net>
Re: Why won't my for loop work? <goldbb2@earthlink.net>
Re: XML parsing and array-context problem (Jesse Sheidlower)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 11 Feb 2003 14:22:16 -0600
From: Greg Jackson <Greg.Jackson@noaa.gov>
Subject: Perl 5.8 Module Win32 for Listening to Multicast UDP?
Message-Id: <b2bn2s$1jt$1@news.nems.noaa.gov>
I need to write a script that listens for UDP packets sent to a
multicast address. Is there a module that will work with Perl 5.8 and
Windows that will work?
Greg
------------------------------
Date: Tue, 11 Feb 2003 22:55:45 -0000
From: gort@LinxNet.com (Jim Seymour)
Subject: Perl+Tk+MySQL for Win32 that *works*?
Message-Id: <v4ivrhh0jurj27@corp.supernews.com>
I thought it might be interesting to experiment with the idea of
building some cross-platform, enterprise-style applications using
Perl, Perl/Tk and MySQL. So I haul out the ol' company laptop, boot
it into Win95 OSR2 and...
Install ActivePerl 5.8.0 build 805. The experimental Perl/Tk thing
I'd been fooling with worked. So...
"ppm install dbi" works
"ppm install dbd-mysql"
No such thing? Look around, find dbd-mysqlPP. Install that. Find
out I have to rename the driver (in my code) to "mysqlPP". *sigh*
There's a stroke of brilliance on somebody's part :(.
Okay, I can probably work-around that issue in my code. But the
program fails, complaining of something to do with "strings outside"
something-or-other. (Sorry, didn't write it down.)
Find out that DBD-Mysql *does* exist for 6xx builds. Remove the 805
build and install ActivePerl 5.6.1 build 635. Download the
"6xx-builds-only" DBI and DBD-Mysql zip files, unpack them and "ppm
install blurfl.ppd" for each. Ppm says they install. Try my code
again. Perl says there's no "mysql" DBD. Do a "ppm query." Yup,
there all right. Finally remove the DBD-Mysql module and try a
straight "ppm install DBD-mysql." Ppm says there ain't no such
thing.
Very frustrating day :/
<rant>
Of all the things I've installed on various flavours of *nix over the
years, Perl and the modules developed for it have been amongst the
most consistent in ease of build/install. If not *the* most reliable
and consistent. IIRC, out of all the builds and installs of Perl and
Perl modules I've done over the years, I've only *once* had one
fail. I had been *hoping* for a similar experience with Perl on
Windows. Tho, given my experience with Windows over the years,
perhaps I should've known better...
</rant>
The question is: is there a Perl distribution for Win32 (95, 98, ME,
NT4, 2k and XP) that *works*? Along with Perl/Tk, DBI and DBD-MySQL
modules that *work*? And would I be able to count on this stuff
being *actively* maintained/developed? Or should I give up on the
idea?
Regards,
Jim
--
Jim Seymour | PGP Public Key available at:
WARNING: The "From:" address | http://www.uk.pgp.net/pgpnet/pks-commands.html
is a spam trap. DON'T USE IT! |
Use: jseymour@LinxNet.com | http://jimsun.LinxNet.com
------------------------------
Date: 11 Feb 2003 13:12:55 -0800
From: toddboss@yahoo.com (Todd Boss)
Subject: PersistentPerl never resolves first time through
Message-Id: <3fddd6bb.0302111312.9749917@posting.google.com>
Hello.
we're using PersistentPerl (formerly known as SpeedyCGI) to help speed
up a large perl-based web app. Solaris box, Iplanet webserver,
connecting to an Oracle database via DBI::Oracle.
We're seeing two critical issues:
1. The first time a web browser connects to the website running
perperl, the browser never pulls the site up. You have to physically
hit the stop and reload buttons on the browser (doesn't matter what
browser) before the site comes up. After that things are fine. We
can repeat this process at will by touching the main perl program that
runs.
2. If there is a compilation error in the code ... the perperl process
can't ever load a page again ... we either have to kill the backend
processes or touch the main perl program to force the backends to
reload... which of course causes us the issue in point #1.
Does anyone have any insight into why this is happening? We've tried
setting timeout to Zero and then to a large number to no avail.
#!/usr/bin/perperl -X -- -M1 -t604800
is the perl interpreter line in the script.
thanks, todd
------------------------------
Date: Tue, 11 Feb 2003 14:10:22 -0700
From: "ColdCathoids" <mememe@meme.com>
Subject: Prompt to Save Locally
Message-Id: <b2bos1$1avot5$1@ID-158028.news.dfncis.de>
Thanks to everyone who has helped me so far! The assistance has been
invaluable!
Now onto my next problem.
I have a cgi script that screen scrapes a webpage and formats a table of
values into a csv. The next step is to prompt the user the contents of the
string/array as a csv locally on their computer. I want to avoid saving the
csv files on the server I googled for this but can't seem to find anything.
Anyone able to point me in the right direction?
------------------------------
Date: 11 Feb 2003 13:12:44 -0800
From: arnotoell@web.de (=?ISO-8859-1?Q?Arno_T=F6ll?=)
Subject: Raw Access to the Parallelport
Message-Id: <caf2b8c3.0302111312.3acc7e44@posting.google.com>
Hi there,
I've a problem: I want to access my parrallel port through Windows 9.x
(and/or Linux). I can access the port by doing
# requires Fcntl
sysopen("LPT", "LPT1", "O_RDWR") # or sysopen("LPT", "/dec/lp0",
"O_RDWR") under Linux
but, what now?
I want to write some bytes through the dataport, or get them through
the statusport. How to do that?
I just tried the Device::Parallelport module from CPAN, which does not
seem to work yet.
Thanks in advance.
------------------------------
Date: Tue, 11 Feb 2003 14:19:11 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Security bug in CGI::Lite::escape_dangerous_chars() function
Message-Id: <3E494CAF.A4730878@earthlink.net>
If you don't like the function -- don't use it. Use perl's builtin
quotemeta operator instead.
Also -- consider using the -T command-line option, to enable tainting.
In any case, anyone writing cgi programs really ought to read perldoc
perlsec, and make his own decisions about what's safe.
--
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"
------------------------------
Date: 11 Feb 2003 20:58:22 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: strict and warnings
Message-Id: <slrnb4iove.qnk.abigail@alexandra.abigail.nl>
Gunnar Hjalmarsson (noreply@gunnar.cc) wrote on MMMCDLI September
MCMXCIII in <URL:news:wQ32a.10539$LY2.628422@newsc.telia.net>:
() I'm wondering to which extent
()
() use strict;
() use warnings;
()
() add any overhead when compiling and executing a Perl program.
()
() They are indeed useful when *developing* a program, but should they
() always be left in a *production* copy?
Yes. Why? Because it saves time. I'm not a perfect coder, I do make
mistakes. I even make mistakes when I'm creating my test suite.
I don't expect to catch all bugs in the program during development.
When it's in production, I don't like reports of the form "the cron
job didn't work", or "the user clicked on 'buy' but the confirmation
email was never send". I very much prefer "the cron job didn't do
its work, but I got this warning mailed from cron" or "the user
clicked on 'buy' but the confirmation email was never send; this
what was written in the errorlog".
The only place warnings can turned off is in bugfree code.
Do you produce bugfree code?
() As regards 'use warnings;', I never leave it if portability is an issue
() (doesn't work in the earlier Perl5 versions), but sometimes I include
()
() $^W = 1;
()
() instead.
Or rather 'local $^W' when it's a module.
Abigail
--
perl -swleprint -- -_='Just another Perl Hacker'
------------------------------
Date: 11 Feb 2003 21:02:07 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: strict and warnings
Message-Id: <slrnb4ip6f.qnk.abigail@alexandra.abigail.nl>
Ben Kennedy (bkennedy@hmsonline.com) wrote on MMMCDLI September MCMXCIII
in <URL:news:75qcnUYhE8sRh9SjXTWcpg@giganews.com>:
``
`` "Gunnar Hjalmarsson" <noreply@gunnar.cc> wrote in message
`` news:wQ32a.10539$LY2.628422@newsc.telia.net...
`` > I'm wondering to which extent
`` >
`` > use strict;
`` > use warnings;
`` >
`` > add any overhead when compiling and executing a Perl program.
`` >
`` > They are indeed useful when *developing* a program, but should they
`` > always be left in a *production* copy?
``
`` This is really a more general question about optimization - to what extent
`` should I sacrifice maintainability in order to increase performance? In
`` this case, turning off 'strict' makes your code less maintainable - you need
`` some additional code that turns it off if necessary, which needs to be
`` documented, etc etc. I think it's very important to *not* optimize at the
`` expense of maintainability unless you have established benchmarks that
`` justify the change. My point is there is no general rule to answer your
`` question - you need to benchmark your code with both versions, and see if
`` performance upgrade justifies the maintainability downgrade. My best guess
`` is that unless your code needs to save microseconds on startup, you wont see
`` enough of a 'win' to justify removing them from production code.
If the microseconds on startup are that important, the question about
whether or not use warnings become irrelevant. The only question that
needs to be answered is who is to blame for decision to write the program
in Perl. It should have been written in C instead.
Abigail
--
@;=split//=>"Joel, Preach sartre knuth\n";$;=chr 65;%;=map{$;++=>$_}
0,22,13,16,5,14,21,1,23,11,2,7,12,6,8,15,3,19,24,14,10,20,18,17,4,25
;print@;[@;{A..Z}];
------------------------------
Date: Tue, 11 Feb 2003 21:28:57 GMT
From: Gunnar Hjalmarsson <noreply@gunnar.cc>
Subject: Re: strict and warnings
Message-Id: <tWd2a.10634$LY2.631198@newsc.telia.net>
Tassilo v. Parseval wrote:
> Warnings are again implemented via a bitmask that must
> internally be checked somehow. Perhaps you can try a benchmark,
> even though I am not sure whether this can be reliably done. My attempt:
> ...
> After several runs of the above I see that sometimes 'warn' is quicker,
> sometimes 'no_warn'.
Ben Kennedy wrote:
> there is no general rule to answer your
> question - you need to benchmark your code with both versions, and see if
> performance upgrade justifies the maintainability downgrade. My best guess
> is that unless your code needs to save microseconds on startup, you wont see
> enough of a 'win' to justify removing them from production code.
Abigail wrote:
> If the microseconds on startup are that important, the question about
> whether or not use warnings become irrelevant. The only question that
> needs to be answered is who is to blame for decision to write the program
> in Perl. It should have been written in C instead.
Thanks Tassilo, Ben and Abigail for your insight. I take it that,
besides *possible* exceptional cases, you don't need to worry about
leaving 'use warnings;' in production versions.
Tassilo v. Parseval wrote:
>>> Why not use the -w switch on the shebang-line?
>>
>> Well, my latest program is a module:
>> http://search.cpan.org/author/GUNNAR/
>
> In this case please remove the warnings altogether. A module isn't
> supposed to produce unexpected output at all. It's not very helpful for
> the user of your module, either. It'll rather confuse them.
Fortunately, in this case, there are no warnings to remove; neither
would the module give rise to any warnings if it was enabled. :) I just
mentioned it in response to your asking why not -w. After all, some CPAN
modules include 'use warnings;', and one of the reasons for bringing up
this subject was that I wondered if enabling warnings in the module
would be considered an improvement. Obviously you think I'd better
refrain from enabling it.
/ Gunnar
--
Gunnar Hjalmarsson
Email: http://www.gunnar.cc/cgi-bin/contact.pl
------------------------------
Date: Tue, 11 Feb 2003 14:20:09 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: trailing conditional - apparently inconsistent syntax rules
Message-Id: <3E494CE9.D27C83FC@earthlink.net>
squillion wrote:
[snip]
> i demand a refund.
Certainly -- of course, perl is free, so your refund is $0.
--
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"
------------------------------
Date: Tue, 11 Feb 2003 19:14:12 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: trailing conditional - apparently inconsistent syntax rules
Message-Id: <x7lm0maav0.fsf@mail.sysarch.com>
>>>>> "s" == squillion <squillion@hotmail.com> writes:
s> why can i say
s> print "x" if $x;
s> but not
s> if $x print "x";
s> why only in the latter case am i forced to enclose the conditional in
s> ()s and the block in {}s like so:
ok, let's see if you can understand some basic syntax issues. how would
you parse this:
if $foo == bar() - baz() + 3 ;
(i am sure others can come up with better ambiguous examples)
is that
if ( $foo == bar() { -baz() + 3 }
or
if ( $foo == bar() -baz() ) { + 3 }
you need some way to demark the conditional from the block.
the trailing statement modifiers can't be ambiguous since they are the
last part of a statement. that is also why there can't be more than one
per statement.
that covers why you need () for the conditional. the {} for the block is
not needed but is greatly appreciated. one of the ugliest parts of c
(IMO) is the fact that {} are not required. it leads to dangling
then/else clauses and makes it hard to match up the clauses with the
conditionals. if you change a single statement clause to multiple
statements when in a deeply nested if tree, you have to be very careful
where you add the {}. larry was very smart in requiring {} for all
blocks.
s> i demand a refund.
here it is:
print '$' x 0 ;
:)
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
----- Stem and Perl Development, Systems Architecture, Design and Coding ----
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
Damian Conway Perl Classes - January 2003 -- http://www.stemsystems.com/class
------------------------------
Date: 11 Feb 2003 12:57:30 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: Two annoying Perl syntax issues
Message-Id: <3e4963ba@news.victoria.tc.ca>
Abigail (abigail@abigail.nl) wrote:
: ixtahdoom (ixtahdoom@yahoo.com) wrote on MMMCDL September MCMXCIII in
: <URL:news:2aa9aa08.0302101007.43ca2924@posting.google.com>:
: !! Hi,
: !!
: !! Let's say I use a back-ticked fork, and want to remove the
: !! whitespace...
: !!
: !! my $data = `gzgrep -c 'stuff' $file`;
: !! $data = chomp $data;
: !!
: !! Again, how can I do this chomp during the assignment?
: chomp (my $data = `gzgrep -c 'stuff' $file`);
: But that's assuming you want to remove a trailing newline, instead
: of all the whitespace.
My mistake. I didn't read the sentence desciption carefully.
- all untested -
(my $data = `gzgrep -c 'stuff' $file`) = ~ s/your re here//;
with or without a /gm at the end of the s///
or perhaps
my @data = map {s/re//;$_} `gzgrep -c 'stuff' $file`;
or
my $data = join '' , map {s/re//;$_} `gzgrep -c 'stuff' $file`;
(Something like that, anyway)
------------------------------
Date: Tue, 11 Feb 2003 19:48:26 GMT
From: Ala Qumsieh <qumsieh@cim.mcgill.ca>
Subject: Re: Variation on iterating through a string
Message-Id: <Pine.LNX.4.44.0302111446530.13182-100000@chess.McRCIM.McGill.EDU>
On Tue, 11 Feb 2003, Benjamin Goldberg wrote:
> Matthew Lockner wrote:
> >
> > I'd like to request from the masters a slight variation on the
> > previous problem, of which I have occasionally found myself in need.
> >
> > A function, which takes a string as an argument, and returns a list of
> > the characters in that string (in order) - much like ML's explode
> > function.
> > Preferably in a "most idiomatic Perl" version, and a "Perl golf"
> > version.
> > The language being what it is, I find it hard to believe repeated
> > calls to substr are really the best way ("best" not necessarily being
> > "clearest").
>
> my @letters = split //, $string;
Well, he *did* mention Perl Golf:
my @letters = $string =~ /./g;
:)
--Ala
------------------------------
Date: 11 Feb 2003 20:29:41 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Variation on iterating through a string
Message-Id: <b2bmfl$m6i$1@mamenchi.zrz.TU-Berlin.DE>
Ala Qumsieh <qumsieh@cim.mcgill.ca> wrote in comp.lang.perl.misc:
> On Tue, 11 Feb 2003, Benjamin Goldberg wrote:
>
> > Matthew Lockner wrote:
> > >
> > > I'd like to request from the masters a slight variation on the
> > > previous problem, of which I have occasionally found myself in need.
> > >
> > > A function, which takes a string as an argument, and returns a list of
> > > the characters in that string (in order) - much like ML's explode
> > > function.
> > > Preferably in a "most idiomatic Perl" version, and a "Perl golf"
> > > version.
> > > The language being what it is, I find it hard to believe repeated
> > > calls to substr are really the best way ("best" not necessarily being
> > > "clearest").
> >
> > my @letters = split //, $string;
>
> Well, he *did* mention Perl Golf:
>
> my @letters = $string =~ /./g;
No match, golf-wise, but also worth a mention:
my @letters = unpack '(a)*', $string;
Anno
------------------------------
Date: Tue, 11 Feb 2003 17:13:47 -0500
From: Jeff 'japhy' Pinyan <pinyaj@rpi.edu>
Subject: Re: Variation on iterating through a string
Message-Id: <Pine.SGI.3.96.1030211171330.45862A-100000@vcmr-64.server.rpi.edu>
On Tue, 11 Feb 2003, Ala Qumsieh wrote:
>Well, he *did* mention Perl Golf:
>
> my @letters = $string =~ /./g;
Needs to be /./sg to match newlines as well.
--
Jeff Pinyan RPI Acacia Brother #734 2003 Rush Chairman
"And I vos head of Gestapo for ten | Michael Palin (as Heinrich Bimmler)
years. Ah! Five years! Nein! No! | in: The North Minehead Bye-Election
Oh. Was NOT head of Gestapo AT ALL!" | (Monty Python's Flying Circus)
------------------------------
Date: 11 Feb 2003 20:30:49 GMT
From: Abigail <abigail@abigail.nl>
Subject: Re: Why won't my for loop work?
Message-Id: <slrnb4inbp.qnk.abigail@alexandra.abigail.nl>
Karen Lofstrom (lofstrom@lava.net) wrote on MMMCDLI September MCMXCIII in
<URL:news:v4h4d2g47oqmbb@corp.supernews.com>:
$$
$$ I was using chop instead of chomp because my beginner's Perl book is old;
$$ 1996. Chomp must be new and improved. I supposed I should have bought a
$$ more recent intro book rather than borrowing an old one.
chomp() was new and improved in perl5, which was released in October 1994,
a year and a half after the first trial releases. The Camel-][ came out
in 1996, and that does document chomp().
You must have used a bad book.
Abigail
--
BEGIN {$^H {q} = sub {$_ [1] =~ y/S-ZA-IK-O/q-tc-fe-m/d; $_ [1]}; $^H = 0x28100}
print "Just another PYTHON hacker\n";
------------------------------
Date: 11 Feb 2003 21:11:22 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Why won't my for loop work?
Message-Id: <b2botq$njv$1@mamenchi.zrz.TU-Berlin.DE>
Abigail <abigail@abigail.nl> wrote in comp.lang.perl.misc:
[line folded]
> BEGIN {$^H {q} = sub {$_ [1] =~ y/S-ZA-IK-O/q-tc-fe-m/d; $_ [1]};
> $^H = 0x28100}
> print "Just another PYTHON hacker\n";
print 'Just', 'Java', "\n";
use overload '""' => sub { shift @{ shift()} };
BEGIN { $, = bless [ ( ' another ', "\b\b\b\bPerl hacker,")] }
Anno
------------------------------
Date: Tue, 11 Feb 2003 16:57:12 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Why won't my for loop work?
Message-Id: <3E4971B8.8EF8365B@earthlink.net>
Abigail wrote:
[snip]
> BEGIN {$^H {q} = sub {$_ [1] =~ y/S-ZA-IK-O/q-tc-fe-m/d; $_ [1]}; $^H = 0x28100}
> print "Just another PYTHON hacker\n";
Slightly different spacing can make it better looking:
BEGIN {*=="\cH"; $== 5<<15; $={q} = sub {
$_[1] =~ y/S-ZA-IK-O/q-tc-fe-m/d; $_[1]}}
print qq !Just another PYTHON hacker,\n!;
--
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"
------------------------------
Date: Tue, 11 Feb 2003 17:15:45 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Why won't my for loop work?
Message-Id: <3E497611.B9DA2A72@earthlink.net>
Anno Siegel wrote:
[snip]
> print 'Just', 'Java', "\n";
>
> use overload '""' => sub { shift @{ shift()} };
> BEGIN { $, = bless [ ( ' another ', "\b\b\b\bPerl hacker,")] }
With perl5.6.1, perl only does the magic stringification once, so this
produces:
Just another Java another
What version of perl did you test that on?
PS: If it did work.... it would be more obscure to not use the overload
module directly, but just do what it does.
print qw/Just Java/,"\n"; BEGIN{*{"()"}=\&nil; *{'('
.'""'} = sub{ shift @{+shift} }; ++$OVERLOAD{dummy};
$, = bless [q/ another /, qq/\b\b\b\bPerl hacker,/]}
__END__
--
"So, who beat the clueless idiot today?"
"Well, we flipped for it, but when Kuno
landed, he wasn't in any shape to fight."
"Next time, try flipping a *coin.*"
------------------------------
Date: 11 Feb 2003 15:31:07 -0500
From: jester@panix.com (Jesse Sheidlower)
Subject: Re: XML parsing and array-context problem
Message-Id: <b2bmib$q7o$1@panix2.panix.com>
In article <3E494B80.220C3F61@earthlink.net>,
Benjamin Goldberg <goldbb2@earthlink.net> wrote:
>
>
>Try this for speed:
>
> print "RealQuote is: ",
> ($q_node->findnodes("qt"))[0]->toString, "\n";
That was slightly faster at 1m22.9s, or about 1.5s faster
than the version that saved to $qt_node, and very slightly
faster than the looping version.
>Also, perhaps more importantly, try profiling your code, and seeing what
>parts of the code are slowing you down much. The difference between
>your two versions of code is a mere one percent ... not a significant
>difference, imho.
I agree that it's not really significant enough to bother with
(likewise for the not-$qt_node-version above) and I appreciate
Anno's comments in his message about looping being a fine way
to do this. I wanted to do the single-pass way because it's
conceptually smoother for me to see what's happening, and when
I add in some database-insertion code, it would be clearer to
see what's going on where.
I've tried profiling as much as I can, and I think I'm doing
reasonably well given my knowledge of Perl and my need for
things to be clear to me. The biggest difference was switching
from XML::XPath to XML::LibXML using XPath patterns--the
difference was huge, using XML::XPath on my sample, just doing
one or two steps, took 1m20s or so; the equivalent code using
XML::LibXML took just 2s.
Thanks again.
Jesse Sheidlower
------------------------------
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 4552
***************************************