[23116] in Perl-Users-Digest
Perl-Users Digest, Issue: 5337 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 9 00:06:09 2003
Date: Fri, 8 Aug 2003 21:05:06 -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 Fri, 8 Aug 2003 Volume: 10 Number: 5337
Today's topics:
"Undefined subroutine" error (but it's defined, I think valerian2@hotpop.com
Re: A simple doubt :-/ <REMOVEsdnCAPS@comcast.net>
Can't launch a perl HELP? <jrendant@comcast.net>
Re: Can't launch a perl HELP? <NOSPAM@bigpond.com>
Re: Find Files By Date <grazz@pobox.com>
Re: Getting PERL to return info from an external 'comma (Tad McClellan)
Re: help needed making unicode entities <flavell@mail.cern.ch>
Installing Modules on Win32 Machine (Again) (Jeff Mott)
Re: Installing Modules on Win32 Machine (Again) <kalinabears@iinet.net.au>
Little help with While loop please? (Allister)
Re: Print - format / presentation question <REMOVEsdnCAPS@comcast.net>
Re: Print - format / presentation question <matthew.garrish@sympatico.ca>
Re: Print - format / presentation question <REMOVEsdnCAPS@comcast.net>
Re: Return value of chomp, with alternate value in $/ <bubbajeb@charter.net>
Re: RFC: Benchmark with statistics <newspost@coppit.org>
Re: Win32-OLE excel cell reference. (Jay Tilton)
Re: <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 09 Aug 2003 01:49:16 GMT
From: valerian2@hotpop.com
Subject: "Undefined subroutine" error (but it's defined, I think?)
Message-Id: <slrnbj8koq.865.valerian@core.invalid.tld>
I have a program divided into 3 modules plus a main script, and some of
the modules call functions within other modules. Most of the time this
works fine, but occasionally I get an error like this:
> Undefined subroutine &My::Misc::DB_Disconnect called at My/Misc.pm line 18.
even though I made sure the caller (here Misc.pm) had imported all the
functions of the other module. Hence, I don't understand the reason
behind this error. I can get it to work fine by just replacing the
DB_Disconnect() call in Misc.pm with &My::Misc::DB_Disconnect(), but
that seems like a kludge, and I'd like to get a better understanding of
what's going on. :-)
Here's what happens when I run the program (under perl 5.6.1):
> $ ./test.pl
> Error: /dev/null is full!
> Disconnecting from DB...
> Undefined subroutine &My::Misc::DB_Disconnect called at My/Misc.pm line 18.
I isolated the problem to the "use My::SOAP;" line in DB.pm, but I need
it there because some of the DB functions operate on SOAP data. So I
left it there and poked around some more...
I then isolated the real problem to be the "use My::Misc;" line in
SOAP.pm, but again I need that line there, because the SOAP subs call
a general untainting function in Misc.pm before returning the data.
Here's the four files in question (I deleted everything but the bare
minimum to reproduce this behavior):
----- ~/test.pl ---------------------------------
#!/usr/bin/perl -w
use strict;
use My::DB;
use My::Misc;
my $dbh = DB_Connect();
SafeError($dbh, '/dev/null is full!');
----- ~/My/DB.pm --------------------------------
# Database functions
package My::DB;
use strict;
use Exporter;
use My::SOAP; # XXX this line causes the problem
use vars qw(@ISA @EXPORT);
@ISA = ('Exporter');
@EXPORT = qw(DB_Connect DB_Disconnect);
sub DB_Connect {
# stub function, always returns true
my $dbh = 1;
return ($dbh);
}
sub DB_Disconnect {
# stub function, always returns true
my ($dbh) = @_;
return (1);
}
1;
----- ~/My/Misc.pm ------------------------------
# Miscellaneous functions (error handling, logging, untainting, etc.)
package My::Misc;
use strict;
use Exporter;
use My::DB;
use vars qw(@ISA @EXPORT);
@ISA = ('Exporter');
@EXPORT = qw(SafeError);
sub SafeError {
my ($dbh, $msg) = @_;
print "Error: $msg\n";
if ($dbh) {
print "Disconnecting from DB...\n";
DB_Disconnect($dbh);
}
exit 1;
}
1;
----- ~/My/SOAP.pm ------------------------------
# SOAP functions, for exchanging data with remote site
package My::SOAP;
use strict;
use Exporter;
use My::Misc; # XXX this line causes the problem
use vars qw(@ISA @EXPORT);
@ISA = ('Exporter');
@EXPORT = qw(GetRemoteData);
sub GetRemoteData {
# stub function, always returns true
return (1);
}
1;
------------------------------
Date: Fri, 08 Aug 2003 19:17:21 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: A simple doubt :-/
Message-Id: <Xns93D1CE5DF5C32sdn.comcast@206.127.4.25>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
viijv@thedifferenZ.com (Vijoy Varghese) wrote in
news:4c08aaff.0308080858.470666b2@posting.google.com:
> The programs written in 'C' language *.c is compiled to *.obj and then
> linked to *.exe which is the 'machine language' substitute for our *.c
> program, right? Now for a processor to execute any program, the
> program should be coded in a language which the processor can
> understand, and here in our case the *.exe is such a language (or may
> be one level above the 'language processor can understand', and our
> Operating System does the translation work for the processor). So what
> ever it be, the *.exe is close to the language which the processor can
> understand.
>
> Now, a CGI program written in Perl, *.cgi there is no compilation or
> linking. That is each time we try to activate this program the Perl
> interpreter have to convert it to the *.exe format(or directly to hard
> core machine language of 0's and 1's?) and this process is repeated
> during all activation of the *.cgi script, right?
Yes, this is correct. Well, strictly speaking, the perl program reads the
script, then compiles it, then interprets the compiled code. (To be REALLY
technical, perl switches between compiling and running several times,
typically). BUT, conceptually you are correct.
> So this is a kind of overhead when a same script is activated some
> 1000 time in a minute, right?
Yes. It is a very serious overhead problem, and it makes it difficult to
run a perl CGI script 1000 times per minute.
> But still people are using Perl for CGI
> scripting, why? Yes, Perl is fun,
It's more than just "fun", it's much much easier to develop a full-blown
Perl program than a full-blown C program, and it can be done in a fraction
of the time.
> But still, why don’t some one make a
> 'Compiled Perl' with all features of current Perl, but which can be
> compiled to machine language, so that there is no need to 'translate'
> it each time its activated.
The problem with this is, as I mentioned before, perl switches between
compiling and running, sometimes frequently. The other problem is that
Perl's data structures are more complex than C's. Perl data structures
don't map onto registers and memory locations like C's. In order for
scalars, references, arrays, hashes, etc to work like they do in Perl, all
that code to handle those data structures would have to be built into
whatever compiled form you came up with -- and that's what perl already
does, internally.
> Or is there is already one available? I have heard a lot about
> 'mod_perl' and that it increases the speed of CGI scripts by some 100
> times. Is that have something to do with the 'compiled' version :-/
Not the way you're thinking. Used properly, mod_perl loads a Perl module
into memory, compiles it, and then keeps it loaded in memory. Thus,
programs that later refer to that module do not need to have it reloaded
and recompiled. This results in a significant speed improvement.
Another, simpler, way to achieve the same thing is with FastCGI. FastCGI
does the same sort of thing -- it has a mechanism for keeping programs in
memory to handle multiple requests, so they only need to be compiled once
and then may continue to handle requests sequentially. Again, this is a
significant speed improvement. I personally wrote a perl-based system
using FastCGI that was designed to handle a million hits per day, on a
single server. It is doable in perl.
> I am expecting a lot of '@#$#$%$@' replies, because I know this is not
> the way to ask questions in a group. But friends, this doubt... its
> hunting me for a long time, and i cant find a convincing answer
> anywhere. :-(
I don't think your question is off-topic or inappropriate for this group,
imho.
Hope this helps....
- --
Eric
$_ = reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBPzQ9hWPeouIeTNHoEQKYGQCfSV1LPuCmgNO6VpJ/00mZ65jjvI8AnRbz
SwsCZCkzDu0GiWG/v8ENH7FF
=ta78
-----END PGP SIGNATURE-----
------------------------------
Date: Fri, 8 Aug 2003 19:53:01 -0500
From: "Jim Rendant" <jrendant@comcast.net>
Subject: Can't launch a perl HELP?
Message-Id: <3NucnYpSQIjA2KmiXTWJiw@comcast.com>
I have created a table. The elements of the table are graphic images. I want
to be able to click on those images and launch either a new menu or a perl
script. The menus work fine. The perl scripts don't.
The perl scripts live in the cgi-bin directory. When I click on the image I
get told the file is not found. I have made sure the file exists and that it
has it's permissions set to 755.
I notice when I click on the picture the URL looks like
file://cgi-bin/file.pl not found. Am I to assume that the file.pl is going
to be displayed as text rather than executed?
Thanks
Jim Rendant
------------------------------
Date: Sat, 9 Aug 2003 11:42:33 +1000
From: "Gregory Toomey" <NOSPAM@bigpond.com>
Subject: Re: Can't launch a perl HELP?
Message-Id: <bh1jic$t7v9k$1@ID-202028.news.uni-berlin.de>
"Jim Rendant" <jrendant@comcast.net> wrote in message
news:3NucnYpSQIjA2KmiXTWJiw@comcast.com...
> I have created a table. The elements of the table are graphic images. I
want
> to be able to click on those images and launch either a new menu or a perl
> script. The menus work fine. The perl scripts don't.
>
> The perl scripts live in the cgi-bin directory. When I click on the image
I
> get told the file is not found. I have made sure the file exists and that
it
> has it's permissions set to 755.
>
> I notice when I click on the picture the URL looks like
> file://cgi-bin/file.pl not found. Am I to assume that the file.pl is going
> to be displayed as text rather than executed?
>
> Thanks
> Jim Rendant
Have a look here first:
http://www.kulichki.com/ostrova/bera/Manuals/Perl/idiots-guide.html
gtoomey
------------------------------
Date: Sat, 09 Aug 2003 02:36:36 GMT
From: Steve Grazzini <grazz@pobox.com>
Subject: Re: Find Files By Date
Message-Id: <U6ZYa.560$pn3.521@nwrdny01.gnilink.net>
Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> Steve Grazzini wrote:
> > Gunnar Hjalmarsson <noreply@gunnar.cc> wrote:
> >>A correction: OP asked about _creation_ date, which I for
> >>some inscrutable reason 'converted' to last modified date...
> >
> > Probably your subconscious was telling you: "There's no such
> > thing as 'creation date'".
>
> Maybe... :)
>
> But then I tested the output from stat() (with 5.8.0 on W98), and
> found that (stat()[10]) is a time notation before (stat()[9]), so I
> concluded that it actually shows creation time. Wasn't as clever as
> Martien, though, and studied perlport...
Yeah, me neither.
I did notice the new line in perlfunc/stat:
(*) The ctime field is non-portable, in particular you cannot
expect it to be a "creation time", see "Files and Filesystems"
in perlport for details.
But -- not heeding the "see perlport" -- I assumed it was good old
fashioned Unix advice about chmod() and chown() changing the ctime.
Now it looks like a reference to Win32 instead, with Windows in an
unaccustomed role:
[ Feature X ] is non-portable, in particular you cannot expect
[ Win32 semantics for X ], see perlport for details.
This almost implies that people *prefer* the behavior on Windows.
Apostasy! :-)
--
Steve
------------------------------
Date: Fri, 8 Aug 2003 18:56:52 -0500
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Getting PERL to return info from an external 'command'
Message-Id: <slrnbj8e64.43c.tadmc@magna.augustmail.com>
pete <pete@localho.st> wrote:
> open (IN, "< filename");
You should always, yes *always*, check the return value from open():
open (IN, "< filename") or die "could not open 'filename' $!";
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Fri, 8 Aug 2003 23:57:14 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: help needed making unicode entities
Message-Id: <Pine.LNX.4.53.0308082349090.24650@lxplus068.cern.ch>
On Fri, Aug 8, Dan Jacobson inscribed on the eternal scroll:
> Works! That was pleasant.
nice to hear ;-)
> Never did figure out how to move the :utf8 inside the program whilst
> maintaining the -ple. perldoc -f open doesn't enlighten.
AIUI your standard input and output are already open; to apply :utf8
semantics to an already-open filehandle you use the extended form of
binmode(). I'm not sure if that's really the answer to your question,
though.
> as a batch job (no mozilla)?
My mention of Mozilla was very much an aside - but if you want to
convert an HTML document from any known coding, into one using a
specific coding - say utf-8 - or using &#number; notations, then it's
quite a handy tool, it seems to me, thanks to its syntax-awareness.
But of course something like HTMLtidy, or SP, can do that too. Or XML
tools if you're using XHTML.
> Certainly there is a ready made solution?
As I say, I'm also learning this stuff as I go along, so even if there
*is* one, there's no guarantee I have it at my fingertips. And you
can see for yourself how many other regular contributors here get
involved when the word Unicode is mentioned. Rather few,
unfortunately (which makes me worry a bit...).
cheers
------------------------------
Date: 8 Aug 2003 17:24:18 -0700
From: mjeff1@twcny.rr.com (Jeff Mott)
Subject: Installing Modules on Win32 Machine (Again)
Message-Id: <970676ed.0308081624.752ee364@posting.google.com>
I realize this is a commonly asked question, but I still don't have it
working correctly. I downloaded and installed cygwin, and have
successfully built and installed several modules. However, for all XS
modules I am an error loading the DLL file.
perl -e "use Crypt::Rijndael;"
"Can't load '/usr/lib/perl5/site_perl/5.8.0/cygwin-multi-64int/auto/Crypt/Rijndael/Rijndael.dll'
for module Crypt::Rijndael: dlopen: Win32 error 193 at
/usr/lib/perl5/5.8.0/cygwin-multi-64int/DynaLoader.pm line 229. at -e
line 1
Compilation failed in require at -e line 1.
BEGIN failed--compilation aborted at -e line 1."
------------------------------
Date: Sat, 9 Aug 2003 11:00:06 +1000
From: "Sisyphus" <kalinabears@iinet.net.au>
Subject: Re: Installing Modules on Win32 Machine (Again)
Message-Id: <3f34489b$0$23615$5a62ac22@freenews.iinet.net.au>
"Jeff Mott" <mjeff1@twcny.rr.com> wrote in message
news:970676ed.0308081624.752ee364@posting.google.com...
> I realize this is a commonly asked question, but I still don't have it
> working correctly. I downloaded and installed cygwin, and have
> successfully built and installed several modules. However, for all XS
> modules I am an error loading the DLL file.
>
> perl -e "use Crypt::Rijndael;"
>
> "Can't load
'/usr/lib/perl5/site_perl/5.8.0/cygwin-multi-64int/auto/Crypt/Rijndael/Rijnd
ael.dll'
> for module Crypt::Rijndael: dlopen: Win32 error 193 at
> /usr/lib/perl5/5.8.0/cygwin-multi-64int/DynaLoader.pm line 229. at -e
> line 1
> Compilation failed in require at -e line 1.
> BEGIN failed--compilation aborted at -e line 1."
Maybe there's another dll needed that can't be found. (That would certainly
produce that error.) Does Crypt::Rijndael rely on OpenSSL ? ..... or on some
other non-perl software ?
In a native windows environment you'd get a pop-up telling you which dll had
not been located but, in a Cygwin environment, maybe that doesn't happen.
Cheers,
Rob
------------------------------
Date: 8 Aug 2003 20:46:31 -0700
From: allistah@hotmail.com (Allister)
Subject: Little help with While loop please?
Message-Id: <951fd107.0308081946.46d9d41f@posting.google.com>
I'm trying to take in a log file via stdin from my mail server. The
mail server will output anywhere from 5-11 lines in the log file per
message. I need to parse these lines looking for the first word of
FROM so I can get the senders email address. Then I need to walk a
few more lines down looking for BDAT or DATA to get the size of the
message where 3333 is the message size below. Then just output these
two out to STDOUT on the same line.
I've currently got a while (<>) {} loop to parse things one at a time,
but I can't figure out how to make it go down a few more lines looking
for the BDAT or DATA part without losing the information from the line
where I got the FROM data.
Here is a sample of the log I'm parsing:
date time ip1 fqdn ip2 EHLO +hotmail.com 250 0 314 16
date time ip1 fqdn ip2 MAIL +FROM:<1111111@hotmail.com> 0 0 45 32
date time ip1 fqdn ip2 RCPT +TO:<name@fqdn.org> 250 0 29 26
date time ip1 fqdn ip2 BDAT +<BAY2-F0122fa@hotmail.com> 250 0 79 3333
date time ip1 fqdn ip2 QUIT hotmail.com 240 6359 72 4
Does anyone have any example code or anything that I could look at to
do this? If I've left out any info, please let me know and I'll post
right away.
Thanks,
-Jaime
------------------------------
Date: Fri, 08 Aug 2003 18:12:44 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Print - format / presentation question
Message-Id: <Xns93D1C369A968Csdn.comcast@206.127.4.25>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
"Mothra" <mothra@nowhereatall.com> wrote in news:3f326806$1@usenet.ugs.com:
> [snipped]
>> print "*" x 10"\n"; doesnt work.
>>
> print "*" x10 . "\n";
Careful:
$ perl -le 'print "*"x10."\n"'
String found where operator expected at -e line 1, near "10."\n""
(Missing operator before "\n"?)
syntax error at -e line 1, near "10."\n""
Execution of -e aborted due to compilation errors.
- --
Eric
$_ = reverse sort qw p ekca lre Js reh ts
p, $/.r, map $_.$", qw e p h tona e; print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBPzQuYWPeouIeTNHoEQIDSQCgx6lt/s8F+KNxNQvFs6yQIATr/JMAoMig
62FX+XjzMl2FPD1fhmLGL1+Q
=H16C
-----END PGP SIGNATURE-----
------------------------------
Date: Fri, 8 Aug 2003 19:47:11 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: Print - format / presentation question
Message-Id: <eEWYa.7704$pq5.1094296@news20.bellglobal.com>
"Eric J. Roode" <REMOVEsdnCAPS@comcast.net> wrote in message
news:Xns93D1C369A968Csdn.comcast@206.127.4.25...
>
> Careful:
>
> $ perl -le 'print "*"x10."\n"'
> String found where operator expected at -e line 1, near "10."\n""
> (Missing operator before "\n"?)
> syntax error at -e line 1, near "10."\n""
> Execution of -e aborted due to compilation errors.
Are you just trying to show that you can screw up the syntax, or are you
forgetting about associativity?
perl -le 'print("*"x10)."\n"'
I'll assume you were trying to make the former point, but your observation
doesn't make his response wrong, and he never claimed that it would work as
you wrote it. Whichever the case, though, you should have explained better
than to say "careful" and shown the error.
Matt
------------------------------
Date: Fri, 08 Aug 2003 19:36:15 -0500
From: "Eric J. Roode" <REMOVEsdnCAPS@comcast.net>
Subject: Re: Print - format / presentation question
Message-Id: <Xns93D1D19239CA8sdn.comcast@206.127.4.25>
-----BEGIN xxx SIGNED MESSAGE-----
Hash: SHA1
"Matt Garrish" <matthew.garrish@sympatico.ca> wrote in
news:eEWYa.7704$pq5.1094296@news20.bellglobal.com:
>
> "Eric J. Roode" <REMOVEsdnCAPS@comcast.net> wrote in message
> news:Xns93D1C369A968Csdn.comcast@206.127.4.25...
>>
>> Careful:
>>
>> $ perl -le 'print "*"x10."\n"'
>> String found where operator expected at -e line 1, near "10."\n""
>> (Missing operator before "\n"?)
>> syntax error at -e line 1, near "10."\n""
>> Execution of -e aborted due to compilation errors.
>
> Are you just trying to show that you can screw up the syntax, or are
> you forgetting about associativity?
>
> perl -le 'print("*"x10)."\n"'
Are you just trying to show that you can misuse parentheses, or have you
forgotten the "if it looks like a function call, it is a function call"
rule?
> I'll assume you were trying to make the former point, but your
> observation doesn't make his response wrong, and he never claimed that
> it would work as you wrote it.
The way I wrote it was an exact copy, modulo whitespace, of what Mothra
posted. I happen to have respect for Mothra, based on his or her posts
here, which is why I didn't post a flame, and why I felt that nothing
more than "careful" plus an error dump was needed for Mothra to
understand that s/he should have known better than to post a quick
solution without making sure that it was correct.
However, I made the mistake of thinking that whitespace didn't matter to
Mothra's solution. It does. Not because of precedence, not because of
associativity, but because "10." is interpreted as a number, rather than
a number plus the concatenation operator. My mistake, not Mothra's; mea
culpa. But I didn't think that my mistake warranted a flame.
- --
Eric
$_ = reverse sort $ /. r , qw p ekca lre uJ reh
ts p , map $ _. $ " , qw e p h tona e and print
-----BEGIN xxx SIGNATURE-----
Version: PGPfreeware 7.0.3 for non-commercial use <http://www.pgp.com>
iQA/AwUBPzRB8WPeouIeTNHoEQKduQCg+THPa8sTZ0puBtlJ0J6WsHJ8imsAoIuf
3KWqgyDx/pe2UpejwcivLX4l
=AGte
-----END PGP SIGNATURE-----
------------------------------
Date: Fri, 8 Aug 2003 23:18:04 -0400
From: <bubbajeb@charter.net>
Subject: Re: Return value of chomp, with alternate value in $/
Message-Id: <vj8pve440sgl1a@corp.supernews.com>
Try this
#!C:\Perl\bin\perl
use strict;
use warnings;
my $cnt=0;
my $test_string = "AAABBBCCC";
$/ = "C";
foreach $_ (1..4) {
$cnt=$cnt+chomp($test_string ); }
print "Cnt=$cnt\n" ;
print "test_string=$test_string\n";
"David Oswald" <spamblock@junkmail.com> wrote in message
news:vj6llghhb5pp6b@corp.supernews.com...
> It is my understanding that $/ contains the value that is considered to be
a
> newline character. I also understand that chomp removes as many newlines
at
> the end of a string as exist, and returns the number removed.
>
> Therefore, I expect that the following code snippet should print 3. When
I
> test it, the output is 1.
>
> use strict;
> use warnings;
> my $test_string = "AAABBBCCC";
> $/ = "C";
> print chomp ( $test_string ) , "\n" ;
>
> I have used parenthesis to ensure that chomp is in scalar mode, not list
> mode.
>
> Programming Perl states that chomp returns the number of characters
chomped.
> Based on the above example, with three "C's", I expect chomp to return
> three.
>
> The common mantra is that Perl does only what one asks it to do. In that
> context there obviously is a discrepancy between what I'm asking, and what
> I'm expecting to be the results. If anyone could point out the flaw in my
> thinking, I'd really appreciate it.
>
> By the way, I'm aware it's ugly, abusive of the intended use of chomp and
> $/, and so on. This is for my own learning process, not production code.
>
> --
> DJO
>
>
------------------------------
Date: Fri, 08 Aug 2003 23:59:54 GMT
From: David Coppit <newspost@coppit.org>
Subject: Re: RFC: Benchmark with statistics
Message-Id: <Pine.BSF.4.56.0308081942420.16665@www.provisio.net>
Here's a little analysis of Benchmark::Statistical using this program:
use lib 'lib';
use Benchmark::Statistical qw( timethesestat );
$res = timethesestat(30,{'system' => 'system("ls >/dev/null")',
'backtick' => '`ls >/dev/null`'}, 97.5, 1);
I enabled the debug statement inside the main loop and got this:
Benchmark: running backtick, system...
Average speed: 115.56 +/- 113.12, Samples: 2
Average speed: 114.07 +/- 18.39, Samples: 3
Average speed: 115.56 +/- 10.72, Samples: 4
Average speed: 114.67 +/- 7.61, Samples: 5
Average speed: 113.41 +/- 6.88, Samples: 6
Average speed: 113.69 +/- 5.52, Samples: 7
Average speed: 115.11 +/- 6.09, Samples: 8
Average speed: 114.66 +/- 5.34, Samples: 9
...
Average speed: 112.62 +/- 1.14, Samples: 108
Average speed: 112.65 +/- 1.13, Samples: 109
Average speed: 112.53 +/- 1.15, Samples: 110
Average speed: 112.56 +/- 1.14, Samples: 111
Average speed: 112.51 +/- 1.14, Samples: 112
Average speed: 112.50 +/- 1.13, Samples: 113
Average speed: 112.48 +/- 1.12, Samples: 114
It does converge, but it takes a long time. Choosing the size of the batches
makes a big difference. If I increase the iterations to 100, each step takes
longer but overall it's faster because it only takes 15 steps to converge.
This is because the data is less widely distributed.
This makes me wonder if some sort of adaptive algorithm for the iteration size
might be best. Unfortunately implementing this would not be easy for me.
Instead I'm going to check out one of the Time::HiRes-based benchmark modules.
If I can get better accuracy, it may be possible to get rid of the batches
entirely.
David
------------------------------
Date: Fri, 08 Aug 2003 23:55:39 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Win32-OLE excel cell reference.
Message-Id: <3f34380a.68718402@news.erols.com>
"Richard S Beckett" <spikey-wan@bigfoot.com> wrote:
: I'm struggling with the syntax to point to the cells that I want to use in
: Excel.
:
: It seems that the Range command likes data like (A14), or (A14:B26), and I
: am happy with this.
:
: My problem occurrs when I only have numeric data to work with, because of
: incremented counters, or Count commands.
:
: I have had success with Cells(1,14), but I cannot for the life of me work
: out how to reference an area of cells like this...
:
: Cells(1,14:5,28)
It's more of a question about the Excel object library than about
Perl.
The Range() property can accept two Range objects for its arguments.
"Cells(1,14)" and "Cells(5,28)" would return two such Range objects.
Written in Excel VBA, it would go like
Range( Cells(1,14), Cells(5,28) ).some_method
Written in Perl, it would go like
$worksheet->Range(
$worksheet->Cells(1,14),
$worksheet->Cells(5,28)
)->some_method ;
------------------------------
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 5337
***************************************