[8074] in Perl-Users-Digest

home help back first fref pref prev next nref lref last post

Perl-Users Digest, Issue: 1693 Volume: 8

daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jan 21 13:20:07 1998

Date: Wed, 21 Jan 98 10:01:34 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)

Perl-Users Digest           Wed, 21 Jan 1998     Volume: 8 Number: 1693

Today's topics:
    Re: living and free software (was: Re: source into bina (Greg Bacon)
    Re: living and free software (was: Re: source into bina <pdcawley@bofh.org.uk>
    Re: ora_errstr not initialized properly using oraperl <Tim.Bunce@ig.co.uk>
    Re: Oraperl / DBD / Perl5 Performance for Oracle query? <Tim.Bunce@ig.co.uk>
    Re: Outlook 97 and perl scripts scott@softbase.com
    Re: Perl running under Linus - #!/bin/usr <walrus@qis.net>
    Re: Perl vs C++ for CGI (Erik Y. Adams)
    Re: Puzzling behavior of c.l.p.* readers <camerond@mail.uca.edu>
    Re: Puzzling behavior of c.l.p.* readers <camerond@mail.uca.edu>
        Refering to a referenced structure? (Wade Williams)
        Reg Expression, can it be improved? rlee@spcbrass.com
    Re: Running Two Scripts at Once (Richard Eyles)
        Script for rlogin to UNIX from a PC <uday@ionet.net>
    Re: source into binary code <pdcawley@bofh.org.uk>
    Re: sysread vs <> <vallon@pearl.fi.bear.com>
    Re: sysread vs <> (M.J.T. Guy)
    Re: sysread vs <> (Will Morse)
    Re: Were can I get PERL <barnett@houston.Geco-Prakla.slb.com>
        Where Software Freedom is Discussed <jason@primal.ucdavis.edu>
    Re: Why warn? (WAS: Re: Critique My Code! (Please)) dg50@chrysler.com
        Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)

----------------------------------------------------------------------

Date: 21 Jan 1998 16:22:20 GMT
From: gbacon@adtran.com (Greg Bacon)
To: rjk@coos.dartmouth.edu
Subject: Re: living and free software (was: Re: source into binary code)
Message-Id: <6a57bs$i37$1@info.uah.edu>

[Posted and mailed]

In article <34C586D4.EFFD0977@coos.dartmouth.edu>,
	Chipmunk <rjk@coos.dartmouth.edu> writes:
: Greg Bacon wrote:
: > 
: > In article <6a19ht$cii$1@news.orst.edu>,
: >         stanley@skyking.OCE.ORST.EDU (John Stanley) writes:
: > : No Utopia exists when people are hungry. Somehow, equating the Internet
: > : to Utopia lessens the value of Utopia, or inappropriately agrandizes
: > : the Internet.
: > 
: > This remark leads me to believe that either you haven't been using the
: > Internet for very long or that you haven't realized the full potential,
: > perhaps both.
: 
: You don't seriously believe the Internet is a Utopia, do you?!
: This remark leads me to believe that you are either very naive,
: or simply don't know what 'Utopia' means.

Is?  Definitely not.  Was?  Given that Utopia is an unreachable ideal
(and a bit of an exaggeration) the Internet can't have been a Utopia.
Those of us who've been around for more than three or four years know
what I'm talking about.  Maybe it's just nostalgia, especially with
the decay of Usenet and the infestation and intrusion of commercialism
into what was once a haven, but things seemed much nicer then.

I saw a quote once: "The Internet is full; go away!"

: You recommended several things for John Stanley to read.  Here's
: one for you:
: 
: Silicon Snake Oil: Second Thoughts on the Information Superhighway
: by Clifford Stoll (author of The Cuckoo's Egg)
: Anchor Books, Copyright 1995

I haven't read it yet, but I'll keep an eye out.  Thanks for the
recommendation.

Greg
-- 
open G,"|gzip -dc";$_=<<EOF;s/([0-9a-f]+)/print G pack"h*",$1/eg
f1b88000b620f22320303fa2d2e21584ccbcf29c84d2258084
d2ac158c84c4ece4d22d1000118a8d5491000000
EOF


------------------------------

Date: 21 Jan 1998 17:22:21 +0000
From: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: living and free software (was: Re: source into binary code)
Message-Id: <54soqhhhde.fsf@gunnar.aladdin.net>

20 Jan 1998 04:35:09 GMT stanley@skyking.OCE.ORST.EDU (John Stanley) comp.lang.perl.misc
> In article <6a0o44$20k$9@info.uah.edu>, Greg Bacon <gbacon@adtran.com> wrote:
> >I don't have much use for useless software. :-)  
> 
> Neither do I. But I don't consider commercial software to be useless
> just because I had to pay for it.

Heh, I don't consider free software to be worthless, that's why I
often pay for it; A decent Linux distribution on CD is better value
than the time I spend with my phoneline tied up waiting for it to
download. 

> >No one is claiming to make a living by giving away software.  Why do you
> >insist on returning to a settled point?  
> 
> Because it hasn't been settled. You think you settled it by proving the
> claim wasn't made, but you quoted the claim in the same article where
> you tried proving it didn't happen.
> 
> >MAKING A LIVING AND GIVING AWAY SOFTWARE ARE INDEPENDENT EVENTS--
> 
> Not when they are connected in the same sentence with the word "by".
> That's a causal relationship. The events "make meatloaf" and "running
> over cats" are usually independent, until you say "I make meatloaf by
> running over cats and cooking them." Yes, the word "by" is
> important.

Hmm I don't think anyone (who hasn't amended their statement) has
claimed to be making a living by giving away software. Lots of people
have claimed to be making a living whilst giving away software, but
that's a different matter.

> >: >Source hoarders be damned.
> >: 
> >: My my, yes, that attitude I was just talking about. 
> >
> >It is natural and normal to harbor contempt for those who cause
> >trouble and are generally harmful to society.
> 
> Please support that statement with proof or retract it. It is a long
> way from "I won't give you my code for free" to causing trouble for
> society.

Hmm... 'It is natural to harbour contempt for those who cause trouble
and are generally harmful to society'. Yeah, I can go with that. I'm
not sure I believe that those who don't make their source available
are either causing trouble or generally harmful to society, but it
doesn't mean that the statement is incorrect.

> >You're referring to selling an obfuscated version of your work.  This is
> >still hoarding.  
> 
> The work is available to anyone who wants to use it. You cannot see how
> it was done, just as I cannot walk into HP and expect to see how they
> fab the chips for the calculator I just bought, nor can I learn how by
> grinding the top off the chips in the one I bought. 

But people can and do. The equipment needed is not exactly cheap, but
the technique is reasonably well understood. Of course it would almost
certainly work out cheaper just to buy the damn things from HP.

> Nor can I take the automotive diagnostic computer apart at the local
> garage just because I had a tuneup done there, to see how it is
> done.

Shame that. But you could reverse engineer the engine management
system and try optimizing it yourself. I know people who have done it
(and gained a massive performance boost in the process; the software
that was initially running was desparately wasteful in the inside
loop...) 

> >No one can benefit from what you've learned.  
> 
> Don't be silly. Anyone can benefit from what I've learned, they just
> have to pay for it.

Ah... anyone who can afford to can benefit from what you've learned.
(Hmm... the same applies if you relase your source, but that isn't
quite my point...)

> The benefit is the operation of the program, not the ability to see
> the code itself. 

The risk is that the code will have bugs at some inappropriate time
when you are not around to fix it. (Canonically, run off to join a
cult, but hey, you could just as easily have died, had a lobotomy or
discovered girls or something.)

> Did you notice that there is a thing called "tuition" at most
> schools? Do you resent all those professors who expect to be paid to
> teach you the things they have learned?

Me? Nah, it's easier and more effective to pay them to do the teaching
than it is to go buy the coursebooks and plough through them unaided.
Plus I don't get a Degree at the end of it if I do it myself. I'm
paying for convenience.

> Did you also notice that most of the world would not benefit one tiny
> bit by seeing the code, but many may benefit from its use?  E.g., the
> code that runs the MRI systems sold by GE. I would get no benefit from
> seeing the code used by these "greedy code hoarders", but damn wouldn't
> the results of the code be helpful if I needed an MRI? Here is just one
> example of why "greedy code hoarding" can be good. Would you want your
> doctor programming the MRI machine? Would you even expect him to know
> about quadrature phases and pulse programming so he could detect any
> errors in the program? Would you like to be IN the MRI when his program
> runs the first time? (No, no, doctor, the paramter to that call is in
> units of seconds, not microseconds. 3000 is MUCH too long a time to have
> the full power of the RF unit applied.)

You keep using this argument, I'm not sure it means what you think it
means. Of course the doctors won't benefit from seeing the code.
They're almost certainly bright enough to know this and if they did
have access to it they wouldn't go near it. 

It doesn't mean that I wouldn't be interested in seeing said code,
they may have used some clever technique of which I was previously
unaware that I can borrow and use in a completely different
application.

> >You're not contributing to human knowledge.  
> 
> What a wonderfully subjective measure of the value of existance. By
> this measure, a good 90% of the population of the Earth should be
> taken out and shot. No, let's be lenient. 50%.

Um... I think you're being a little extreme. Just because you don't
contribute to human knowledge doesn't make you a useless member of the
wider society. It could be argued that not releasing source makes you
a parasite on hacker society, but parasites do actual harm to the
host, you're just an irritant.

> >Greed is motivating you to the point of eliminating any feelings of
> >altruism you might have. I
> 
> And now we are at the extreme end of the pendulum swing, where the
> desire to feed one's family by doing something one is good at is
> equated to "greed" and anyone who wants to do this lacks any
> feelings of altruism. Yes, all must learn to play the piano. A
> Utopia in the making.

Wow, your terminal must automatically do double linespacing if you can
read that much between his lines.

> >I'm just painting a picture of how nice things would be for
> >everyone if they joined the free software movement.
> 
> It would be nicer for those who want the software for free, no doubt
> about that. It wouldn't be as nice a place for people who currently
> make their livings writing code and selling it, but they are scum
> anyway so who cares, right?
> 
> Had an MRI recently? Used a modem? 

> Those greedy software hoarders at Hayes...

Well, they did try and sue people over using the AT command set so we
ended up in a nightmare scenario where there was no standard way of
accessing the more advanced features of any given modem, which was
definitely a Bad Thing. And it proved to be a stupid thing too -- they
still ended up losing large chunks of market share to USR et al, while
the users (and software authors) were left to deal with the
bewildering variety of modem command sets. 

-- 
Piers Cawley -- Systems Genie for Aladdin
If a `religion' is defined to be a system of ideas that contains
unprovable statements, then Godel taught us that mathematics is not
only a religion, it is the only religion that can prove itself to be
one. -- John Barrow


------------------------------

Date: Wed, 21 Jan 1998 16:02:42 GMT
From: Tim Bunce <Tim.Bunce@ig.co.uk>
Subject: Re: ora_errstr not initialized properly using oraperl
Message-Id: <En55wJ.3qH@ig.co.uk>

In article <34C41BCB.A198E6FB@cisco.com>,
Harvinder Kalsi  <hkalsi@cisco.com> wrote:
> I am calling procedures using ora_open in my perl/ora_perl programs; If
> there is a
>     raise_application_error(-20091, SQLERRM) or
>     raise_application_error(-20091, 'Error in this part') for example
> in the procedure, $ora_errstr variable does not give me the sql message
> in
> SQLERRM, it always contains same value as $ora_errno that is ORA-20091.
> 
> Has anyone else encountered this problem and is there a work around to
> get actual
> oracle message?

Works for me and it probably works for you. Take a look at the t/plsql.t
file in the DBD::Oracle distribution.

Tim.



------------------------------

Date: Wed, 21 Jan 1998 16:09:16 GMT
From: Tim Bunce <Tim.Bunce@ig.co.uk>
Subject: Re: Oraperl / DBD / Perl5 Performance for Oracle query?
Message-Id: <En567H.3tp@ig.co.uk>

In article <157ce$112fa.26a@news.cegelecproj.co.uk>,
Steve Kilbane  <Steve_Kilbane@cegelecproj.co.uk> wrote:
> In article <68r3rr$6hv$1@rdsunx.crd.ge.com>, kornfein@.crd.ge.com (Mark Kornfein) writes:
> > 
> > I've recently come on board a web project that uses the Oraperl emulation 
> > interface for DBD. The performance is horrible, a query that returns in 4-5
> > seconds from sqlplus takes 50 seconds, This is just to do the "fetch"
> > without calling any cgi scripts.
> 
> Is that *just* the fetch, or are you looking at Perl invocation,
> parsing, connection to Oracle, the query opening, and then the
> fetch? Usually, the time is in the connection to Oracle, and the
> README for DBD::Oracle gives some hints and tips on that.
> For example, are you using SQL*Net, and if so, do you actually
> need to?

Here's a copy of a message I recently sent to dbi-users. I'm posting
it here so it reaches the same people as Mark's "The performance is
horrible" statement.

Tim.

To: dbi-users@fugue.com
Subject: DBI / DBD::Oracle fetch performance

I found some time to look into this a little.

I've modified DBD::Oracle such that you can set an attribute which will
cause the same row to be fetched from the row cache over and over again
(without involving Oracle code but exercising *all* the DBI and DBD::Oracle
code in the code path for a fetch).

The results (on my lightly loaded Sparc 10) fetching 50000 rows using:

	1 while $csr->fetch;

were:
	one field:   5300 fetches per cpu second (approx)
	ten fields:  4000 fetches per cpu second (approx)

Obviously results will vary between platforms but it does give a feel
for the current theoretical maximum performance.

By way of comparison, using the code:

	1 while @row = $csr->fetchrow_array;

(fetchrow_array is roughly the same as ora_fetch) gives:

	one field:   3100 fetches per cpu second (approx)
	ten fields:  1000 fetches per cpu second (approx)

Notice the slowdown and the more dramatic impact of extra fields.
(The fields were all one char long. The impact would be bigger for
longer strings.)

Changing that slightly to represent actually _doing_ something in perl
with the fetched data:

    while(@row = $csr->fetchrow_array) {
        $hash{++$i} = [ @row ];
    }

gives:	ten fields:  500 fetches per cpu second (approx)

That simple addition has *halved* the performance.

I therefore conclude that DBI and DBD::Oracle overheads are small
compared with Perl language overheads (and probably database overheads).

So, if you think DBI/DBD::Oracle is slow, try replacing your fetch
loop with just:

	1 while $csr->fetch;

and time that. If that doesn't help much then point the finger at the
database, the platform, the network etc. But think carefully before
pointing it at the DBI or DBD::Oracle.

(Having said all that, if anyone can show me how to make the DBI and
DBD::Oracle even more efficient, I'm all ears.)

Tim.




------------------------------

Date: 21 Jan 1998 14:22:00 GMT
From: scott@softbase.com
Subject: Re: Outlook 97 and perl scripts
Message-Id: <6a50a8$8vr$2@mainsrv.main.nc.us>

Tony Arnold (tony.arnold@mcc.ac.uk) wrote:
> I believe it ought to be possible to process mail folders etc., in
> Outlook 97 from a perl script. Has anyone done this? If so, I would
> appreciate seeing an example of the techinique.

I've done a lot of research into this issue.  I've wanted to do
noninteractive e-mail processing from Perl myself.  My conclusion is
that it's a lost cause right now. It's not possible to do anything that
works well and works consistently. It's not worth the effort right now
to make MAPI Automation work.

Remember, Outlook is just a shell around MAPI. A fancy shell, but a
shell nonetheless. It has no intrensic object model to speak of,
because it doesn't do anything but manipulate MAPI objects for you.
(That's why it has VBScript, not full VBA!)

There *is* a MAPI.Session Automation object which you can use from
Perl. ***BUT*** it is totally undocumented. This is probably because it
is unsupported and does not work.  Various sources allude to it, but it
is not formally documented. By guessing, based on the MAPI
architecture, you can make it work part of the time. The problem is
results vary wildly based on which e-mail client, and which e-mail
client version is installed. Exchange, Outlook, etc all give different
results for fairly innocuous operations. Outlook, for example, refuses
to non-interactively send the mail. It always pops up an editing screen
from which you must manually press Send.

My guess is this:

	1. Outlook has no VBA support because MAPI.Session is
	broken and undocumented.

	2. VBA support will appear when MAPI.Session works
	and someone documents it.

	3. Perl will be able to Automate mail on Win32 when
	#2 happens.

Right now, my advice is to wait for Outlook with VBA support, and
then start trying to program it with Perl.

Scott
--
Look at Softbase Systems' client/server tools, www.softbase.com
Check out the Essential 97 package for Windows 95 www.skwc.com/essent
All my other cool web pages are available from that site too!
My demo tape, artwork, poetry, The Windows 95 Book FAQ, and more. 


------------------------------

Date: Wed, 21 Jan 1998 12:05:37 -0500
From: "Charles E. Burleson" <walrus@qis.net>
Subject: Re: Perl running under Linus - #!/bin/usr
Message-Id: <Pine.GSO.3.96.980121120213.20592B-100000@eclipse>


 I believe the problem is because the directory in which you have the
program you wrote is not in your path. If you created a directory in which
to place all your perl files, this directory may not be in your path.


******************************************************************************
   Chuck Burleson
		visit me at  http://www.qis.net/~walrus/index.shtml  
   walrus@qis.net
******************************************************************************



------------------------------

Date: Wed, 21 Jan 1998 07:15:09 -0800
From: erik@earthlink.net (Erik Y. Adams)
Subject: Re: Perl vs C++ for CGI
Message-Id: <erik-2101980715090001@pool040-max5.mpop2-ca-us.dialup.earthlink.net>

In article <comdog-ya02408000R2101980052090001@news.panix.com>,
comdog@computerdog.com (brian d foy) wrote:

>In article <6a3q54$mo3$1@solaris.cc.vt.edu>, "Jerry Davis"
<gedavis3@vt.edu> posted:
>
>>How much speed increase is gained by using c instead of perl?
>>(Note: memory is not a concern, only speed)
>>Would you consider it worthwhile for the time required to rewrite huge
>>sections of code?
>
>if you are worried about speed use mod_perl or fast_cgi.  mod_perl
>scripts might even be faster than laod-every-time compiled code.
>

Or, if you are cursed with NT and IIS, use PerlIS or PerlScript, though
watch out for the bugs.

Erik

-- 
----------------------------------------------------------
Erik Y. Adams                           erik@earthlink.net
Information Systems Consultant                626/795-2701
Internet and Intranet Specialist


------------------------------

Date: Wed, 21 Jan 1998 10:36:43 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Puzzling behavior of c.l.p.* readers
Message-Id: <34C6241B.5B88DFAE@mail.uca.edu>

Myles Barrett Williams wrote:
> [snip]
> I'd even say that learning not to blame the compiler is one of the
> first rites of passage for new programmers.  Why does it seem
> especially common for Perl?  Maybe because Perl encourages laziness ;)

Not to mention hubris! ;^)

Cameron Dorey
camerond@mail.uca.edu


------------------------------

Date: Wed, 21 Jan 1998 10:37:10 -0600
From: Cameron Dorey <camerond@mail.uca.edu>
Subject: Re: Puzzling behavior of c.l.p.* readers
Message-Id: <34C62436.68EA5387@mail.uca.edu>

Myles Barrett Williams wrote:
> [snip]
> I'd even say that learning not to blame the compiler is one of the
> first rites of passage for new programmers.  Why does it seem
> especially common for Perl?  Maybe because Perl encourages laziness ;)

Not to mention hubris! ;^)

Cameron Dorey
camerond@mail.uca.edu


------------------------------

Date: Wed, 21 Jan 1998 11:22:08 -0600
From: wwilliam@cisco.com (Wade Williams)
Subject: Refering to a referenced structure?
Message-Id: <wwilliam-2101981122080001@10.0.0.2>

This one is driving me crazy.

I've learned how to use references, but how do I get the structure pointed
to by the reference?  For example:

@array=(1,2,3);

$theref=\@array;

$theref=($theref,4);
         ^^^^^^^

I simply want to add something to the array pointed to by $theref.  How
can I dereference theref in such a way that it gives me the array
structure so I can use it in a line like the third line?

I know how to access the elements, I just can't figure out how to refer to
the entire structure.

Thanks,

Wade

-- 
 ---------------------------------------------------------------------------
 Wade Williams                      "Any escape might help to smooth the
 Systems Engineer                    unattractive truth, but the suburbs
 Cisco Systems, Inc.                 have no charms to soothe the restless
 Brentwood, TN                       dreams of youth." 
 615-221-2918                              - N. Peart
 wwilliam@cisco.com    
 ---------------------------------------------------------------------------


------------------------------

Date: Wed, 21 Jan 1998 09:21:09 -0600
From: rlee@spcbrass.com
Subject: Reg Expression, can it be improved?
Message-Id: <885395443.1027342350@dejanews.com>

Okay, here we go...

The routine below will change all lines to lowercase EXCEPT words
enclosed in double quotes.

The below code works and I'm posting it here to show off (rofl)  NOT!  I
would like a second option. (I really want a perl one-liner to do the
same thing and get rid of the match variables).

Thanks

Bert

#!/usr/bin/perl -wT

my $rec = "";
my $a;

$_ = "This is  a TEST  \"Sammy 1st Birthday\" and \"SUZZY\"  ABCdef019Ab";

while (/(\"(.*?)\")/) {  $a = $_ = $';	# change the string to the
remainder of the string  $rec .= lc $`; # append the lowercase before
match to the new string  $rec .= $1;  # append the matched string
unchanged. }

$rec .= lc $a if ($a);  # get the tail end of the string if there is one

print $rec . "\n";

exit(0);


-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: Wed, 21 Jan 1998 08:56:25 +0000
From: Richard@bhhpharm.demon.co.uk (Richard Eyles)
Subject: Re: Running Two Scripts at Once
Message-Id: <540153283wnr@bhhpharm.demon.co.uk>

In article: <34c4d59a.1999949@nntp.harborcom.net>  
kschreff@harborcom.net (Schreffman) writes:
> 
> 	Can this be done?  I have a HTML form that when submitted, I
> want to split the browser window into two frames and run a perl script
> that will display data in each frame.  Any ideas or hints???
While I'm no expert, wouldn't it be easier to output the HTML to create 
the two pages wanted to local disk e.g /temp/pageone & /temp/pagetwo 
(I'm assuming these are accessible by the web daemon).

Then you could use a simple HTML page to create the frames e.g. below:-

<HTML><HEAD><TITLE>Title</TITLE></HEAD>

   <FRAMESET COLS="20%,*" border=no>
      <FRAME SRC="/temp/pageone.html" NAME="ONE">
      <FRAME SRC="/temp/pagetwo.html" NAME="TWO">
      </FRAMESET>
</HTML>

Or something along those lines, of course you would need to remove the 
temp pages after a time, assuming that as they are created dynamically 
the content changes.

Please note I'm no HTML expert as I'm a pharmacist but that's how I'd do 
it on my intranet web server.

HTH

Richard
-- 
Richard Eyles
Computer Services Pharmacist
Birmingham Heartlands Hospital, Birmingham UK




------------------------------

Date: Wed, 21 Jan 1998 11:18:42 -0600
From: Uday <uday@ionet.net>
Subject: Script for rlogin to UNIX from a PC
Message-Id: <34C62DF2.14941507@ionet.net>

Hi Gurus,

I am trying to write a PERL script that will automate the rlogin process

to UNIX. The script needs to include the UNIX host name, the host
userid and pwd. Can someone help me?

uday
uday@ionet.net



------------------------------

Date: 21 Jan 1998 16:54:04 +0000
From: Piers Cawley <pdcawley@bofh.org.uk>
Subject: Re: source into binary code
Message-Id: <54u3axhioj.fsf@gunnar.aladdin.net>

Wed, 21 Jan 1998 10:19:35 +0100 tobez@plab.ku.dk comp.lang.perl.misc
> John Stanley wrote:
> 
> > Jason Christian  <jason@primal.ucdavis.edu> wrote:
> > >(1) I am not trying to educate you about commercial software, I am
> > >trying to educate you about (some|one) buyer(s) of software (services).
> > >Why did I agree to such terms in the first place?  Because,
> > >unsophisticated dolt that I am, I wasn't totally clued in to the costs
> > >of proprietary contracts.
> > 
> > Then you have just proven my point. There must have been SOME reason you
> > agreed to those terms, and thus there are SOME REASONS that people will
> > pay for things that they could get a free version of. That is the answer
> > to the question "why would anyone..."
> 
> Well, all that seems to be extremely tautological.
> 
> There is always SOME reason for ANYONE to do SOMETHING.

<quotation source="The Goon Show!">
Seagoon: What are you doing in there Eccles?
Eccles:  Oh! Everyone's gotta be somewhere!
</quotation>


-- 
Piers Cawley -- Systems Genie for Aladdin
If a `religion' is defined to be a system of ideas that contains
unprovable statements, then Godel taught us that mathematics is not
only a religion, it is the only religion that can prove itself to be
one. -- John Barrow


------------------------------

Date: 21 Jan 1998 10:27:38 -0500
From: Justin Vallon <vallon@pearl.fi.bear.com>
Subject: Re: sysread vs <>
Message-Id: <x6eoh15n8yd.fsf@pearl.fi.bear.com>

ml@gondwanaland.com (Mike Linksvayer) writes:

> In my tests
> 
>    my $buf;
>    open(F,"foo") || die $!;
>    my @stat = stat F;
>    sysread(F,$buf,$stat[7],length($buf));
>    close(F);
> 
> is over ten times as fast as
> 
>    my $buf;
>    open(F,"foo") || die $!;
>    while (<F>) { $buf .= $_; }
>    close(F);
> 
> Is there any reason I should not use sysread to slurp up files in
> a production environment?

Are you sure it's not .= that's killing you?  That might be expensive do 
not grow exponentially.

Try timing:

   my $buf;
   open(F,"foo") || die $!;
   $buf = join "", <F>;
   close(F);

Other than that, sysread seems optimal in memory allocation if you don't 
want to read line-by-line.

-- 
-Justin
vallon@bear.com


------------------------------

Date: 21 Jan 1998 17:18:37 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: sysread vs <>
Message-Id: <6a5ald$m03$1@lyra.csx.cam.ac.uk>

Justin Vallon  <vallon@pearl.fi.bear.com> wrote:
>
>Are you sure it's not .= that's killing you?  That might be expensive do 
>not grow exponentially.

It'll be at worst quadratic.    But that could be bad enough.

>Try timing:
>
>   my $buf;
>   open(F,"foo") || die $!;
>   $buf = join "", <F>;
>   close(F);

Or the more obvious comparator

    my $buf;
    open(F,"foo") || die $!;
    { local $/; $buf = <F> };
    close(F);

I'd expect that to be almost indistinguishable from sysread.


Mike Guy


------------------------------

Date: 21 Jan 1998 11:20:51 -0600
From: will@Starbase.NeoSoft.COM (Will Morse)
Subject: Re: sysread vs <>
Message-Id: <6a5apj$nml$1@Starbase.NeoSoft.COM>

perl has many ways to do everything.  Of course you should
do this if it is best for what you want to do.  The one thing
to look out for is don't mix sysread with read or <>.

I use sysread a lot for funny tapes (SEG-Y) and it works great for me.
I have used both read (not <>) and sysread on disk files with no difference
in performance that I can see, but I haven't been benchmarking, I do
some computing between reads.  I find that reading large buffers
(256 meg or so) turns a lot of programs that would be I/O bound into programs
that are compute bound.  With a 256 meg buffer, I only need about 10
reads to go through most files. (I have BIG files, also 512 meg to 4 gig
real RAM an proportionally large swap).  If I tried to read a record (trace)
at a time, I'd be waiting on I/O all day and losing out to other programs
in the CPU feeding frenzy.

Will

In article <6a3qvs$se2$1@shell3.ba.best.com>,
Mike Linksvayer <ml@gondwanaland.com> wrote:
>In my tests
>
>   my $buf;
>   open(F,"foo") || die $!;
>   my @stat = stat F;
>   sysread(F,$buf,$stat[7],length($buf));
>   close(F);
>
>is over ten times as fast as
>
>   my $buf;
>   open(F,"foo") || die $!;
>   while (<F>) { $buf .= $_; }
>   close(F);
>
>Is there any reason I should not use sysread to slurp up files in
>a production environment?
>
>--
>Mike Linksvayer   http://gondwanaland.com/ml/


-- 
# Copyright 1997 Will Morse.  Internet repost/archive freely permitted.
# Hardcopy newspaper, magazine, etc. quoting requires permission.
# 
#      Gravity,                    #    Will Morse
#      not just a good idea,       #    Houston, Texas
#              it's the law.       #    will@starbase.neosoft.com
#
#   These are my views and do not necessarly reflect anyone else/
 =========================================================================
      By US Code Title 47, Sec.227(a)(2)(B), a computer/modem/printer
      meets the definition of a telephone fax machine. By Sec.227(b)
      (1)(C), it is unlawful to send any unsolicited advertisement to
      such equipment, punishable by action to recover actual monetary
      loss, or $500, whichever is greater, for EACH violation.
 =========================================================================



------------------------------

Date: Wed, 21 Jan 1998 09:26:27 -0600
From: Dave Barnett <barnett@houston.Geco-Prakla.slb.com>
Subject: Re: Were can I get PERL
Message-Id: <34C613A3.290369E2@houston.Geco-Prakla.slb.com>

Rolf Xsthus wrote:
> 
> Were can I get PERL from?
> 
Get it from the horse's mouth.....
http://www.perl.com

has links to both source code only, and pre-compiled Windoze versions.

HTH.

Dave
> Anders Xsthus
> E-Mail: roesthus@online.no

-- 
"Security through obscurity is no security at all."
		-comp.lang.perl.misc newsgroup posting

------------------------------------------------------------------------
* Dave Barnett               U.S.: barnett@houston.Geco-Prakla.slb.com *
* DAPD Software Support Eng  U.K.: barnett@gatwick.Geco-Prakla.slb.com *
------------------------------------------------------------------------


------------------------------

Date: Wed, 21 Jan 1998 09:43:14 -0800
From: Jason Christian <jason@primal.ucdavis.edu>
Subject: Where Software Freedom is Discussed
Message-Id: <Pine.OSF.3.95.980121093231.31207f-100000@primal.ucdavis.edu>

At the end of an earlier post to the Big Boring Off-Topic Thread, I invited 
suggestions as to where to take the discussion.  None appeared. Clearly
clpm was the wrong place, except and unless one wished to find people
with strong opinions.  

While the John Stanleys of the world are probably not there, much is
the pity, there *is* an informed discussion of many of the issues of
openness, freedom, subsequent development, etc., etc. going on in
gnu.misc.discuss.  That would seem to be a more appropriate place for
our discussion...noting of course that one is always wise to read a
group a bit before leaping in.

For my part, I apologize for any tedium or annoyance I may have caused
by prolonging a clearly off-topic thread.  If anyone wishes to
continue the conversation, please email me.  Happily, my skill with
the middle finger of the left hand (no, no: not upraised; resting on
the "D" key) makes it unnecessary for my to munge my email address.

Hooray for the perloisie...you make livin' fun.


---------------------------------------------------------------------------
Jason Christian                          University of California, Davis 
jason@primal.ucdavis.edu                  Agricultural and Resource Economics
Office:(530)752-1357 FAX:(530)752-5614   Davis, CA 95616




------------------------------

Date: Wed, 21 Jan 1998 09:41:13 -0600
From: dg50@chrysler.com
Subject: Re: Why warn? (WAS: Re: Critique My Code! (Please))
Message-Id: <885397068.1110573072@dejanews.com>

In article <6a3iel$rrt$4@comdyn.comdyn.com.au>,
  mgjv@comdyn.com.au (Martien Verbruggen) wrote:

> It isn't though. If you had had a look at the documentation with
>
> perldoc -f warn
>
> you would have known that warn does a lot more than just dump a message
> on STDERR. That is just the _default_ behaviour. You can however set a
> handler for $SIG{__WARN__}, which allows you to do almost anything on
> a warning.
>
> Martien

Ah, silly me, I used the Blue Camel for reference, not perldoc.

AFAICS, the Blue Camel makes no reference to $SIG(__WARN__) in the
function reference.

So then, if warn also raises __WARN__, then its use involves more
overhead then plain old print STDERR - assuming one is not interested in
a __WARN__ handler of some sort.

DG

-------------------==== Posted via Deja News ====-----------------------
      http://www.dejanews.com/     Search, Read, Post to Usenet


------------------------------

Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin) 
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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.misc (and this Digest), send your
article to perl-users@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.

The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.

The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.

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 V8 Issue 1693
**************************************

home help back first fref pref prev next nref lref last post