[14003] in Perl-Users-Digest
Perl-Users Digest, Issue: 1413 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Nov 17 21:12:45 1999
Date: Wed, 17 Nov 1999 18:05:16 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <942890716-v9-i1413@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 17 Nov 1999 Volume: 9 Number: 1413
Today's topics:
Abuse (was Re: Fetch Dilbert.) (Kragen Sitaker)
Re: access Oracle on NT from Linux/Perl: is that possib (Jon Drukman)
Re: backticks or system() (Martien Verbruggen)
Re: backticks or system() <rootbeer@redcat.com>
binary database <alanis@softhome.net>
Converting Segment Seperators in NT <raolson@westernind.com>
Re: Converting Segment Seperators in NT (Kragen Sitaker)
Re: Converting Segment Seperators in NT <cassell@mail.cor.epa.gov>
Re: cron filehandle <cassell@mail.cor.epa.gov>
Re: Date localtime help...Newbie <sariq@texas.net>
Re: Date localtime help...Newbie (Kragen Sitaker)
Re: Date localtime help...Newbie (Kragen Sitaker)
Re: Date localtime help...Newbie <lr@hpl.hp.com>
Re: Date localtime help...Newbie marius_13@my-deja.com
Re: differences between 5.004_04 and 4.0.1.8 (Kragen Sitaker)
Re: differences between 5.004_04 and 4.0.1.8 <jeantt@sr.hp.com>
Re: differences between 5.004_04 and 4.0.1.8 <cassell@mail.cor.epa.gov>
Re: FAQ 5.3: How do I count the number of lines in a fi <jerickson@cendes.com>
Re: FAQ 5.3: How do I count the number of lines in a fi <lr@hpl.hp.com>
Re: Flat File Searching Problem <cassell@mail.cor.epa.gov>
Re: frames affected by reload (Martien Verbruggen)
Re: frames affected by reload <rootbeer@redcat.com>
Re: Function keys for current value <samay1NOsaSPAM@hotmail.com.invalid>
hash of filehandles <eclectic@mail.utexas.edu>
Re: Is $$variable allowed like in PHP ? (Mark-Jason Dominus)
Re: looking for a developer . . . <russellm@bellsouth.net>
Re: looking for a developer . . . <lr@hpl.hp.com>
Re: looking for a developer . . . <cassell@mail.cor.epa.gov>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 18 Nov 1999 00:07:06 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Abuse (was Re: Fetch Dilbert.)
Message-Id: <KqHY3.22511$YI2.1026970@typ11.nn.bcandid.com>
In article <80vari$4bo$1@gellyfish.btinternet.com>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>Looks like its someone who works for Biosym Technologies Incorporated
>of San Diego - nice of Deja news to put that in the header they send.
I get:
146.202.24.27
Name: gerard-pc.msi.com
Address: 146.202.24.27
Registrant:
Molecular Simulations (MSI-DOM)
9685 Scranton Road
San Diego, CA 92121
USA
Domain Name: MSI.COM
. . .
Record last updated on 04-Aug-1997.
Record created on 01-Oct-1991.
Database last updated on 17-Nov-1999 12:19:08 EST.
BIOC1.BIOSYM.COM 146.202.0.2
NOC.CERF.NET 192.153.156.22
So maybe MSI is a subsidiary of Biosym? Anyway, it's presumably
someone named Gerard. :) I can't seem to reach that network at the
moment; my traceroute stops at CERFNet.
DejaNews also mentioned that they are running Netscape 4.7 for Windows
NT, English version.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Thu, 18 Nov 1999 00:07:18 GMT
From: jsd@gamespot.com (Jon Drukman)
Subject: Re: access Oracle on NT from Linux/Perl: is that possible?
Message-Id: <slrn836gok.3vvnpa5.jsd@edit-q.gamespot.com>
On Wed, 17 Nov 1999 12:50:49 +0100, bmlam <310064202272#0001@online.de> wrote:
>> Yes. Try perl module DBI and DBD:Oracle. You also need to install
>> the oracle client library on the Linux side, and start oracle listener
>
>I would appreciate it very much if you could point out where and how one can
>obtain the client library. Thanks
you can't obtain the client without the entire server. fortunately
the server is available for free evaluation downloads.
ftp://ftp.oracle.com/pub/www/otn/linux/815shipstd.tgz
it's a 250MB file so make sure you are using an ftp client that
supports resuming interrupted transfers.
-jsd-
------------------------------
Date: 17 Nov 1999 23:52:40 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: backticks or system()
Message-Id: <slrn836fve.q2r.mgjv@wobbie.heliotrope.home>
[Your machine seems to have a chronology problem. Your reply arrived
before the text that you replied to. Please reset your clock.]
On Wed, 17 Nov 1999 14:25:00 -0800,
Gregor Mosheh <mosheh@post.net> wrote:
[corrected order]
> Jonathan Stowe wrote:
>
> > natureboy <robert.castellowNOroSPAM@s1.com.invalid> wrote:
> > > are there any differences (besides syntax) between using
> > > backticks and system functions?
> > >
> >
> > Er yes, what does it say in the perlfunc and perlop manpages - I dont have
> > mine handy right now.
I think you'll be able to detect a slight amount of sarcasm in this
sentence, now that I point it out. Wherever there's perl, there's perl
documentation. I doubt very much that Jonathan would be on a machine
where there is no perl.
> The big diff is that system() performs the action and returns the exit
> status * 256, and `` performs the action and returns an array
> containing the text output of the command.
Never an array. In list context it returns a list, which you can assign
to an array, and in scalar context it returns a string.
> Thus:
>
> $x = system("ls") would set $x to 0 (if the ls worked)
More accurately: It would set $x to whatever ls chooses to return for a
successful exit. Customarily, that is 0, but there are some broken
programs out there.
> @x = `ls` would set @x to contain the list ('file1', 'file2',
> 'another_file');
You're forgetting the newlines that ls returns. They're part of the
individual list elements.
Try it. Or better, try it before you post next time :)
# perl -w
foreach (`ls`) { print }
__END__
See a listing appear here magically, including the newlines.
Martien
--
Martien Verbruggen |
Interactive Media Division | Make it idiot proof and someone will
Commercial Dynamics Pty. Ltd. | make a better idiot.
NSW, Australia |
------------------------------
Date: Wed, 17 Nov 1999 16:36:00 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: backticks or system()
Message-Id: <Pine.GSO.4.10.9911171634450.16575-100000@user2.teleport.com>
On Wed, 17 Nov 1999, Gregor Mosheh wrote:
> @x = `ls` would set @x to contain the list ('file1', 'file2',
> 'another_file');
Well, kinda. Hint: look for 'chomp' in the perlfunc manpage. Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 17 Nov 1999 18:01:00 -0800
From: "Steven Lybeck" <alanis@softhome.net>
Subject: binary database
Message-Id: <80vmrf$s6f$1@ultra.sonic.net>
I am in search of a binary database written entirely in perl. I have found
many flat-file (text-delimated?) database programs, but this is not what I
am looking for as it will be much to slow if the amount of records to be
searched is in the hundreds of thousands. Which it will need to be. Also
nice would be a way to query it with SQL commands. If anyone knows of this,
or of another solution to my problem, please post it here.
P.S. - I will be using the script in an mp3 search engine, just FYI
Thanx everyon!
~ Steven E. Lybeck
steven@neteze.com
alanis@softhome.net
------------------------------
Date: Wed, 17 Nov 1999 17:02:23 -0600
From: <raolson@westernind.com>
Subject: Converting Segment Seperators in NT
Message-Id: <OwGY3.741$3h2.290898@homer.alpha.net>
Good Day All,
I have a problem with a script running under NT. I am trying to convert a
string of data into its seperate segments, breaking it at the tilde(~).
Under unix, s/~/~\r\n/g works great, but no matter if I use \r\n or
\015\012, NT will not convert! Does anybody know whay or have a solution to
this?
Thanks,
Ross
raolson@westernind.com
------------------------------
Date: Thu, 18 Nov 1999 00:10:10 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Converting Segment Seperators in NT
Message-Id: <CtHY3.22515$YI2.1026020@typ11.nn.bcandid.com>
In article <OwGY3.741$3h2.290898@homer.alpha.net>,
<raolson@westernind.com> wrote:
>I have a problem with a script running under NT. I am trying to convert a
>string of data into its seperate segments, breaking it at the tilde(~).
>Under unix, s/~/~\r\n/g works great, but no matter if I use \r\n or
>\015\012, NT will not convert! Does anybody know whay or have a solution to
>this?
What does NT do instead?
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Wed, 17 Nov 1999 17:24:02 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Converting Segment Seperators in NT
Message-Id: <38335532.81324DA2@mail.cor.epa.gov>
raolson@westernind.com wrote:
>
> Good Day All,
Howdy There,
> I have a problem with a script running under NT. I am trying to convert a
> string of data into its seperate segments, breaking it at the tilde(~).
Perhaps you should read about the split() function. That may
help with what you want done.
> Under unix, s/~/~\r\n/g works great,
It does? Really? That's odd. I would think that would shove
an unwanted \r onto the end of every one of your lines. Do
your data show up with a bunch of things that look like '^M'
at the ends?
> but no matter if I use \r\n or
> \015\012, NT will not convert! Does anybody know whay or have a solution to
> this?
s/~/~\n/g;
This should work for NT too. Perl does the newline conversion
for you, so you don't have to think about portability issues.
But consider doing a split() on ~ instead.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 17 Nov 1999 17:12:12 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: cron filehandle
Message-Id: <3833526C.D1B0EAB2@mail.cor.epa.gov>
Kragen Sitaker wrote:
[snip]
> It will run fred's cron jobs as fred, so that will be OK. Running them
> as root would be bad.
Oops. You're right. Mea culpa.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 17 Nov 1999 17:02:52 -0600
From: Tom Briles <sariq@texas.net>
Subject: Re: Date localtime help...Newbie
Message-Id: <3833341C.994797C1@texas.net>
Larry Rosler wrote:
>
> In article <38330FE2.C9A8576F@texas.net> on Wed, 17 Nov 1999 14:28:18 -
> 0600, Tom Briles <sariq@texas.net> says...
> >
> > my ($day,$mon,$year) = (localtime)[3..5];
> > my $updated_on = sprintf('%4d%2d%2d', 1900+$year, ++$mon, $day);
>
> Not quite. Try ($day, $mon, $year) = (1, 1, 100), for example.
>
Sigh. One of the disadvantages to a high traffic newsgroup is that
someone else will post a correction to your posts before you can...
- Tom
------------------------------
Date: Wed, 17 Nov 1999 23:39:27 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Date localtime help...Newbie
Message-Id: <P0HY3.22441$YI2.1021751@typ11.nn.bcandid.com>
In article <80v576$44t$1@gellyfish.btinternet.com>,
Jonathan Stowe <gellyfish@gellyfish.com> wrote:
>$updated = sprintf "%.4d%.02d%.02d", $year + 1900,$month + 1, $day ;
What are the zeroes for?
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Wed, 17 Nov 1999 23:40:38 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Date localtime help...Newbie
Message-Id: <W1HY3.22447$YI2.1021952@typ11.nn.bcandid.com>
In article <MPG.129cbbc997044f3f98a222@nntp.hpl.hp.com>,
Larry Rosler <lr@hpl.hp.com> wrote:
>In article <FCEY3.22029$YI2.982547@typ11.nn.bcandid.com> on Wed, 17 Nov
>1999 20:55:01 GMT, Kragen Sitaker <kragen@dnaco.net> says...
>> It's so we'll have a four-digit year, even for years before 1000.
>
>Am I overlooking a smiley? Can (localtime($whatever))[5] be -901 or
>less?
With a 64-bit time_t, theoretically, yes.
Didn't you see my post about the Time::Travel module? :)
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Wed, 17 Nov 1999 16:38:52 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: Date localtime help...Newbie
Message-Id: <MPG.129cea7ce8e536c498a229@nntp.hpl.hp.com>
In article <P0HY3.22441$YI2.1021751@typ11.nn.bcandid.com> on Wed, 17 Nov
1999 23:39:27 GMT, Kragen Sitaker <kragen@dnaco.net> says...
> In article <80v576$44t$1@gellyfish.btinternet.com>,
> Jonathan Stowe <gellyfish@gellyfish.com> wrote:
> >$updated = sprintf "%.4d%.02d%.02d", $year + 1900,$month + 1, $day ;
>
> What are the zeroes for?
For luck. Same as the '.4', which everyone likes so much. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Thu, 18 Nov 1999 01:51:04 GMT
From: marius_13@my-deja.com
Subject: Re: Date localtime help...Newbie
Message-Id: <80vm27$qct$1@nnrp1.deja.com>
In article <80usjs$7if$1@nnrp1.deja.com>,
crackbaby1@my-deja.com wrote:
> I just need to create a varaible with todays date in it...
>
> this is what I have:
> $updated_on = ???
>
> this is what I need:
> $updated_on = "19991117"
>
> thank you...
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
>
Try using localtime(time). It returns several components.
Example:
($sec,$min,$hour,$monthdate,$month,$year,$weekday,$yeardate,$daylight) =
localtime(time);
Brian
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 17 Nov 1999 23:49:59 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: differences between 5.004_04 and 4.0.1.8
Message-Id: <HaHY3.22469$YI2.1023602@typ11.nn.bcandid.com>
In article <Pine.GSO.4.10.9911171401540.15797-100000@user2.teleport.com>,
Tom Phoenix <rootbeer@redcat.com> wrote:
>On Wed, 17 Nov 1999, Kragen Sitaker wrote:
>> There never was a 4.0.1.8 version of Perl, though.
> $ perl4 -v
> This is perl, version 4.0
> $RCSfile: perl.c,v $$Revision: 4.0.1.8 $$Date: 1993/02/05 19:39:30 $
> Patch level: 36
> Copyright (c) 1989, 1990, 1991, Larry Wall
>
>Ah, you're right. It was _revision_ 4.0.1.8. :-)
Thanks, Tom!
All this time I thought people were using 4.018. I kept asking myself,
"Why is there such a concentration of people using 4.018? I can
understand many people using 4.036, but 4.018?" Now I know that the
correct response is, "Perl, version 4.0, patch level 36?"
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
The Internet stock bubble didn't burst on 1999-11-08. Hurrah!
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Wed, 17 Nov 1999 15:46:24 -0800
From: Jean Tillinghast <jeantt@sr.hp.com>
Subject: Re: differences between 5.004_04 and 4.0.1.8
Message-Id: <38333E50.61577EEF@sr.hp.com>
I don't have the option of picking which version the company updates too.
I just get to try an find out the differences that I have to work with.
jean
"Brett W. McCoy" wrote:
> Also Sprach Jean Tillinghast <jeantt@sr.hp.com>:
>
> >I have a program written using Perl version 4.0.1.8 and it will not run
> >with version 5.001 or 5.004_04. Since I have to upgrade to either of
> >the 5.XXX versions I figured it would be easiest to move to 5.004_04.
>
> Why not upgrade to 5.005_03? That's the most current version.
>
> --
> Brett W. McCoy bmccoy@foiservices.com
> Computer Operations Manager (Alpha Geek) http://www.foiservices.com
> FOI Services, Inc./DIOGENES 301-975-0110
> ---------------------------------------------------------------------------
------------------------------
Date: Wed, 17 Nov 1999 17:33:44 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: differences between 5.004_04 and 4.0.1.8
Message-Id: <38335778.57083EC@mail.cor.epa.gov>
[In future Jean, could you please place your replies *after* the
previous text instead of before? It makes these threads much
easier to read and to respond to. Thanks in advance.]
Jean Tillinghast wrote:
>
> I don't have the option of picking which version the company updates too.
> I just get to try an find out the differences that I have to work with.
Okay, then opt for 5.004_04 instead of 5.001 .
But going with 5.005_03 would take care of a couple bugs which
have since been corrected.
The perltrap pages [which you can read by typing 'perldoc
perltrap' at the command prompt] have a section on traps to
watch for when going from perl 4 to perl 5.
A large number of these can be caught just by using the -w
flag and the 'use strict' pragma.. which you should be
using anyway. They're A Good Thing (tm, Martha Stewart).
[big snip of misplaced but relevant stuff by previous poster]
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Wed, 17 Nov 1999 22:29:53 +0000
From: Jon Erickson <jerickson@cendes.com>
To: tchrist@mox.perl.com
Subject: Re: FAQ 5.3: How do I count the number of lines in a file?
Message-Id: <38332C61.B89DB66C@cendes.com>
Tom Christiansen wrote:
> (This excerpt from perlfaq5 - Files and Formats
> ($Revision: 1.38 $, $Date: 1999/05/23 16:08:30 $)
> part of the standard set of documentation included with every
> valid Perl distribution, like the one on your system.
> See also http://language.perl.com/newdocs/pod/perlfaq5.html
> if your negligent system adminstrator has been remiss in his duties.)
>
> How do I count the number of lines in a file?
>
> One fairly efficient way is to count newlines in the file. The
> following program uses a feature of tr///, as documented in the
> perlop manpage. If your text file doesn't end with a newline, then
> it's not really a proper text file, so this may report one fewer
> line than you expect.
>
> $lines = 0;
> open(FILE, $filename) or die "Can't open `$filename': $!";
> while (sysread FILE, $buffer, 4096) {
> $lines += ($buffer =~ tr/\n//);
> }
> close FILE;
>
> This assumes no funny games with newline translations.
>
> --
> "Wickedness is a myth invented by good people to account for the curious
> attractiveness of others."
> - Oscar Wilde
Tom, why is this better then doing a system call:
ex. system("wc -l", $filename);
Jon Erickson
jerickson@cendes.com
------------------------------
Date: Wed, 17 Nov 1999 15:41:17 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: FAQ 5.3: How do I count the number of lines in a file?
Message-Id: <MPG.129cdcf4433be6f398a227@nntp.hpl.hp.com>
In article <38332C61.B89DB66C@cendes.com> on Wed, 17 Nov 1999 22:29:53
+0000, Jon Erickson <jerickson@cendes.com> says...
> Tom Christiansen wrote:
...
> > How do I count the number of lines in a file?
...
> > $lines = 0;
> > open(FILE, $filename) or die "Can't open `$filename': $!";
> > while (sysread FILE, $buffer, 4096) {
> > $lines += ($buffer =~ tr/\n//);
> > }
> > close FILE;
...
> Tom, why is this better then doing a system call:
>
> ex. system("wc -l", $filename);
As Tom doesn't play here lately, I'll venture to answer for him.
1. Portability. Strange as it may seem to you, not every OS has a 'wc'
command.
2. Efficiency. Spawning a new process is expensive, relative to doing
it yourself.
This answer is generic to all OS functions that are built into perl,
such as chmod, rename, ..., and to code that is easy to implement, such
as that above.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 17 Nov 1999 17:15:07 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Flat File Searching Problem
Message-Id: <3833531B.6F2824C5@mail.cor.epa.gov>
Kenneth Bandes wrote:
>
> Larry Rosler wrote:
> > (I've heard of something called PerlScript, but I don't want to upchuck
> > my breakfast over something like that.)
[snip]
> "Script" refers in this case to conformance to a set of interfaces
> known collectively as "ActiveX Scripting."
>
> What it isn't: to Perl as JavaScript is to Java.
Another "what it isn't":
to Perl as VBScript is to VB
I have a VB guy currently asking me for more details about
what you can and cannot do in PerlScript, since he is so used
to VBScript doing such a pathetic subset of VB.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 17 Nov 1999 23:45:19 GMT
From: mgjv@wobbie.heliotrope.home (Martien Verbruggen)
Subject: Re: frames affected by reload
Message-Id: <slrn836fhk.q2r.mgjv@wobbie.heliotrope.home>
On Wed, 17 Nov 1999 22:08:57 GMT,
neuermarkt@my-deja.com <neuermarkt@my-deja.com> wrote:
> Hi,
>
> I have a site with several frames and I want the reload button effect
> only on some of the frames. The others should be excluded from
> reloading.
>
> Has someone any idea if I can solve that problem with perl?
No, you can't. perl does not run in the browser, it runs on the server
side. It's a browser issue, or maybe a (bastardised) HTML issue. Try one
of the groups in the comp.infosystems.www.* hierarchy.
Martien
--
Martien Verbruggen |
Interactive Media Division | Begin at the beginning and go on till
Commercial Dynamics Pty. Ltd. | you come to the end; then stop.
NSW, Australia |
------------------------------
Date: Wed, 17 Nov 1999 16:33:48 -0800
From: Tom Phoenix <rootbeer@redcat.com>
Subject: Re: frames affected by reload
Message-Id: <Pine.GSO.4.10.9911171632540.16575-100000@user2.teleport.com>
On Wed, 17 Nov 1999 neuermarkt@my-deja.com wrote:
> I have a site with several frames and I want the reload button effect
> only on some of the frames. The others should be excluded from
> reloading.
Sounds like something you want a browser to do. Perhaps you should search
for the docs, FAQs, and newsgroups about browsers and how to talk to them.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 17 Nov 1999 15:09:13 -0800
From: Samay <samay1NOsaSPAM@hotmail.com.invalid>
Subject: Re: Function keys for current value
Message-Id: <0a0133f8.0ca37d9c@usw-ex0102-016.remarq.com>
Thanks for your help.
Currently, I am left with asking users to click the original window to
run the command. Windows API looks like like to the solution. I will
'focus' on it.
SAMAY.
* Sent from RemarQ http://www.remarq.com The Internet's Discussion Network *
The fastest and easiest way to search and participate in Usenet - Free!
------------------------------
Date: Wed, 17 Nov 1999 15:27:26 -0800
From: "Joel A. Tropp" <eclectic@mail.utexas.edu>
Subject: hash of filehandles
Message-Id: <383339DC.86785D99@ticam.utexas.edu>
Assume you have a text file containing categorized information. Each
line contains one data point (which is a sequence of numbers) and a
category label as the last item on the line. The data are comma or space
delimited. The data are not sorted by category.
I am trying to write a program to separate the each category into its
own file (removing the now redundant category label from the data). I am
trying to use a hash of filehandles to keep track of the files and to
refer to them easily. But the code works only occasionally. Some files
receive too many lines, while others receive nothing. The if construct
switches correctly, so it must be a problem with the hash. The man pages
haven't enlightened me, so I turn to you gentlemen (and ladies) for
assistance.
The code snippet follows. Thx.
joel
* * * * *
sub prepdata {
my ($fname) = @_;
# Open the file and die if there's an error
die( "$fname is broken." ) if (! open( CURF, "<$fname" ) );
# For each line in the file...
while ( $lyne = <CURF> ) {
# Divide it into pieces delimited by spaces or commas
# The category is the last item on the line
$lyne =~ s/,/ /g;
@line = split( " ", $lyne );
$cat = pop( @line );
if ( $cat eq "" ) {
# Don't do anything if the category label is empty
} elsif ( ! $csize{ $cat } ) {
# A new category!
# Open a new file for it;
# Put that first data point in;
# Initialize the count for the category to 1
$filez{ $cat } = "feh"; # Black Magic
open( $filez{ $cat }, ">$fname"."_.$cat" );
select( $filez{ $cat } );
print ( join( " ", @line ) . "\n" );
$csize{ $cat } = 1;
} else {
# We've already encountered this category,
# Add the data point to the category file
# And increment the data count for that category
select( $filez{ $cat } );
print ( join( " ", @line ) . "\n" );
$csize{ $cat }++;
}
}
# Close the pile of files
foreach $cat ( keys( %filez ) ) {
close $filez{ $cat };
}
close CURF;
return ( %csize );
}
------------------------------
Date: Wed, 17 Nov 1999 23:26:01 GMT
From: mjd@op.net (Mark-Jason Dominus)
Subject: Re: Is $$variable allowed like in PHP ?
Message-Id: <80vdh5$f79$1@monet.op.net>
Keywords: cavalier deferral impose it'll
In article <FDn*U3ado@news.chiark.greenend.org.uk>,
Ben Evans <bene@chiark.greenend.org.uk> wrote:
>So the basic problems are:
>* that they're global variables
>
>* that if you went to sleep and forgot what you're
> doing, you might accidentally do something stupid, ie
> blow away something you really wanted or call the wrong
> subroutine or get a run-time error.
>
>So for quick and dirty scripts of up to a few hundred lines
>where I pretty much know exactly what I want to be doing,
>and I'm not depending on user input in any but the most
>restricted way, there's no real problem[1] with soft references?
Yeah, well, there's no problem with smoking in bed, either, as long as
you don't fall asleep and burn the house down.
I think you missed the point here. Global variables have problems,
right, you got that. When you use symbolic references, you're using
global variables in a totally unconstrained way; you seem not to have
picked up on that. Here's an example: Earlier in this thread, we
heard from a guy who has a CGI program that does this:
ReadParse();
while (($name, $val) = each %in) { $$name = $val }
He `knows' that this is safe because he `knows' that the names in the
form will not conflict with his other variables.
That is akin to someone who says it is OK to smoke in bed because they
`know' they aren't going to fall asleep.
The reality, of course, is that anyone editing the form has to
cross-check against the program to make sure that the names they want
are not already reserved, and vice versa.
The entire fifty-year history of programming languages has been
nothing more than one giant trend away from this kind of
cross-checking. Everything: high level languages, subroutines,
structured programming, modules, OOP, and all the other stuff is
devoted to inventing new and better ways to make it safe to put
together two components, such as a form and the program to process it,
so that you *don't* have to cross-check.
It's not possible to enumerate all the things that could go wrong
here. Someone could forget to check. Someone could decide not to
check because they `know' their name is safe. Someone could make a
mistake while checking. Someone could check correctly, and then make
a typo when typing the name. Someone could accidentally use a Perl
variable name that is meaningful but which does not appear explicitly
in the program, like Exporter::VERBOSE, and so evades the check.
Someone could use a name like $Exporter::VERBOSE, only to have a new
problem transpire months later because the program did not originally
use that module. Someone could maliciously post bogus data, including
the fake form fields named '0', '/', '\', '"', and '*', in a
calculated attempt to get the program to do something it shouldn't
have been doing. These are only a few of the many possible disasters.
You can't simply decide be careful, because the problem space is just
too big to envision all the possible things that could go wrong.
That's why we've spent fifty years trying to avoid having to try. You
don't get around a fifty-year research problem just by being really
careful; you have to be methodical also. Overlooking one of the
twelve thousand possible disasters isn't `doing something stupid', any
more than setting the house on fire when you're smoking in bed is; the
stupidity is in smoking in bed in the first place.
Something else I think you missed is that a lot of these disasters are
going to be impossible to diagnose. I don't know about you, but I
don't put bugs into my programs on purpose. They're in there by
accident. Even though I'm being careful. If you want to go ahead and
postulate a bug-free program that uses symbolic references, then sure,
obviously there are no problems with the symbolic references in that
case, but it's a circular argument---and a fallacious one, too.
Smoking in bed is dangerous, regardless of whether or not you manage
to stay awake. Sure, if you're a perfect programmer, you don't need
to avoid symbolic references; you don't need to avoid self-modifying
assembly language code either. And you might as well program in
assembly language, because it'll be a lot more efficient than using
Perl. But some of us mere mortals do have to consider the impact of
bugs.
The other side of the fifty-year trend away from global variables is
that we divide programs into separate components that communicate in
circumscribed ways. Why do we do this? It's so that when (not if,
but when) we screw up, we can figure out where the problem is. When
your CGI program aborts with an error, you don't have to worry that
maybe the problem is in one of the 1500 other programs in
/usr/local/bin, because those are totally unrelated pieces of software
that have nothing to do with the program you are trying to debug.
When subroutine X fails, you can start by looking at subroutine X, and
expand your search from there; you don't immediately have to suspect
the every one of the other 700 lines of code in your program. At
least, this is the normal presumption. When you use symbolic
references, all bets, and I really to mean all bets, are suddenly off.
When you write `my $x = 1', the effect is confined to the current
block. When you write `$main::x = 1', you can figure out the effect
by looking through the program to see who looks at $main::x. The
instant you write $$name = 1, you don't know any more what the effect
will be or where it will crop up; it could be anywhere. You have just
turned every 25-line debugging problem into a potential 700-line
debugging problem.
So here's the short summary: 1. Being careful does not mean trying to
understand the possible consequences while behaving dangerously; it
means avoiding dangerous behavior in the first place. 2. One of the
biggest problems in all of compter programming is namespace management
and data hiding issues; when you use a symbolic reference you are
throwing away forty years of expensive lessons on this subject. 3.
Plan for failure, not for success, because success takes care of
itself. You don't need a plan for when you *don't* screw up.
Sorry this is so long, but I realized that a lot of this stuff was not
obvious and that maybe nobody had ever said it explicitly before. My
two web pages were gropings in this direction, but I don't think I was
clear.
Hope this helps.
------------------------------
Date: Wed, 17 Nov 1999 17:27:50 -0600
From: Mark Russell <russellm@bellsouth.net>
Subject: Re: looking for a developer . . .
Message-Id: <383339F5.2B196F92@bellsouth.net>
> Coprophagous mutant.
Coprophagous?
Markic
------------------------------
Date: Wed, 17 Nov 1999 16:34:51 -0800
From: Larry Rosler <lr@hpl.hp.com>
Subject: Re: looking for a developer . . .
Message-Id: <MPG.129ce983d4598c2898a228@nntp.hpl.hp.com>
In article <383339F5.2B196F92@bellsouth.net> on Wed, 17 Nov 1999
17:27:50 -0600, Mark Russell <russellm@bellsouth.net> says...
>
> > Coprophagous mutant.
>
> Coprophagous?
Greek 'koprophagos', from kopr- + -phagos] : adj., feeding on dung
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 17 Nov 1999 17:25:51 -0800
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: looking for a developer . . .
Message-Id: <3833559F.E4958354@mail.cor.epa.gov>
Larry Rosler wrote:
>
> In article <383339F5.2B196F92@bellsouth.net> on Wed, 17 Nov 1999
> 17:27:50 -0600, Mark Russell <russellm@bellsouth.net> says...
> >
> > > Coprophagous mutant.
> >
> > Coprophagous?
>
> Greek 'koprophagos', from kopr- + -phagos] : adj., feeding on dung
A well-known adjective in biology and environmental science.
An important ecological niche in the real world.
Unfortunately, it is also an ecological niche in Usenet.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
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 V9 Issue 1413
**************************************