[18450] in Perl-Users-Digest
Perl-Users Digest, Issue: 618 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Apr 3 14:13:57 2001
Date: Tue, 3 Apr 2001 11:10:25 -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: <986321424-v10-i618@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 3 Apr 2001 Volume: 10 Number: 618
Today's topics:
Re: Please Flame my Benchmark: open vs. cat (Abigail)
Re: Please Flame my Benchmark: open vs. cat <revjack@revjack.net>
Re: Please Flame my Benchmark: open vs. cat <uri@sysarch.com>
Re: Please Flame my Benchmark: open vs. cat (Monte)
Problem executing a CGI script <jlombana@ts.es>
Re: Problem executing a CGI script <gtoomey@usa.net>
Re: Problem executing a CGI script <cernava@itexas.net>
Re: Regular exasperation <nospam@nospam.com>
Re: Regular exasperation <nospam@nospam.com>
Re: simultaneously open file handles -- limit? <plz@righthere.com>
Re: SMTP Connections nobull@mail.com
Re: Sorts on first six columns only <Lance Hoffmeyer <vibrato@deja.com>>
Re: Sorts on first six columns only (Jay Tilton)
Re: Sorts on first six columns only (Tad McClellan)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 3 Apr 2001 14:45:29 +0000 (UTC)
From: abigail@foad.org (Abigail)
Subject: Re: Please Flame my Benchmark: open vs. cat
Message-Id: <slrn9cjog9.nah.abigail@tsathoggua.rlyeh.net>
revjack (revjack@revjack.net) wrote on MMDCCLXXII September MCMXCIII in
<URL:news:9accfp$apq$1@news1.Radix.Net>:
.. Uri Guttman <uri@sysarch.com> wrote:
.. :>>>>> "r" == revjack <revjack@revjack.net> writes:
..
.. : r> In order to demonstrate to my cow orkers that open() is a
.. : r> wiser choice than `cat`, I ran this benchmark:
..
.. : r> #!/usr/bin/perl
.. : r> use Benchmark;
.. : r> $count = 10_000;
.. : r> timethese($count, {
.. : r> 'cat' => '$foo = `cat temp.txt`',
.. : r> 'open' => 'local $/; open IN, "<temp.txt"; $foo = <IN>; close IN',
.. : r> });
..
..
.. : looks like a fair benchmark to me. they both do the exact same function
.. : of slurping a file into a scalar. what more would you need to add to it?
..
.. Thanks for the feedback.
..
.. : and what are your results? i know which one will win and i want to see
.. : the look on the orker's face when he sees the results.
..
.. Benchmark: timing 10000 iterations of cat, open...
.. cat: 131 wallclock secs ( 2.38 usr 18.87 sys + 27.25 cusr 77.51 csys = 0.00 CPU)
.. open: 2 wallclock secs ( 0.49 usr + 0.82 sys = 1.31
..
.. Sun Enterprise 450, 2 processors @ 466MHz, Solaris 5.6
.. perl 5.005_02
I find the Benchmark not very useful. One doesn't repeatedly read the same
file over and over again in a typical program.
Furthermore, you are banchmarking the repeat read of a single file. A good
Benchmark would bench a whole range of file sizes, from small to large.
And preferably, read in different files - now you just might be lucky
that in one case the file keeps being cached in RAM, and in the other
case it doesn't. (Solaris thinks that unused RAM is wasted RAM, so it
uses RAM as a cache. If you read a file once, disk access is likely
to dwarf the overhead of an extra process. But now, most of the time,
you read from the file cache - not a good test.)
Abigail
--
:$:=~s:$":Just$&another$&:;$:=~s:
:Perl$"Hacker$&:;chop$:;print$:#:
------------------------------
Date: 3 Apr 2001 15:22:49 GMT
From: revjack <revjack@revjack.net>
Subject: Re: Please Flame my Benchmark: open vs. cat
Message-Id: <9acps9$hlt$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Abigail <abigail@foad.org> wrote:
: Benchmark would bench a whole range of file sizes, from small to large.
: And preferably, read in different files - now you just might be lucky
: that in one case the file keeps being cached in RAM, and in the other
: case it doesn't. (Solaris thinks that unused RAM is wasted RAM, so it
: uses RAM as a cache. If you read a file once, disk access is likely
: to dwarf the overhead of an extra process. But now, most of the time,
: you read from the file cache - not a good test.)
How would you do it?
--
___________________
revjack@revjack.net
------------------------------
Date: Tue, 03 Apr 2001 16:55:31 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Please Flame my Benchmark: open vs. cat
Message-Id: <x78zlhvs70.fsf@home.sysarch.com>
>>>>> "A" == Abigail <abigail@foad.org> writes:
A> I find the Benchmark not very useful. One doesn't repeatedly read
A> the same file over and over again in a typical program.
A> Furthermore, you are banchmarking the repeat read of a single
A> file. A good Benchmark would bench a whole range of file sizes,
A> from small to large. And preferably, read in different files - now
A> you just might be lucky that in one case the file keeps being
A> cached in RAM, and in the other case it doesn't. (Solaris thinks
A> that unused RAM is wasted RAM, so it uses RAM as a cache. If you
A> read a file once, disk access is likely to dwarf the overhead of an
A> extra process. But now, most of the time, you read from the file
A> cache - not a good test.)
i disagree. the repeated reading means the file will almost assuredly be
in cache the entire time so the disk access part is removed. then you
are comparing the overhead of the fork/exec of `cat` to the speed of
open. the rest is irrelevent. the bencmark isolates the real difference
between the two methods and leave the disk and other stuff outside.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 03 Apr 2001 16:54:25 GMT
From: montep@about.com (Monte)
Subject: Re: Please Flame my Benchmark: open vs. cat
Message-Id: <3ac9ffc0.6457355@news.hal-pc.org>
On Tue, 3 Apr 2001 14:45:29 +0000 (UTC), abigail@foad.org (Abigail)
wrote:
<snip>
>I find the Benchmark not very useful. One doesn't repeatedly read the same
>file over and over again in a typical program.
>
>Furthermore, you are banchmarking the repeat read of a single file. A good
>Benchmark would bench a whole range of file sizes, from small to large.
>And preferably, read in different files - now you just might be lucky
>that in one case the file keeps being cached in RAM, and in the other
>case it doesn't. (Solaris thinks that unused RAM is wasted RAM, so it
>uses RAM as a cache. If you read a file once, disk access is likely
>to dwarf the overhead of an extra process. But now, most of the time,
>you read from the file cache - not a good test.)
>Abigail
So, Abigail, rather than just nit-picking the issue why not right a
benchmark program yourself and specify the parameters of use. As it
stands revjacks little utility is better than any other so far
submitted on this thread.
if your gonna spam.....
admin@loopback, $LOGIN@localhost, $LOGNAME@localhost, $USER@localhost, $USER@$HOST, -h1024@localhost, root@mailloop.com root@localhost, postmaster@localhost, admin@localhost, abuse@localhost Chairman Reed Hundt: rhundt@fcc.gov Commissioner James Quello: jquello@fcc.gov Commissioner Susan Ness: sness@fcc.gov Commissioner Rachelle Chong: rchong@fcc.gov US Postal Service: customer@email.usps.gov Fraud Watch: fraudinfo@psinet.com Pyramid Schemes: pyramid@ftc.gov Federal Trade Commission: consumerline@ftc.gov net-abuse@nocs.insp.irs.gov
------------------------------
Date: Tue, 3 Apr 2001 16:49:24 +0200
From: "José Luis Lombana Aramendía" <jlombana@ts.es>
Subject: Problem executing a CGI script
Message-Id: <9acn2b$doo$1@talia.mad.ttd.net>
Hello,
I´m trying to execute a CGI script, but i'm having several problems:
If I execute
#!/usr/local/bin/perl
print "Content-type: text/html\n\n";
print "<html><head><title>hello world</title></head><body>Hello
world!</body></html>";
1;
everything works OK, but if I execute
#!/usr/local/bin/perl
require "headers.pl";
print "Content-type: text/html\n\n";
print "<html><head><title>hello world</title></head><body>Hello
world!</body></html>";
1;
the server shows the following error
500 Server Error
The server encountered an internal error or misconfiguration and was unable
to complete your
request.
Please contact the server administrator, www@xx.xx.es and inform them of the
time the
error occurred , and anything you might have done that may have caused the
error.
Error: HTTPd: malformed header from script
What's wrong?. Thanks in advance
--
----------------------------------------------------------------------------
-------------
José Luis Lombana Aramendía jlombana@ts.es
Telefónica Sistemas
C/. Sor Ángela de la Cruz 3, 6ª planta
28020 MADRID
----------------------------------------------------------------------------
-------------
------------------------------
Date: Wed, 4 Apr 2001 01:42:59 +1000
From: "Gregory Toomey" <gtoomey@usa.net>
Subject: Re: Problem executing a CGI script
Message-Id: <f%ly6.8511$45.47909@newsfeeds.bigpond.com>
You probably cant read headers.pl. Assuming you are running Unix...
1. Your web server may have have put you in the wrong directory. Run the
following script and check you are in the right directory:
#!/usr/local/bin/perl
use Cwd;
print "Content-type: text/html\n\n";
print "Directory is".getcwd;
open(OUTFILE,"/tmp/xx");
close(OUTFILE);
2. The web server could be running the script as the wrong user ( see Q50 in
http://www.w3.org/Security/Faq/wwwsf5.html ).
In the Unix shell type 'ls -l /tmp/xx'. Is this file owned by you? If not,
you may have to run setuid.
gtooomey
--------------
"José Luis Lombana Aramendía" <jlombana@ts.es> wrote in message
news:9acn2b$doo$1@talia.mad.ttd.net...
> Hello,
>
> everything works OK, but if I execute
>
> #!/usr/local/bin/perl
>
> require "headers.pl";
>
> print "Content-type: text/html\n\n";
>
> print "<html><head><title>hello world</title></head><body>Hello
> world!</body></html>";
>
> 1;
>
> the server shows the following error
>
> 500 Server Error
------------------------------
Date: Tue, 3 Apr 2001 11:33:39 -0500
From: "Itexas" <cernava@itexas.net>
Subject: Re: Problem executing a CGI script
Message-Id: <9acu1d02rn7@enews3.newsguy.com>
try running it in an eval. Also try it out in the shell. It sounds like perl
isn't finding header.pl
#!/usr/local/bin/perl
eval
{
require "headers.pl";
};
print "Content-type: text/html\n\nError: $@" if $@;
print "Content-type: text/html\n\n";
print "<html><head><title>hello world</title></head><body>Hello
world!</body></html>";
1;
------------------------------
Date: 3 Apr 2001 12:22:21 -0600
From: "William D. Ezell" <nospam@nospam.com>
To: Mark Jason Dominus <mjd@plover.com>
Subject: Re: Regular exasperation
Message-Id: <3ACA0628.8729C5FA@nospam.com>
Mark Jason Dominus wrote:
> But you also send out private email with your bogus address, which
> makes no sense at all, unless you're expecting the people with whom
> you have personal correspondence to start spamming you.
That's because I've been too lazy to find a mail/USENET solution other
than Netscape Communicator (even though the Linux versions are
horrible). Unless I'm missing something, the
'Edit|Preferences|Identity' affects both e-mail and USENET, like it or
not. Yes, it's a pain for e-mail correspondence but an unfortunate
necessary evil so long as UCE/Spam is accepted.
My appologies for any inconvenience as your response and direction was
greatly appreciated.
Bill
****** To reply, remove the "~" from "wd~ezell@snowhill.com" ******
------------------------------
Date: 3 Apr 2001 12:33:10 -0600
From: "William D. Ezell" <nospam@nospam.com>
To: Steve van der Burg <steve.vanderburg@lhsc.on.ca>
Subject: Re: Regular exasperation
Message-Id: <3ACA08B4.9D65A164@nospam.com>
Thanks for the reply. I've downloaded the module and will give it a
look tonight. Sounds like a much better approach.
Bill
****** To reply, remove the "~" from "wd~ezell@snowhill.com" ******
------------------------------
Date: Tue, 3 Apr 2001 09:44:58 -0700
From: "B McDonald" <plz@righthere.com>
Subject: Re: simultaneously open file handles -- limit?
Message-Id: <H7ny6.17$c21.16310@news.pacbell.net>
"Garry Williams" <garry@ifr.zvolve.net> wrote in message
news:slrn9cipir.sbk.garry@zfw.zvolve.net...
> > I have a script that processes XML files
> > and generates a number of CSV output files for bulk load into SQL 7. I
was
> > generating 10 of these "slurp" files, but then, when I added two new
files
> > to the total, file 12 was not getting written to... and it looked as if
some
> > data was not getting written to other files as well.
>
> Why guess? Enable warnings and check the result of open() and print
> $! on errors. It's a *very* good idea to check the result of close()
> on output files. You can learn about disk space shortages that way.
> :-)
Curiously enough, I do enable warnings and check the results of each open()
and close() -- still I get no indication that there's been a problem. I've
noticed this before on other errors, but don't know what the secret is to
getting them to be reported under Windows.
> > I've checked the ActivePerl (5.6.0.613 under Win98) documentation and
don't
> > see any info on the max number of files that may be simultaneously open
for
> > writing. Does anyone have any information/experience on this?
>
> I guess that the issue is really an operating system question.
Right. Well, Wayne has suggested that I check out FileCache. It's got a
function, cacheout, that will apparently manage the open file descriptors
for you: closing and reopening them so that the system limit is not
exceeded. I find it very interesting, however, that I could not find one
post on FileCache or cacheout when I searched at Deja-GooGoo (my pet name
for Google's transitional Deja site). Not that I don't know what to do with
it, just that I was curious if other people had the same problem as I.
>You
> might find more information about it in a more appropriate news group
> for that sort of thing. Heck, it might be in the manual. I know it
> is on my system:
>
> $ man ulimit
> $ man sysdef
> $ sysdef
> ...
> *
> * Process Resource Limit Tunables (Current:Maximum)
> *
> ...
> 0x00000040:0x0000186a file descriptors
>
> So it's 64 on my system, although there are ways to increase that to
> as many as 6,250. I don't have a clue what your system's limit is,
> though. Sorry.
>
> --
> Garry Williams
>
------------------------------
Date: 03 Apr 2001 18:00:52 +0100
From: nobull@mail.com
Subject: Re: SMTP Connections
Message-Id: <u9y9thsyt7.fsf@wcl-l.bham.ac.uk>
Please quoute _relevant_ parts of the message two which you are
responding _in_ context. Quoting the whole of the message you are
responding to at the end of your messages is considered very rude. Do
you want to be considered very rude?
Me <moiraine@qwest.net> writes:
> Yes, but what's a good way to recieve and store mail in $user_mailbox without
> having the user be listed under /etc/passwd.
This is an MTA configuration question - it has nothing to do with Perl.
Please see books/newsgroups/websites relating to your MTA.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Tue, 03 Apr 2001 08:27:59 -0500
From: "Lance Hoffmeyer" <Lance Hoffmeyer <vibrato@deja.com>>
Subject: Re: Sorts on first six columns only
Message-Id: <Cbky6.23357$BC6.6379302@e3500-chi1.usenetserver.com>
It is correct that I am using fixed ASCII data that is right justified.
Unfortunately, I am in Win95 and do not have access to sort (or at least
with the sort I downloaded and try to use it locks up the machine). That
is why I am trying to find a Perl solution using Perl's sort function or
something similar.
Lance
In article <slrn9cf3j7.rs9.garry@zfw.zvolve.net>, garry@ifr.zvolve.net
(Garry Williams) wrote:
> On Sun, 1 Apr 2001 20:06:32 +0000 (UTC), Abigail <abigail@foad.org>
> wrote:
>> Garry Williams (garry@ifr.zvolve.net) wrote on MMDCCLXX September
>> MCMXCIII in <URL:news:slrn9cen8s.rqb.garry@zfw.zvolve.net>:
>> ## On Sun, 01 Apr 2001 16:11:18 GMT, John Joseph Trammell
>> ## <trammell@bayazid.hypersloth.invalid> wrote:
>> ##
>> ## > On Sun, 01 Apr 2001 10:53:49 -0500, Lance Hoffmeyer wrote:
>> ## >> Can someone explain how one might sort an ASCII file with 3000
>> ## >> columns on only the first 6 columns which have a unique ID
>> number?
>> ## >
>> ## > % cat filename | sort -n
>> ##
>> ## Setting aside the useless use of cat, how does that answer the
>> ## question?
>>
>> It takes a file, it sorts it numerically. How does that *not* answer
>> the question?
>
> I guess that depends on what a "column" means to the OP.
>
> $ cat > file
> 40 256
> 1 500
> 40 1000
> $ sort -n file
> 1 500
> 40 1000
> 40 256
> $
>
> I have to admit that it would work *if* columns were fixed length (and
> numbers were right justified).
>
------------------------------
Date: Tue, 03 Apr 2001 14:28:23 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: Sorts on first six columns only
Message-Id: <3ac9daaf.43814501@news.erols.com>
On Tue, 03 Apr 2001 08:27:59 -0500, "Lance Hoffmeyer" <Lance Hoffmeyer
<vibrato@deja.com>> wrote:
>It is correct that I am using fixed ASCII data that is right justified.
>Unfortunately, I am in Win95 and do not have access to sort (or at least
>with the sort I downloaded and try to use it locks up the machine).
SORT.EXE should exist in C:\WINDOWS\COMMAND
It's been a standard part of MSDOS and Windows distributions forever.
------------------------------
Date: Tue, 03 Apr 2001 16:51:16 GMT
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Sorts on first six columns only
Message-Id: <slrn9cjrva.dcf.tadmc@tadmc26.august.net>
Lance Hoffmeyer <LanceHoffmeyer<vibrato@deja.com> wrote:
>Unfortunately, I am in Win95
That is unfortunate indeed.
>and do not have access to sort (or at least
>with the sort I downloaded and try to use it locks up the machine).
Did you try the sort(1) from the Perl Power Tools project yet?
http://language.perl.com/ppt/
[ snip 40 lines of Jeopardy quoted text ]
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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 618
**************************************