[18145] in Perl-Users-Digest
Perl-Users Digest, Issue: 313 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Feb 19 03:06:05 2001
Date: Mon, 19 Feb 2001 00:05:10 -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: <982569909-v10-i313@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 19 Feb 2001 Volume: 10 Number: 313
Today's topics:
Re: (OFF TOPIC) Re: This is driving me nuts and I need (Maggert)
Re: (OFF TOPIC) Re: This is driving me nuts and I need (Gwyn Judd)
Re: (OFF TOPIC) Re: This is driving me nuts and I need <beable@my-deja.com>
DB_File Please help <paul@pco.iis.nsk.su>
Re: DB_File Please help (Chris Fedde)
Re: DB_File Please help <paul@pco.iis.nsk.su>
How do you check for cursor keys? <dave@snorks.dyndns.org>
Re: How do you check for cursor keys? <tony_curtis32@yahoo.com>
Re: Invisible code? (Jim Kroger)
Re: Invisible code? (Jim Kroger)
Re: Invisible code? (Jim Kroger)
Re: Invisible code? (Chris Fedde)
Re: Invisible code? (Martien Verbruggen)
Re: Invisible code? <godzilla@stomp.stomp.tokyo>
Re: Invisible code? <uri@sysarch.com>
Re: Invisible code? (Damian James)
Re: kill unix process (Garry Williams)
Re: perl program (Gwyn Judd)
PERL Request <mindfield@badgers.emulationnet.com>
Re: PERL Request <c_clarkson@hotmail.com>
Re: Project with a large amount of external data (Chris Fedde)
Re: PROPOSAL: Graphics::ColorNames <wlkngowl@unix.asb.com>
Re: question on multidimensional arrays <c_clarkson@hotmail.com>
Re: sending data to a script via SSI <c_clarkson@hotmail.com>
Re: Writing a Perl Server (Abigail)
Re: Writing a Perl Server (Gwyn Judd)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 19 Feb 2001 06:22:11 GMT
From: perl@imchat.com (Maggert)
Subject: Re: (OFF TOPIC) Re: This is driving me nuts and I need a guru
Message-Id: <3a90bb13.8508925@news.ionet.net>
On Sun, 18 Feb 2001 21:26:38 GMT, tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
wrote:
>I just thought I should mention in case it has slipped by anyone's
>attention that questions from the FAQ are posted, in this group, right
>now. See those postings with "FAQ" in the subject. Well duh. And
>incidentally, if you read them, it tells you where to actually find the
>FAQ on the web. So don't tell me you don't know where the FAQ is because
>that tells me you didn't bother to even read the group for a single day
>before you posted.
>
Not to mention that you get an email from the group when you
subscribe telling you to read the faq and pointing you in that general
direction.
------------------------------
Date: Mon, 19 Feb 2001 07:44:47 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: (OFF TOPIC) Re: This is driving me nuts and I need a guru
Message-Id: <slrn991jne.ob2.tjla@thislove.dyndns.org>
I was shocked! How could Frank Miller <no@email.com>
say such a terrible thing:
>>"Abigail" <abigail@foad.org> wrote in message
>news:slrn990fvd.ph4.abigail@tsathoggua.rlyeh.net...
>
>> If you manage to remain oblivous of the FAQ doing what Frank claimed to
>> do, what good is it to answer his questions? He'll probably miss the
>> answers anyway.
>>
>
>I think responses like this pretty much prove my point.
Actually responses like *yours* have pretty much proved my growing
suspicion that you are an ass. Welcome to the deeper depths of my
killfile. See you in a few months.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
I thank whatever Gods may be for my unconquerable soul.
-William Ernest Henley
------------------------------
Date: Mon, 19 Feb 2001 08:07:20 GMT
From: Beable van Polasm <beable@my-deja.com>
Subject: Re: (OFF TOPIC) Re: This is driving me nuts and I need a guru
Message-Id: <m34rxrp0ia.fsf@beable.van.polasm.bigpond.net.au>
"Frank Miller" <no@email.com> writes:
> "Randal L. Schwartz" <merlyn@stonehenge.com> writes:
> > When you install software, you're expected to poke around a bit in it
> > before lurking out to support resources.
>
> I spent a lot more then 15 minutes poking around. I've read website after
> wesbite on perl. I've read the man pages. I have a stack of Perl books
> next to me. I just missed the FAQ. Sorry. It would appear that a lot of
> people miss the FAQ. Once again, I don't mind being told to read the FAQ.
> I just found it rude to be told to "read the FAQ" and then not even be point
> to it. Once agian. Just be nice about it.
I was thinking that when Perl is newly installed on a machine, it
should pop up a window each time it's run saying "HEY! READ THE
FAQ! It's at ...". And when you read the FAQ, it tells you how to
stop the window from popping up. But maybe I'm an extremist.
> > When you post to Usenet, you're expected to read the Usenet manual
> > first. "news.announce.newusers" is the location, to which you should
> > have been already subscribed.
>
> Once agiain. Sorry. The thing I find so strange is that of all the news
> groups I post to, the most obnoxious ones are the programming and technical
> ones. Groups unrelated to computers seem to get along a lot better. I've
> never been flamed for my posting style before and I've been on and off of
> readnews since 1986. Once again. My point is not what I or others did or
> did not do, it's that there are better ways to get people to do what you
> want then jumping on them.
There are lots of groups where you will get flamed for doing things
like top-posting. I'm surprised you haven't encountered one before.
> FYI: I just went and looked at news.announce.newusers. I contains one
> entry: "how to become a Usenet site". If the information about how to
> format your posts is buried in this document, then I doubt very many people
> are going to see it. I realise there are a lot of lazy jerks that post, but
> just give people a little benefit of the doubt.
Randal must have meant news.newusers.questions. You can see the
suggestions for not ruffling peoples' feathers at the group's
webiste:
http://www.geocities.com/nnqweb/
> LIke I said above. Other groups seem to be a lot more torerant then the
> technical ones. I've just never had a problem before coming to this group.
I think the best thing you can do is to just forget about this, and
stick to programming perl. Keep reading the newsgroup, and see what
you think in a month or so when you've seen a few thousand people
ask questions that are answered in the FAQ.
> I will conform.
RESISTANCE IS FUTILE!
cheers
Beable van Polasm
--
I'm wearing coat hangers on my feet. -- Chris Costello
IQC 78189333
http://members.nbci.com/_______/index.html
------------------------------
Date: Mon, 19 Feb 2001 10:08:48 +0600
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: DB_File Please help
Message-Id: <96q6fn$1rsb$1@news.itfs.nsk.su>
Hello,
First of all, sorry if my question is not perl question. But I encountered
problem with perl scripts.
I had set of *.db files on Unix server, those files was created and used by
my perl cgi scripts.
But once, my perl scripts could not treat these *.db files. (I think
something was changed on server that affect to how server treat the *.db
files.
What could happened? What can problem be? And how to bring back to life
these databases?
How can I prevent these problems?
Please help me, or point out what source of information would help me.
Thanks in advance,
Paul Dortman
------------------------------
Date: Mon, 19 Feb 2001 04:24:59 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: DB_File Please help
Message-Id: <ve1k6.244$zN2.188926464@news.frii.net>
In article <96q6fn$1rsb$1@news.itfs.nsk.su>,
Paul Dortman <paul@pco.iis.nsk.su> wrote:
>Hello,
>
>First of all, sorry if my question is not perl question. But I encountered
>problem with perl scripts.
>
>I had set of *.db files on Unix server, those files was created and used by
>my perl cgi scripts.
>But once, my perl scripts could not treat these *.db files. (I think
>something was changed on server that affect to how server treat the *.db
>files.
>
>What could happened? What can problem be? And how to bring back to life
>these databases?
>How can I prevent these problems?
>
>Please help me, or point out what source of information would help me.
>
>Thanks in advance,
>
>Paul Dortman
>
DB_File uses the BerkeleyDB. This had an incompatable file format change
between versions 2.7.7 and the first 3.x versions. Some free unixes
changed versions in their releases last year. Your problems may stem from
that.
chris
--
This space intentionally left blank
------------------------------
Date: Mon, 19 Feb 2001 11:51:54 +0600
From: "Paul Dortman" <paul@pco.iis.nsk.su>
Subject: Re: DB_File Please help
Message-Id: <96qcin$1v3q$1@news.itfs.nsk.su>
Thank you for help, Chris.
But could you give little more information on how can I get information on
version of Berkeley DB.
And how can I get documentation on Berkeley DB ?
Thank you again,
Paul
Chris Fedde wrote in message ...
>In article <96q6fn$1rsb$1@news.itfs.nsk.su>,
>Paul Dortman <paul@pco.iis.nsk.su> wrote:
>>Hello,
>>
>>First of all, sorry if my question is not perl question. But I encountered
>>problem with perl scripts.
>>
>>I had set of *.db files on Unix server, those files was created and used
by
>>my perl cgi scripts.
>>But once, my perl scripts could not treat these *.db files. (I think
>>something was changed on server that affect to how server treat the *.db
>>files.
>>
>>What could happened? What can problem be? And how to bring back to life
>>these databases?
>>How can I prevent these problems?
>>
>>Please help me, or point out what source of information would help me.
>>
>>Thanks in advance,
>>
>>Paul Dortman
>>
>
>DB_File uses the BerkeleyDB. This had an incompatable file format change
>between versions 2.7.7 and the first 3.x versions. Some free unixes
>changed versions in their releases last year. Your problems may stem from
>that.
>
>chris
>
>--
> This space intentionally left blank
------------------------------
Date: Mon, 19 Feb 2001 18:25:16 +1300
From: Dave Watkins <dave@snorks.dyndns.org>
Subject: How do you check for cursor keys?
Message-Id: <3A90AE3C.567D967D@snorks.dyndns.org>
Basically I have a FTP Client written and working.. I would like to add
a history fuction whereby pressing up/down arrows you can scroll through
your previous command (much like BASH), but can't find anyway to moniter
the cursor keys
Thanks
------------------------------
Date: 18 Feb 2001 23:30:13 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: How do you check for cursor keys?
Message-Id: <87y9v344uy.fsf@limey.hpcc.uh.edu>
>> On Mon, 19 Feb 2001 18:25:16 +1300,
>> Dave Watkins <dave@snorks.dyndns.org> said:
> Basically I have a FTP Client written and working.. I
> would like to add a history fuction whereby pressing
> up/down arrows you can scroll through your previous
> command (much like BASH), but can't find anyway to
> moniter the cursor keys
Go to http://search.cpan.org/ and look for "readline".
hth
t
--
The avalanche has already started.
It is too late for the pebbles to vote.
------------------------------
Date: Sun, 18 Feb 2001 22:49:33 -0500
From: minorseventhSPAMBLOCK@earthlink.net (Jim Kroger)
Subject: Re: Invisible code?
Message-Id: <minorseventhSPAMBLOCK-1802012249330001@tritone.csbmb.princeton.edu>
In article <slrn990vi3.pnr.damian@puma.qimr.edu.au>, damian@qimr.edu.au
(Damian James) wrote:
> Thus spake Jim Kroger on Sun, 18 Feb 2001 18:07:29 -0500:
> >-
> >open(DATA, "file");
> >open(SPLIT, ">airfilelist");
> >while (<DATA>) { <
> > $temp = "func_an/${_}"; <
> > @ffile = (@ffile, $temp); <
> >} <
> >@ffile = ($ffile[0], @ffile);
> >print SPLIT @ffile;
> >-
>
>
> You need to use some name other then DATA for the filehandle -- this is a
> 'global special filehandle', which refers to anything following the __END__
> token in the file containing the script.
>
> Aside to others: I found this in the Camel, and also in perldata. The
> perldata reference was, I thought, a bit obscure to expect newbies to have
> understood. I'd have thought that 'global special filehandles' should be in
> perlvar (the way they are included at the end of the section on special
> variables in the Camel). Should this be regarded as a doc bug?
>
> Cheers,
> Damian
Wow, I found a bug. I think I could put this on my resume.
Thanks much! I certainly appreciate your help...
Jim
--
Remove SPAMBLOCK to reply
------------------------------
Date: Sun, 18 Feb 2001 22:51:16 -0500
From: minorseventhSPAMBLOCK@earthlink.net (Jim Kroger)
Subject: Re: Invisible code?
Message-Id: <minorseventhSPAMBLOCK-1802012251160001@tritone.csbmb.princeton.edu>
In article <3A90762A.76C9ED24@la.znet.com>, Kira <callgirl@la.znet.com> wrote:
> Jim Kroger wrote:
>
> (snippage)
>
> > I have spent a couple days staring at this code, trying to understand why
> > my while loop is passed over. This happens with or without the debugger.
>
>
> > open(DATA, "file");
> > open(SPLIT, ">airfilelist");
> > while (<DATA>) { <
> > $temp = "func_an/${_}"; <
> > @ffile = (@ffile, $temp); <
> > } <
> > @ffile = ($ffile[0], @ffile);
> > print SPLIT @ffile;
>
>
>
> Why did you post code with fatal syntax errors?
>
Huh? That was a excerpt from my program.
Jim
--
Remove SPAMBLOCK to reply
------------------------------
Date: Sun, 18 Feb 2001 22:53:03 -0500
From: minorseventhSPAMBLOCK@earthlink.net (Jim Kroger)
Subject: Re: Invisible code?
Message-Id: <minorseventhSPAMBLOCK-1802012253030001@tritone.csbmb.princeton.edu>
In article <GfZj6.239$zN2.188989952@news.frii.net>,
cfedde@fedde.littleton.co.us (Chris Fedde) wrote:
> In article
<minorseventhSPAMBLOCK-1802011807290001@tritone.csbmb.princeton.edu>,
> Jim Kroger <minorseventhSPAMBLOCK@earthlink.net> wrote:
> >Hello esteemed perlers,
> >
> >Any help would definately be appreciated....
> >
> >Thanks very much,
> >Jim
> >
> >--------
> >-
> >open(DATA, "file");
> >open(SPLIT, ">airfilelist");
> >while (<DATA>) { <
> > $temp = "func_an/${_}"; <
> > @ffile = (@ffile, $temp); <
> >} <
> >@ffile = ($ffile[0], @ffile);
> >print SPLIT @ffile;
> >-
> >-
>
> While your code is a bit unorthodox, it does work on my system (perl 5.6.0)
> You might want to try checking the return value of those opens.
>
> open(DATA, "file") or die "$0: $!";
>
> Maybe that would give you some hints.
Hm, well, now I'm confused. If DATA is a bad identifier to use, it should
have crashed for you too....????
By the way I did check the result of opening the file but deleted it for
this snippet for clarity (thanks for pointing
that out, you did it differently from me which I'll check out).
Thanks
Jim
--
Remove SPAMBLOCK to reply
------------------------------
Date: Mon, 19 Feb 2001 04:20:17 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Invisible code?
Message-Id: <5a1k6.243$zN2.188989440@news.frii.net>
In article <minorseventhSPAMBLOCK-1802012249330001@tritone.csbmb.princeton.edu>,
Jim Kroger <minorseventhSPAMBLOCK@earthlink.net> wrote:
>In article <slrn990vi3.pnr.damian@puma.qimr.edu.au>, damian@qimr.edu.au
>(Damian James) wrote:
>
>> Thus spake Jim Kroger on Sun, 18 Feb 2001 18:07:29 -0500:
>> >-
>> >open(DATA, "file");
>> >open(SPLIT, ">airfilelist");
>> >while (<DATA>) { <
>> > $temp = "func_an/${_}"; <
>> > @ffile = (@ffile, $temp); <
>> >} <
>> >@ffile = ($ffile[0], @ffile);
>> >print SPLIT @ffile;
>> >-
>>
>>
>> You need to use some name other then DATA for the filehandle -- this is a
>> 'global special filehandle', which refers to anything following the __END__
>> token in the file containing the script.
>>
>> Aside to others: I found this in the Camel, and also in perldata. The
>> perldata reference was, I thought, a bit obscure to expect newbies to have
>> understood. I'd have thought that 'global special filehandles' should be in
>> perlvar (the way they are included at the end of the section on special
>> variables in the Camel). Should this be regarded as a doc bug?
>>
>> Cheers,
>> Damian
>
>
>Wow, I found a bug. I think I could put this on my resume.
>
>Thanks much! I certainly appreciate your help...
>
>Jim
>
While this might have been a problem in previous Perls it does not appear
to be a problem in 5.6.0. Here at least the code works as expected, once
the extranious '<' characters are removed. The DATA handle looses it's
special meaning when it is used in an open.
The only thing unusual here is the @ffile = (@ffile, $temp); construct
rather than the use of push. Similar net effect though.
chris
--
This space intentionally left blank
------------------------------
Date: Mon, 19 Feb 2001 05:46:19 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Invisible code?
Message-Id: <slrn991cpc.2th.mgjv@verbruggen.comdyn.com.au>
On 19 Feb 2001 02:01:03 GMT,
Damian James <damian@qimr.edu.au> wrote:
> Thus spake Jim Kroger on Sun, 18 Feb 2001 18:07:29 -0500:
>>-
>>open(DATA, "file");
>>open(SPLIT, ">airfilelist");
>>while (<DATA>) { <
>> $temp = "func_an/${_}"; <
>> @ffile = (@ffile, $temp); <
>>} <
>>@ffile = ($ffile[0], @ffile);
>>print SPLIT @ffile;
>>-
>
>
> You need to use some name other then DATA for the filehandle -- this is a
> 'global special filehandle', which refers to anything following the __END__
> token in the file containing the script.
Yes, but that doesn't mean you can't reopen it to another file.
$ perl -w
open DATA, "/proc/devices" or die $!;
print while <DATA>;
close DATA;
works absolutely fine, both under 5.005_03 and 5.6.0. I don't have
5.004 here anymore, but I'm pretty sure this has always worked.
Reopening file handles is fine, irrespective of where they are
pointing to originally.
> Aside to others: I found this in the Camel, and also in perldata. The
> perldata reference was, I thought, a bit obscure to expect newbies to have
> understood. I'd have thought that 'global special filehandles' should be in
> perlvar (the way they are included at the end of the section on special
> variables in the Camel). Should this be regarded as a doc bug?
DATA is only special in that it is opened by default. You can still
use it for anything else you like.
Martien
--
Martien Verbruggen |
Interactive Media Division | I used to have a Heisenbergmobile.
Commercial Dynamics Pty. Ltd. | Every time I looked at the
NSW, Australia | speedometer, I got lost.
------------------------------
Date: Sun, 18 Feb 2001 22:13:16 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Invisible code?
Message-Id: <3A90B97C.458A36A3@stomp.stomp.tokyo>
Jim Kroger wrote:
> Kira wrote:
> > Jim Kroger wrote:
> > (snippage)
> > > I have spent a couple days staring at this code, trying to understand why
> > > my while loop is passed over. This happens with or without the debugger.
> > > open(DATA, "file");
> > > open(SPLIT, ">airfilelist");
> > > while (<DATA>) { <
> > > $temp = "func_an/${_}"; <
> > > @ffile = (@ffile, $temp); <
> > > } <
> > > @ffile = ($ffile[0], @ffile);
> > > print SPLIT @ffile;
> > Why did you post code with fatal syntax errors?
> > "Unterminated <> operator at...."
> Huh? That was a excerpt from my program.
Uh huh. Your use of 'DATA' and your use of 'SPLIT'
are both innocent inclusions as well, right?
Never try to con a con.
Godzilla!
------------------------------
Date: Mon, 19 Feb 2001 06:36:01 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Invisible code?
Message-Id: <x7itm7ji28.fsf@home.sysarch.com>
>>>>> "G" == Godzilla! <godzilla@stomp.stomp.tokyo> writes:
G> Jim Kroger wrote:
>> Kira wrote:
>> > Jim Kroger wrote:
>> > (snippage)
>> > > I have spent a couple days staring at this code, trying to understand why
>> > > my while loop is passed over. This happens with or without the debugger.
>> > > open(DATA, "file");
>> > > open(SPLIT, ">airfilelist");
>> > > while (<DATA>) { <
>> > > $temp = "func_an/${_}"; <
>> > > @ffile = (@ffile, $temp); <
>> > > } <
>> > > @ffile = ($ffile[0], @ffile);
>> > > print SPLIT @ffile;
>> > Why did you post code with fatal syntax errors?
>> > "Unterminated <> operator at...."
>> Huh? That was a excerpt from my program.
G> Uh huh. Your use of 'DATA' and your use of 'SPLIT'
G> are both innocent inclusions as well, right?
G> Never try to con a con.
nope, never try to educate an idiot. it was obvious that the < he put in
there were to mark the lines and were not real code. that is why you got
your sytax error which no one else got. and his use of DATA for a handle
was his real choice. but you can't see reality as you have fallen off
you meds. please take them again.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 19 Feb 2001 06:59:17 GMT
From: damian@qimr.edu.au (Damian James)
Subject: Re: Invisible code?
Message-Id: <slrn991h19.pnr.damian@puma.qimr.edu.au>
Thus spake Martien Verbruggen on Mon, 19 Feb 2001 05:46:19 GMT:
>On 19 Feb 2001 02:01:03 GMT,
> Damian James <damian@qimr.edu.au> wrote:
>> Thus spake Jim Kroger on Sun, 18 Feb 2001 18:07:29 -0500:
>>>-
>>>open(DATA, "file");
>>>open(SPLIT, ">airfilelist");
>>>while (<DATA>) { <
>>> $temp = "func_an/${_}"; <
>>> @ffile = (@ffile, $temp); <
>>>} <
>>>@ffile = ($ffile[0], @ffile);
>>>print SPLIT @ffile;
>>>-
>>
>>
>> You need to use some name other then DATA for the filehandle -- this is a
>> 'global special filehandle', which refers to anything following the __END__
>> token in the file containing the script.
>
>Yes, but that doesn't mean you can't reopen it to another file.
>...
>
>DATA is only special in that it is opened by default. You can still
>use it for anything else you like.
>
OK. I guess I had assumed that you'd have to localise it or something. But
even so, with the OP's code above the filehandle would still try to read
from after __END__ without an error should the first open() ever fail, not so?
Cheers,
Damian
--
$;=ord$%,$:=$;-ord q,.,,$_=q 13346:3366:3276:3326:3386:546:566:966:3396:3376:1.
q 73386:546:;96:3326:3336:3386:3266:3236:3366:546::26:3236:3366:32:6:546:32667.
q,:;96:;;6:3296:3236:3366:326:56,,s,.,;ord($&)-$:-$;;;;;,eg,s,$;,;chr$&-$:;,eg,
eval eval; #requires 5.6.0 ## my first attempt at one of these...
------------------------------
Date: Mon, 19 Feb 2001 02:58:12 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: kill unix process
Message-Id: <8Z%j6.291$gw.13122@eagle.america.net>
On 18 Feb 2001 21:59:19 GMT, revjack <revjack@revjack.net> wrote:
>Abigail <abigail@foad.org> wrote:
>: Ji Lee (jlee8@irix1.gl.umbc.edu) wrote on MMDCCXXVIII September MCMXCIII
>: in <URL:news:96p9is$c7h$1@news.umbc.edu>:
>: ,,
>: ,, Hi folks,
>: ,,
>: ,, i have following code in my perl script, but it does not works, can anyone te
>: ,,
>
>: Yeah.
>
>: There's nothing really here. The empty program does not have any side effects.
>
>But does it return TRUE?
$ rm x;touch x;chmod +x x;if ./x;then echo true;fi
true
$
--
Garry Williams
------------------------------
Date: Mon, 19 Feb 2001 08:03:10 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: perl program
Message-Id: <slrn991kpo.ob2.tjla@thislove.dyndns.org>
I was shocked! How could Another Way <anotherway83@aol.com>
say such a terrible thing:
>hey
>
>pls try out my first perl program here
>
>it is a calculator
Thanks for telling us. At first glance I thought it was an italian dish
(can you say "Pasta"?)
An interesting first try. I think you will learn a little about program
design and structured programming before you are done. You might want to
read up on some alternative methods (go to search.cpan.org and search
for "Parse" and "Recursive Descent"). Also there are some good books at
the library that may teach you something.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
For a gay time, call 555-9483. Ask for Brucie.
------------------------------
Date: Mon, 19 Feb 2001 04:00:34 GMT
From: Mindfield <mindfield@badgers.emulationnet.com>
Subject: PERL Request
Message-Id: <sa619t8hu6576v120epkpakpuun7l57qu4@4ax.com>
Okay, I'm a total novice at Perl. At best I can sort of read a perl
script and pick out bits here and there and figure out what they're
supposed to do, but I never got round to learning to program in it.
Now what I want to do is pretty obscure, so I doubt a premade script
exists for it, but I'm wondering if someone could point me to a place
that could help me figure out how to do a pretty simple script.
Actually, two very simple scripts.
Basically what I want is a script that gets executed every time a
particular page is loaded, or every time a specific button is pressed
(I haven't decided yet how I want it executed). What this script will
do is check for the existence of a directory and, if it doesn't exist,
create it, and if it does, do nothing. The directory it will be
checking for is basically the day's date. (i.e. a directory named
021701 for today's date) The pupose of the script is that things will
get uploaded to a site on a fairly regular basis, but will only be
kept online for 7 days, after which it will be purged manually from
the system. In order to keep things organized in a nice, tidy
package, stuff that gets uploaded will get uploaded in a directory
named after the current date. When the date changes, the script is to
check if that date's directory exists and if not, change it.
Actually, now that I think about it this script could also handle
deleting the 8-day-old directories, too, so it'd have to check for the
existence of a directory that is 8 days old and, if it exists, delete
it.
The second script is the upload script. The uploading bit I can
handle easily with a prefab Java script. All I need CGI for here is to
set the directory that the file will be stored to when it is uploaded
-- which will be the directory with the day's date. I suppose what
that would mean is that the CGI script will have to generate the HTML
that contains the uploading bit with the directory to save to
hardwired into the HTML code (which will change daily as the script
adjusts for a new day).
In the end, the sequence of events that I want to have happen are
thus:
1. Page to upload loads. CGI script is initiated to check for the
existence of today's date-named directory and, if not, create it, or
if so, do nothing. 8-day-old directory also checked against and
deleted as necessary.
2. User inputs file(s) to upload and clicks the upload button. Second
CGI script kicks in that sets the directory the file is to be stored
to, creates the appropriate HTML which will contain the upload script
and such, which then executes, and the file is received and stored in
the appropriate directory.
Would this be easy to do? If someone could direct me to somewhere I
could learn how to do this, or could provide me with some assistance,
I've be most appeciative. Like I said, when it comes to Perl I'm a
total novice, but it's the easiest way I can think of to accomplish
this without going into compiled Java applets, which I can't program
either.
Any help is appreciated. Thanks.
--
Almost there...
"Ignorance breeds confidence more often than does knowledge." -Darwin
The Emulation Newbie FAQ: http://www.emulationnet.com/emufaq.html
Remove the badgers before E-Mailing.
------------------------------
Date: Sun, 18 Feb 2001 22:58:26 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: PERL Request
Message-Id: <E534F5ADC2D8A159.2011CEE1B9D65101.1D15E9D213D1B8CA@lp.airnews.net>
"Mindfield" <mindfield@badgers.emulationnet.com> wrote:
: Okay, I'm a total novice at Perl. At best I can sort of read a perl
: script and pick out bits here and there and figure out what they're
: supposed to do, but I never got round to learning to program in it.
:
: Now what I want to do is pretty obscure, so I doubt a premade script
: exists for it, but I'm wondering if someone could point me to a place
: that could help me figure out how to do a pretty simple script.
: Actually, two very simple scripts.
:
: Basically what I want is a script that gets executed every time a
: particular page is loaded, or every time a specific button is pressed
: (I haven't decided yet how I want it executed). What this script will
: do is check for the existence of a directory and, if it doesn't exist,
: create it, and if it does, do nothing. The directory it will be
: checking for is basically the day's date. (i.e. a directory named
: 021701 for today's date) The pupose of the script is that things will
: get uploaded to a site on a fairly regular basis, but will only be
: kept online for 7 days, after which it will be purged manually from
: the system. In order to keep things organized in a nice, tidy
: package, stuff that gets uploaded will get uploaded in a directory
: named after the current date. When the date changes, the script is to
: check if that date's directory exists and if not, change it.
: Actually, now that I think about it this script could also handle
: deleting the 8-day-old directories, too, so it'd have to check for the
: existence of a directory that is 8 days old and, if it exists, delete
: it.
:
: The second script is the upload script. The uploading bit I can
: handle easily with a prefab Java script. All I need CGI for here is to
: set the directory that the file will be stored to when it is uploaded
: -- which will be the directory with the day's date. I suppose what
: that would mean is that the CGI script will have to generate the HTML
: that contains the uploading bit with the directory to save to
: hardwired into the HTML code (which will change daily as the script
: adjusts for a new day).
You didn't mention your operating system. If you are using *nix
you should be able to run a file using a setting in '.htaccess' each
time a particular file(s) is requested. You should first try posting
your question in a usenet group concerned with your operating
system.
While an awful lot of CGI is written in Perl, it is not your only
option. You could fill your needs with something your more
familiar with and have it run through .htaccess or something
similar. Usenet has a number of groups that would be more
appropriate than c.l.p.misc. Try posting to a CGI group,
you may find someone who has actually done this before.
HTH,
Charles K. Clarkson
[SNIP]
------------------------------
Date: Mon, 19 Feb 2001 05:46:00 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Project with a large amount of external data
Message-Id: <sq2k6.247$zN2.188924928@news.frii.net>
In article <V6Rj6.5144$nI3.34295@nntp0.chicago.il.ameritech.net>,
Greg White <gwhite@the-whites.net> wrote:
>"Bob Walton" <bwalton@rochester.rr.com> wrote in message
>news:<3A8F2C14.5C635851@rochester.rr.com>...
>> Greg White wrote:
>> >
>> 10 seconds? 10 minutes? 10 milliseconds?
>
>enough time to matter ;-)
>
>>You say "large" amount of
>> data. 100 bytes? 100 Kb? 100 Mb? 100 Gb?
>
>closer to 100 kb, text messages, directory & database config items and the
>ever popular global variables.
>
>>I would supposed that
>> reading 10 to 15 files would not be a big performance hit compared with
>> loading the same information from one or two files. By that I mean that
>> a user wouldn't notice the difference.
>
>what about 200 users hitting this script at about the same time being used
>as a CGI script?
Let's pretend that your 200 users each fork a new process and load the 100
kb data in to memory before their results are returned.
My bonehead-donothing-testscript for this scenario is as follows:
#!/usr/bin/perl
#
use Time::HiRes 'time';
$start = time();
my @file = <>;
for (@file) {
my $a = length $_;
print $a, "\n";
}
warn time() - $start, "\n";
warn qx( ps -uwp $$ ), "\n";
Maybe not the best mockup for a real CGI script. But perlfunc.pod is about
250Kbyte so that at least is closish to your estemates. Running this as
time perl t /usr/local/lib/perl5/5.6.0/pod/perlfunc.pod > u
On my my FreeBSD 4.2-STABLE AMD-K6(tm) @ 350Mhz
this gives:
0.0988279581069946
USER PID %CPU %MEM VSZ RSS TT STAT STARTED TIME COMMAND
cfedde 66811 0.0 2.0 3180 2568 pd S+ 10:24PM 0:00.20 perl t
/usr/local/lib/perl5/5.6.0/pod/perlfunc.pod
real 0m0.239s
user 0m0.185s
sys 0m0.043s
Looks like about a 0.140 second start up overhead for this script. and about
2.5 Meg memory.
Plugging real into Littles Law:
N = aP
a = N/P
a = 200users/0.249sec
a = 803.21 users/sec
Which seems like a good ideal number to use as a tuneing goal.
Now to memory. Most systems do some ammount of sharing of duplicate data so
it is not sufficiant mearly to divide the free memory by the RSS of the
process. Running this program in a shell loop:
for f in 1 2 3 4 5 6
do
time perl t /usr/local/lib/perl5/5.6.0/pod/perl.pod > u$f &
vmstat;
done;
And subtracting the first and last 'fre' values from the vmstat
allowed me to guess that each process consumes aboout 1Meg of
additional ram. So on my system with the current process mix there
is a practical limit of about 30 simultanious users before they
start going into swap.
Does any of this help you think about your system?
chris
--
This space intentionally left blank
------------------------------
Date: Mon, 19 Feb 2001 00:39:59 -0500
From: Robert Rothenburg <wlkngowl@unix.asb.com>
Subject: Re: PROPOSAL: Graphics::ColorNames
Message-Id: <3A90B1AF.7E8A61C2@unix.asb.com>
Ilmari Karonen wrote:
>
> In article <3A8FCE38.34F1F1CD@unix.asb.com>, Robert Rothenburg wrote:
> >
> >Another method might be to use tied hashes and allow one script to
> >access multiple schemes, or even specify a priority of schemes:
> >
> > tie %xcolors, 'Graphics::Colors', qw( X );
> > tie %windoescolors, 'Graphics::Colors', qw( X HTML3 Windows );
>
> Would you really need _tied_ hashes? It seems to me a conventional
Well, I'm already experimenting with that. Is there a way to make the
hashes read-only? (I guess I could fiddle with GLOBs.)
> hash of, say, RGB hex strings would work. (Except perhaps for case
I prefer the triplets, but hex strings do take less memory. Hm...
> sensitivity issues -- could you just declare that all color names are
> always fully lowercased?)
X names are not all lowercase. Case-sensitivity is not an issue.
> use Graphics::Colornames; # I like that name better
>
> my $htmlcolors = colornames('HTML'); # hashref in scalar context
> my %xcolors = colornames('X'); # full hash in list context
>
> print qq(<font color="#$xcolors{blue}">); # X colors in HTML
>
> > @RGB = @{ $xcolors{'silver'} };
>
> You could always supply utility functions to convert the hex strings
> (which are convenient because they take little memory -- though more
> than just integers) into other representations.
Of course.
> If you want to avoid bloat, the first thing to do is to split each
> namespace into a separate file. The exact mechanism for this is up to
> you; autoloading and submodules are both possible, but so are simple
> tab-delimited files you can read into the hashes as necessary.
I'm already experimenting with that. (Any advice on how to get the test
harness to work when a submodule isn't already installed?)
Rob
------------------------------
Date: Sun, 18 Feb 2001 20:14:48 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: question on multidimensional arrays
Message-Id: <F897BF15EC058204.5036874405416E3D.D5F2CFA5AA876AAD@lp.airnews.net>
"me" <me@me.com> wrote in message
news:W3Zj6.4534$GX2.1835709@typhoon.ne.mediaone.net...
: In the code below, I have a function called blah which returns a one
: dimensional array of the parameter given and another called blah2 for a 2
: dimensional array. The returned array is then assigned to another one
: dimensional array and printed. This is done twice to make sure what is
sent
: back is not a reference to the computed array in the function. I get the
: correct output for the one dimensional array but not for the two
dimensional
: one. Am I assigning the arrays correctly? Should the 2 dimensional array
be
: returned differently?
:
:
: # one dimensional array
: @allones=blah(1);
: @alltwos=blah(2);
: print @allones,@alltwos,"\n";
Array indexes usually start at 0 not 1. Guess how I know
you don't have warnings turned on.
:
: sub blah{
: for $x (1 .. 4){
: $b2 [$x]= $_[0];
: }
: return @b;
: }
Look at the return array, now look at the array your
asigning values to.
:
: # two dimensional array
: @LOL=blah2(1);
: @LOL2=blah2(2);
:
: for $x (1 .. 4){
: for $y (1 .. 4){
: print $LOL[$x][$y];
: print $LOL2[$x][$y];
: }
: print "\n";
: }
:
: sub blah2{
: for $x (1 .. 4){
: for $y (1 .. 4){ $b [$x][$y]= $_[0]; }
: }
: return @b2;
: }
Look at the return array, now look at the array your
asigning values to.
HTH,
Charles K. Clarkson
------------------------------
Date: Sun, 18 Feb 2001 20:06:26 -0600
From: "Charles K. Clarkson" <c_clarkson@hotmail.com>
Subject: Re: sending data to a script via SSI
Message-Id: <E10396BC02E3952D.2CB748A5D9394DE2.699DC06E752D4272@lp.airnews.net>
"Jeff Fletcher" <jeff_fletcher@pacbell.net> wrote in message
news:HYZj6.176$xL1.123313@news.pacbell.net...
: When I was running my site on Unix, I was able to send data via the URL of
a
: page, and have SSI's within the page access that data. In other words ....
:
: http://www.mysite.com/page.shtml?string=word
:
: would send string=word into a script executed via a <!--#cgi exec="'-->
: command within the page. The script then parsed the data and used it.
:
: Well, for some reason that doesn't work on my new host, which uses an NT
: platform.
:
: Any ideas?
Jeff,
Your post is not a perl question. Try asking it on a cgi or
windows NT newsgroup or maybe field the question to your
host.
Charles K. Clarkson
------------------------------
Date: 19 Feb 2001 02:07:50 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Writing a Perl Server
Message-Id: <slrn990vvm.15e.abigail@tsathoggua.rlyeh.net>
Scotty99 (slangdon@tampabay.rr.com) wrote on MMDCCXXIX September MCMXCIII
in <URL:news:3A90694E.9E8FF6F8@tampabay.rr.com>:
%% I'm thinking about writing a perl server in a unix environment to
%% replace the one I currently have that I wrote in C++ in a windows
%% environment. Unlike a web server,
%% this server will need to accept sockets and communicate with multiple
%% clients for extended periods of time. My current server listens for
%% incoming connections and
%% accepts each connection and puts it on a separate thread. I noticed
%% that perl doesn't
%% have threading or at least not stable threading. Anyway, I am thinking
%% about using forks, but I am curious if they eat a lot of memory. Say I
%% have 100 to 500 clients connected each on his own forking process. Is
%% this feasible or a bad idea?
It depends. The variation in OS and the hardware it runs on varies
wildly. 1 Gb of memory usage on a dedicated 4 CPU E450 with 4 Gb RAM
installed is not much. But on a sparc 5 that also runs Oracle, DNS,
NFS and acts as the coorperate mail server won't be able to handle this.
There's only one way to find out, and that's to try.
Alternatively, you don't fork(), but you use select(). You might want to
look into Event or POE if you go that way. The advantage is less memory
usage, the disadvantage is that the OS won't scedule between the different
"clients" - you either have to do your own scheduling, or accept that if
handling of one client takes a long time, all other clients have to wait.
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
------------------------------
Date: Mon, 19 Feb 2001 07:54:41 GMT
From: tjla@guvfybir.qlaqaf.bet (Gwyn Judd)
Subject: Re: Writing a Perl Server
Message-Id: <slrn991ka0.ob2.tjla@thislove.dyndns.org>
I was shocked! How could Abigail <abigail@foad.org>
say such a terrible thing:
>Alternatively, you don't fork(), but you use select(). You might want to
>look into Event or POE if you go that way. The advantage is less memory
>usage, the disadvantage is that the OS won't scedule between the different
>"clients" - you either have to do your own scheduling, or accept that if
>handling of one client takes a long time, all other clients have to wait.
Third alternative is to combine the two schemes. fork() say every 10
connections, each process controls those ten connections and uses
select() between them. Advantages are you get less memory use and a
certain degree of OS scheduling. Another alternative might be to use
Threads.
--
Gwyn Judd (print `echo 'tjla@guvfybir.qlaqaf.bet' | rot13`)
For I dipped into the Future, far as human eye could see; saw the vision
of the world, and all the wonder that would be.
-Alfred, Lord Tennyson
------------------------------
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 313
**************************************