[18464] in Perl-Users-Digest
Perl-Users Digest, Issue: 632 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 4 21:05:43 2001
Date: Wed, 4 Apr 2001 18:05:14 -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: <986432714-v10-i632@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 4 Apr 2001 Volume: 10 Number: 632
Today's topics:
Re: 'system' in perl script <ren@tivoli.com>
array and hash presentation as text <nashif@planux.com>
Re: array and hash presentation as text (Tad McClellan)
Re: Bulk renaming files <chrisw+usenet@dynamite.com.au>
CGI Form to Generated Table <timsutton@mail.com>
CGI Form to Table <timsutton@mail.com>
CGI vs. embperl vs. Mason or CGI/emperl/mason <moiraine{NOSPAM}@qwest.net>
Re: Deleting one line from a file <david_j_findlay@yahoo.com.au>
Re: Deleting one line from a file (Tad McClellan)
Does this newsgroup have an FAQ? <pgroves@ntlworld.com>
Re: Does this newsgroup have an FAQ? <jdhunter@nitace.bsd.uchicago.edu>
Re: Does this newsgroup have an FAQ? (Paul Tomblin)
Getting hostname <shino_korah@yahoo.com>
Re: How do I get html from a website? <todd@designsouth.net>
Re: How do I get html from a website? <tony_curtis32@yahoo.com>
Installing Perl On Solaris(source-files) <milliwave@rfengineering.freeserve.co.uk>
Re: lines with headers (Jay Tilton)
Re: Multiple email send?vvp <tlav1@mediaone.net>
NET::TELNET <a246456@fmr.com>
OOP Question <variant@shell.pacifier.com>
PERL ACCESS TO ORACLE <plusc@freeserve.net>
Re: PERL ACCESS TO ORACLE <bcoon@sequenom.com>
Perl training courses in the UK? <pgroves@ntlworld.com>
Re: Perl training courses in the UK? (The Mosquito ScriptKiddiot)
PerlMagick install woes <bcoon@sequenom.com>
Re: Please Flame my Benchmark: open vs. cat <ren@tivoli.com>
Re: Please Flame my Benchmark: open vs. cat (Dave Bailey)
Re: what are the new languages? <mitiaNOSPAM@northwestern.edu.invalid>
Re: What level of Perl needed for my system() call to w <ren@tivoli.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 04 Apr 2001 16:13:34 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: 'system' in perl script
Message-Id: <m3hf04fjwh.fsf@dhcp9-175.support.tivoli.com>
On Wed, 04 Apr 2001, bing-du@tamu.edu wrote:
> #!/usr/local/bin/perl
>
> $file = 'test';
> open(F,">$file");
> print F "for testing\n";
close F;
> system("cat $file|mailx -s 'test only' bing-du\@tamu.edu");
Odds are that you need to flush the output before calling system. One
way is to simply close the file as I did above.
Depending on your exact need, an alternative way to do this is to open
the pipe to mailx directly:
#!/usr/local/bin/perl
open MAIL, "|mailx -s 'test only' bing-du\@tamu.edu"
or die "Could not fork: $!";
print MAIL "for testing\n";
close MAIL or die "Problem with mailx: $!";
__END__
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 04 Apr 2001 23:54:20 GMT
From: Anas Nashif <nashif@planux.com>
Subject: array and hash presentation as text
Message-Id: <MuOy6.601152$JT5.16487182@news20.bellglobal.com>
Hi,
If $[] defines a hash and [] defines an array, how can I parse such a text
structure into one perl variable:
$["key1":"value1","key2":[1,2,3,4]]
or
[[[1,2],3,4,5],6,7,8]
Any Idea?
The result should be in case 1 a hash of values and arrays.
The second is an array of arrays....
Anas
------------------------------
Date: Wed, 4 Apr 2001 20:02:37 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: array and hash presentation as text
Message-Id: <slrn9cndgt.hdl.tadmc@tadmc26.august.net>
Anas Nashif <nashif@planux.com> wrote:
>
> If $[] defines a hash and [] defines an array, how can I parse
Parsing is most easily done when you work from a grammar for
the language being parsed.
Do you have the grammar for your data definition language?
Doesn't look like it would be hard to reverse engineer it, but
it would put me over my 3 minutes/post time limit...
> such a text
> structure into one perl variable:
>
> $["key1":"value1","key2":[1,2,3,4]]
That could be made into Perl code for a anon hash rather easily.
> or
>
> [[[1,2],3,4,5],6,7,8]
That already _is_ Perl code for an anon array.
> Any Idea?
perldoc -f eval
> The result should be in case 1 a hash of values and arrays.
> The second is an array of arrays....
Here is a dirty hack that is rather fragile (breaks if there are
colons in the strings for instance).
------------------------
#!/usr/bin/perl -w
use strict;
use Data::Dumper;
while (<DATA>) {
chomp;
my $ref; # ref to array or hash
if ( s/^\$\[(.*)\]$/{$1}/ ) { # hash
s/:/=>/g; # fat commas
$ref = eval $_;
}
elsif ( /^\[.*\]$/ ) { # array
$ref = eval $_;
}
else {
warn "'$_' is invalid\n";
}
print Dumper($ref), "\n";
}
__DATA__
$["key1":"value1","key2":[1,2,3,4]]
[[[1,2],3,4,5],6,7,8]
------------------------
If you want a robust solution, do a real parse for the language's
grammar.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 5 Apr 2001 09:49:47 +1000
From: "Chris W" <chrisw+usenet@dynamite.com.au>
Subject: Re: Bulk renaming files
Message-Id: <7tOy6.34$o47.45101@news.interact.net.au>
"Lou Moran" <lmoran@wtsg.com> wrote in message
news:c1rmctk6a7oum36a2s85n3mssmmie01465@4ax.com...
> big fan here no-bull... I wanted to auto increment the whole time (see
> above)
You'll need to split the filename from the extension.
#!perl
use strict;
use warnings;
my $fname_root = 'somename000';
my $fname_ext = '.doc';
for (my $i=0; $i<20; $i++) {
print $fname_root++, $fname_ext, "\n";
}
------------------------------
Date: Wed, 04 Apr 2001 23:09:48 GMT
From: Tim Sutton <timsutton@mail.com>
Subject: CGI Form to Generated Table
Message-Id: <1104_986425883@tim>
I need to prepare a page for my company's intranet, and need to let workers fill out form data to book equipment for weeks
at a time. I need a script that
will take their form data, then add it to a table that is dynamically updated. Any suggestions? Thanks!
------------------------------
Date: Wed, 04 Apr 2001 23:06:19 GMT
From: Tim Sutton <timsutton@mail.com>
Subject: CGI Form to Table
Message-Id: <1103_986425673@tim>
I need to prepare a page for my company's intranet, and need to let workers fill out form data to book equipment for weeks at a time. I need a script that
will take their form data, then add it to a table that is dynamically updated. Any suggestions? Thanks!
------------------------------
Date: Wed, 04 Apr 2001 16:02:50 -0700
From: A_Geekette <moiraine{NOSPAM}@qwest.net>
Subject: CGI vs. embperl vs. Mason or CGI/emperl/mason
Message-Id: <3ACBA81A.1F8AD66B@qwest.net>
Has anyone worked with all three of these? Do they work well in
combination.
ie: CGI generates HTML that has embperl script within the new HTML that
calls on *.epl files...etc.
How about Mason. I haven't found out much about it...I could've been
tired from researching that day or something, but it seemed to me Mason
didn't have much in the way of explanation on their site. I'll check
again, but if anyone could point me in the direction of an alternate
site that explains/has examples of Mason, I'd be much appreciative.
Thanks,
--
Geekette
"Try Not. Do or do not. There is no try."
-If you don't know who said this,
I don't want to talk to you. ;-)
"Nothing is impossible, no matter how improbable."
-Anonymous
------------------------------
Date: Thu, 5 Apr 2001 18:22:59 +1000
From: David Findlay <david_j_findlay@yahoo.com.au>
Subject: Re: Deleting one line from a file
Message-Id: <FWMy6.9149$45.53569@newsfeeds.bigpond.com>
Don't worry, I eventually figured it out. I am still fairly new to perl,
and I normally work in C++. I got it working eventually. I used some
foreach commands to step through the array checking if it matched what I
wanted to find.
How do I optimise my code to run faster? Is there a guide somewhere?
David
------------------------------
Date: Wed, 4 Apr 2001 18:02:42 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Deleting one line from a file
Message-Id: <slrn9cn6g2.h9p.tadmc@tadmc26.august.net>
David Findlay <david_j_findlay@yahoo.com.au> wrote:
>I used some
>foreach commands to step through the array checking if it matched what I
>wanted to find.
>
>How do I optimise my code to run faster? Is there a guide
Yes.
>somewhere?
It is already on your hard disk.
perldoc -q efficient
perldoc -f grep
Perl comes with extensive documentation. Use it.
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 5 Apr 2001 00:04:00 +0100
From: "pgroves" <pgroves@ntlworld.com>
Subject: Does this newsgroup have an FAQ?
Message-Id: <KKNy6.2315$%W5.299084@news6-win.server.ntlworld.com>
If so, how do I get it?
thanks
Paul
------------------------------
Date: 04 Apr 2001 18:30:19 -0500
From: John Hunter <jdhunter@nitace.bsd.uchicago.edu>
Subject: Re: Does this newsgroup have an FAQ?
Message-Id: <1rvgokuttg.fsf@video.bsd.uchicago.edu>
>>>>> "pgroves" == pgroves <pgroves@ntlworld.com> writes:
pgroves> If so, how do I get it? thanks
http://www.yahoo.com search for 'perl faq'.
------------------------------
Date: 4 Apr 2001 23:39:38 GMT
From: ab401@freenet.carleton.ca (Paul Tomblin)
Subject: Re: Does this newsgroup have an FAQ?
Message-Id: <9agbbq$cic$1@freenet9.carleton.ca>
In a previous article, "pgroves" <pgroves@ntlworld.com> said:
>If so, how do I get it?
Consider that a mere 4 hours before you posted this question, the
PerlFAQ Server posted a post with the subject line "FAQ 9.16: How do I
decode a CGI form?". The word FAQ appears both in the subject line and
the "name" of the poster, and the post itself contains detailed
information showing you were you could have found the FAQ both on the web
and on Usenet.
It appears you're not going to make the minimal effort of scanning a few
subject lines to find the information for yourself. Read the FAQ. While
you're at it, you might want to read the FAQ for news.newusers.questions
for tips on how to make a better first impression.
--
Paul Tomblin <ptomblin@xcski.com>, not speaking for anybody
"You are in front of me. If you value your lives, be somewhere else." -
- Delenn, Babylon 5
------------------------------
Date: Wed, 4 Apr 2001 16:38:33 -0700
From: "terminalsplash" <shino_korah@yahoo.com>
Subject: Getting hostname
Message-Id: <9agb9q$cnk@news.or.intel.com>
Hi
What is the best way to get hostname of the current machine?
I'm using chomp($name = `hostname');
How can I use Sys::Hostname module to get this?I mean which function to use?
How to read help for functions in modules?
Thanks
------------------------------
Date: Thu, 05 Apr 2001 00:17:07 GMT
From: "Todd Smith" <todd@designsouth.net>
Subject: Re: How do I get html from a website?
Message-Id: <7QOy6.9578$C51.2743374@news1.rdc1.tn.home.com>
"Jesse James Jensen" <jesse@uchicago.edu> wrote in message
news:3ACB898C.30377430@uchicago.edu...
> Todd Smith wrote:
> >
> > I'm writing a program that plays Lycos Gamesville bingo online for me.
The
> > url that the game
> > starts off with, which I need to send and get back the html so my
program
> > can see the bingo boards, is very very long.
> >
> > I tried "$result = `lynx -dump $url`, but a result never comes back.
I've
> > tried LWP::UserAgent, but it says the site doesn't allow connections to
it's
> > HTTP port, and sometimes i just get a "Connection timed out" error.
> >
> > So my question is, how does a regular browser connect to a site and get
back
> > a result so fast, and how can I do it the same way?
>
> CHEATER!
I'm just doing it for fun, dude
------------------------------
Date: 04 Apr 2001 19:31:27 -0500
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: How do I get html from a website?
Message-Id: <87vgokdw68.fsf@limey.hpcc.uh.edu>
>> On Wed, 04 Apr 2001 19:00:02 GMT,
>> "Todd Smith" <todd@designsouth.net> said:
> I'm writing a program that plays Lycos Gamesville bingo ...
> I tried "$result = `lynx -dump $url`, but a result never
> comes back. I've tried LWP::UserAgent, but it says the
> site doesn't allow connections to it's HTTP port, and
> sometimes i just get a "Connection timed out" error.
Tony's guess: the browser has it cached on disk.
LWP talks the same protocols (of course) as your browser,
so if it can't connect then neither can your browser.
The bottom-line is probably to do
$ telnet remote.host 80
GET /path/to/what/you/want HTTP/1.0 [RET] [RET]
and see if anything comes back. The LWP package also
installs a "GET" perl program which you could use (to try
to get back on track for clpm).
hth
t
--
Just reach into these holes. I use a carrot.
------------------------------
Date: Wed, 4 Apr 2001 23:28:23 +0100
From: "Milliwave" <milliwave@rfengineering.freeserve.co.uk>
Subject: Installing Perl On Solaris(source-files)
Message-Id: <9ag723$ohd$1@news7.svr.pol.co.uk>
Hello,
I am in the process of installing the source files for perl5.6.0 on solaris
7.0, and was hoping that someone
could email me some step by step instructions which could enable me to
perform
a successful installation. email: milliwave@rfengineering.freeserve.co.uk
cheers
------------------------------
Date: Thu, 05 Apr 2001 01:04:37 GMT
From: tiltonj@erols.com (Jay Tilton)
Subject: Re: lines with headers
Message-Id: <3acbc3a7.169009375@news.erols.com>
On 4 Apr 2001 17:59:03 GMT, kenta@nospam.nospam wrote:
>In article <3abfecf2.147251611@news.erols.com>, Jay Tilton
><tiltonj@erols.com> writes:
>>
>> my ($title, $sum);
>> do {
>> while (<>) {
>> chomp;
>> last unless /^\d*$/;
>> $sum += $_;
>> }
>> print "$title=$sum\n" if defined $title;
>> $title = $_;
>> $sum = 0;
>> } until eof
>
>This seems to work, but is it actually correct?
Yup.
>Quoth 'man perlfunc':
> Do not read from a terminal file (or call `eof(FILEHANDLE)'
> on it) after end-of-file is reached.
'Terminal file' would mean a filehandle opened for keyboard-like
input. Like saying eof(STDIN), which is intuitively silly because it
can alter the very state it's supposed to be checking.
For a flat file on disk, once it's reached eof, any further reads or
calls to eof aren't going to change its eof status.
>Also, is there a way to do it without using "eof"?
>
>Quoth 'man perlfunc':
> Practical hint: you almost never need to use `eof'
> in Perl,
That's true for values of "need" approaching "I need a liver
transplant."
Not so true for values like "I need some more coffee so I can finish
this program and go home."
eof() is a valid function, it works, and unless it's threatened with
deprecation in Perl6, I feel safe using it as an convenient way out of
a sticky spot. :)
>Is it possible to have just a single loop,
>i.e, "while(<>)" as the only looping
>construct?
If eof is disallowed, I don't see a way without using 'redo' to fake
the second 'while', or reverting back to having two print statements.
It could be possible, but probably not worth incinerating more brain
cells to achieve.
------------------------------
Date: Wed, 04 Apr 2001 23:44:37 GMT
From: ted <tlav1@mediaone.net>
Subject: Re: Multiple email send?vvp
Message-Id: <3ACBDCCA.CF028B5@mediaone.net>
I deal with some very large email lists that get mailed on a weekly basis.
Check out the Mail::Bulkmail module. It worked for me.
ted
"Prasad, Victor [FITZ:K500:EXCH]" wrote:
> I have a list of 20 000 people who a monthly email.
>
> I am going to do something like this but loop through 20 000 users:
>
> #!/usr/bin/perl -w
> use strict;
> use Mail::Mailer;
> my $mailer = new Mail::Mailer;
> # the open() method takes a hash reference with keys which are mail
> # header names and values which are the values of those mail headers
>
> $mailer->open( {
> From => 'fred@example.com',
> To => 'barney@example.com',
> Subject => 'Web form submission'
> } );
>
> # we can print to $mailer just as we would print to STDOUT or any
> # other file handle...
> print $mailer qq(
> Dear Barney,
> Here is a form submission from your website:
> Name: $name
> Email: $email
> Comments: $comments
> Love, Fred.
>
> );
>
> $mailer->close();
>
> 1) Will there be problem with sending this volume of email? Is a delay
> required per email?
> 2) Is there a limit to the size of the message I am sending? if the data
> inside the body is about a page or two will the 'qq (<data>) hold it?
> 3) Is it possible to send attachments.
>
> Thank you,
>
> V
------------------------------
Date: Wed, 04 Apr 2001 16:56:08 -0400
From: a246456 <a246456@fmr.com>
Subject: NET::TELNET
Message-Id: <3ACB8A68.5A94EB8B@fmr.com>
Hi,
This script process a list of servers from a file(host.txt), if it
fails to connect or invalid password then it should write it to output
handler(file). For some reasons i am not able to get this result.
Advance thanks for your response.
---------------------------------------------------------------------------------------
$username = "user";
$passwd = "password";
open(FH, "host.txt") || die "File host.txt not found\n";
open(TELFAIL, ">fail.txt");
while(<FH>){
use Net::Telnet ();
chomp;
$t = new Net::Telnet (Timeout => 300,
Prompt => '/[\$%#>] $/', Errmode => "return");
if($t->open($_)) #connecting to host
{
if($t->login(Name => $username, Password => $passwd)) #Login
authentication
{
@lines = $t->cmd("uname -a");
print @lines;
print "\n\n";
@lines = $t->cmd("ls -al");
print @lines;
}
elsif{
print TELFAIL "Unable to connect $_\n"; #failed to telnet
}
else{
print TELFAIL "Invalid Username/Password for $_\n"; #Invalid
userid/password.
}
}
exit;
close(FH);
close(TELFAIL);
------------------------------
Date: 4 Apr 2001 16:22:52 PDT
From: Jason Hurst <variant@shell.pacifier.com>
Subject: OOP Question
Message-Id: <3acbaccc_1@news.pacifier.com>
First, i'm pretty new to doing OOP with perl, however, i'm relativly
experiance with perl.. I created a package which would look at a database
and create an object with data corresponding to the database. It was a
database of training classes. Here is a link to the code:
http://www.colubs.com/perl/Classes.pm
ok, it seams to work alright when i'm accessing the data directly, say i
do the following:
my $foo = Classes->new;
print $foo->[101]->id;
no problem. however what i want to do is somethign like this:
foreach $key (@$foo) {
print $key->id;
}
But i can't figure out how to create my object to support this. Any help
would be greatly appreciated. I hope this makes sence, my head is a mess
from looking at this problem so long.. :)
thanks
-jason
------------------------------
Date: Wed, 4 Apr 2001 23:38:40 +0100
From: "francesca" <plusc@freeserve.net>
Subject: PERL ACCESS TO ORACLE
Message-Id: <9ag804$b8u$1@newsg4.svr.pol.co.uk>
I need to access Oracle with my perl code
on the college server from home over the internet
I can easily gain access when i telnet the server :
when telnet i have to enter my username then password
then enter> sqlplus
then enter my username and enter a different password
from previous:
the command i would use internally would be
similar to:
open(SQLCONNECTION,'| sqlplus scott/tiger ');
can you help please?
------------------------------
Date: Wed, 04 Apr 2001 17:31:49 -0700
From: Bryan Coon <bcoon@sequenom.com>
Subject: Re: PERL ACCESS TO ORACLE
Message-Id: <3ACBBCF5.B5AF6BC3@sequenom.com>
francesca wrote:
> I need to access Oracle with my perl code
> on the college server from home over the internet
>
> I can easily gain access when i telnet the server :
>
> when telnet i have to enter my username then password
> then enter> sqlplus
> then enter my username and enter a different password
> from previous:
>
> the command i would use internally would be
> similar to:
>
> open(SQLCONNECTION,'| sqlplus scott/tiger ');
>
> can you help please?
You need to use the DBI package. If you are in windows you can use the
DBI:ADO driver. If you are in linux (or any unix maybe) you need to use
the DBD::Oracle module. Installing this is not trivial. You need to
have the Oracle source code, point the ORAHOME env variable to that
source dir and then compile the driver. This is after moving and
renaming a few choice files in the oracle source code. Whee! Then
establishing a remote connection can be fun too. Here's what mine looks
like:
my $dbh = DBI->connect("DBI:Oracle:database=thedatabase;host=thehost",
"username", "password") or die;
You should take a gander at the DBI module docs to see what you are
getting yourself into.
Good luck!
Bryan
------------------------------
Date: Thu, 5 Apr 2001 00:01:40 +0100
From: "pgroves" <pgroves@ntlworld.com>
Subject: Perl training courses in the UK?
Message-Id: <xINy6.2306$%W5.298027@news6-win.server.ntlworld.com>
Can anyone recommend any good 3-5 day introductory and/or intermediate
commercial Perl courses in the UK (preferably in the Thames Valley or London
area)?
I have some experience of writing very basic Perl scripts, and have also
done some ASP programming, but have no other programming experience (i.e. no
C etc.), so the less pre-requisites there are, the better...
thanks
Paul
------------------------------
Date: 05 Apr 2001 00:45:37 GMT
From: anotherway83@aol.com (The Mosquito ScriptKiddiot)
Subject: Re: Perl training courses in the UK?
Message-Id: <20010404204537.20371.00004424@ng-mq1.aol.com>
y r u wasting ur money on a course, get LEARNING PERL and PROGRAMMING
PERL....they're awesum
peace
The Mosquito ScriptKiddiot
Championing the Cause of Mosquitoes in Technology
------------------------------
Date: Wed, 04 Apr 2001 17:19:29 -0700
From: Bryan Coon <bcoon@sequenom.com>
Subject: PerlMagick install woes
Message-Id: <3ACBBA11.C660913A@sequenom.com>
I have tried to install PerlMagick on a RH 7.0 ix86 machine, and am
having some diffuculties...
It compiles just fine, but when I do 'make test', I get a bunch of
errors:
t/zlib/write......../usr/bin/perl: error while loading shared libraries:
/usr/lib/libMagick.so.5: symbol __sysconf, version GLIBC_2.2 not defined
in file libc.so.6 with link time reference
t/zlib/write........dubious
Test returned status 127 (wstat 32512, 0x7f00)
DIED. FAILED test 1
This happens for t/*. I downloaded the rpms from the imagemagick site,
and installed them with minimal problems (I had to force install
freetype). I also checked the imagemagick site, the usenet groups, and
the perl faq... no dice.
Anyone seen this before?
Thanks,
Bryan
------------------------------
Date: 04 Apr 2001 15:47:13 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Please Flame my Benchmark: open vs. cat
Message-Id: <m3puesfl4e.fsf@dhcp9-175.support.tivoli.com>
On 04 Apr 2001, dave@sydney.daveb.net wrote:
> Great, so you won't mind if I magically make integer addition 1000
> times slower on your machine, will you? After all, you'd have to do
> it (integer addition) 1000 times to tell the difference, so maybe
> there is no difference.
I think that two different discussions are being had, and that's
leading to communication failures.
Side A:
Benchmarching the fast part of a combined operation is not
particularly useful. Comparing the speed of open versus cat by
running it repeatedly on the same file will only factor in the cost
of actually reading the file once, which will eventually tend to
compare the explicit difference between the two methods. However,
it misses the main point which is that both methods are so much
faster than the actual disk operation that their relative
performance is a non-issue.
Side B:
The only way to really compare the absolute speed of two operations
is to eliminate the common factors and compare just what's
different. That way, you aren't measuring the wrong thing, such as
the efficiency of the disk-caching system.
Dave, you seem to be arguing Side B, which is fine, but what others
are trying to point out is Side A. That is, since the actual disk
operation is going to completely dominate the time, the relative cost
of the extra fork, exec etc. of calling cat is going to be negligible.
I guess the main point is that justifying the use of open instead of
`cat` based on performance just isn't very compelling. Now,
justifying it with some other argument, particularly portability, is a
different story....
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: 05 Apr 2001 00:53:07 GMT
From: dave@sydney.daveb.net (Dave Bailey)
Subject: Re: Please Flame my Benchmark: open vs. cat
Message-Id: <slrn9cn66d.bag.dave@sydney.daveb.net>
On 04 Apr 2001 15:47:13 -0500, Ren Maddox <ren@tivoli.com> wrote:
[...]
>Side B:
>
> The only way to really compare the absolute speed of two operations
> is to eliminate the common factors and compare just what's
> different. That way, you aren't measuring the wrong thing, such as
> the efficiency of the disk-caching system.
>
>Dave, you seem to be arguing Side B, which is fine, but what others
>are trying to point out is Side A. That is, since the actual disk
>operation is going to completely dominate the time, the relative cost
>of the extra fork, exec etc. of calling cat is going to be negligible.
That really depends on the size of the file and whether or not it is
already cached. It's not something you can just assert without
qualification. For example, I find that doing an open/read/close on
a 10 KB file which is not cached takes about a hundredth of a second,
while backticking cat to read the contents of another uncached file
of about the same size takes over twice as long. When the file
is cached, backticking cat is slower by at least an order of magnitude, or
more precisely, about the time it takes to fork() a new process (8 ms on
my machine). For some applications this might not matter, but for others
it does. Blanket statements such as the assertion you and others have
made in this thread can be misleading and I think they should be avoided.
--
Dave Bailey
davidb54@yahoo.com
------------------------------
Date: Wed, 04 Apr 2001 16:01:11 -0600
From: Dmitry Epstein <mitiaNOSPAM@northwestern.edu.invalid>
Subject: Re: what are the new languages?
Message-Id: <3ACB99A7.75C3BE81@northwestern.edu.invalid>
"wayne.keenan" wrote:
>
> it one of those "works for me" syndromes. Try later, was it a DNS error?
Uh, never mind... Turns out that I had some problem with Java, I
think. It's fixed now and I can access the sites.
Have you used PerlMagic? How does it compare to ActivePerl (which I am
currently using)?
> Dmitry Epstein wrote:
>
> > "wayne.keenan" wrote:
> > > and for the IDE:
> > > http://open-perl-ide.sourceforge.net
> > > http://cmdoc.codemagiccd.com/
> >
> > Funny, I just tried both sites, and neither of them works, neither in
> > Netscape 4 nor in IE5. An international conspiracy?
--
Dmitry Epstein
Northwestern University, Evanston, IL. USA
mitia(at)northwestern(dot)edu
------------------------------
Date: 04 Apr 2001 16:06:12 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: What level of Perl needed for my system() call to work?
Message-Id: <m3lmpgfk8r.fsf@dhcp9-175.support.tivoli.com>
On Wed, 04 Apr 2001, gary@db.stanford.edu wrote:
> From the console:
>
> Connecting on 171.64.75.93:9613 issuing command:
> ../handlers/process net://Eh:9613 90000000 > /dev/null
> at Wed Apr 4 09:54:41 2001
>
> (There is no carriage return in the actual command)
So the actual command being run is:
../handlers/process net://Eh:9613 90000000 > /dev/null
right?
The only things I can think of are:
* Current directory isn't what's expected so the relative path isn't
working.
* Something in the environment is different and that's leading to a
failure of some kind.
Wish I could offer more insight....
--
Ren Maddox
ren@tivoli.com
------------------------------
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 632
**************************************