[13039] in Perl-Users-Digest
Perl-Users Digest, Issue: 449 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 10 15:17:27 1999
Date: Tue, 10 Aug 1999 12:10:18 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 10 Aug 1999 Volume: 9 Number: 449
Today's topics:
Re: perl prog: Top site thingy.. <callen@boxcar.driver8.org>
Re: perl prog: Top site thingy.. <cassell@mail.cor.epa.gov>
Re: perl prog: Top site thingy.. <cassell@mail.cor.epa.gov>
Re: perl script - help (Larry Rosler)
Re: Perl/SSI hacking (Steve Linberg)
Re: POST via Imagemap - How? (Larry Rosler)
Re: pricing a perl job <AgitatorsBand@yahoo.com>
Re: pricing a perl job <AgitatorsBand@yahoo.com>
Re: pricing a perl job <bogart@exis.net>
Re: pricing a perl job (brian d foy)
Re: problem with DBI.pm <cassell@mail.cor.epa.gov>
Re: problems with POSIX::isatty() (Alan Curry)
Re: problems with POSIX::isatty() <jay@rgrs.com>
Problems with the system function thecopperkid@my-deja.com
Re: Questions about Perl/CGI scripts <Mark@Mark.Com>
Re: Reading the Online Documentation? (Mesarchm)
Re: Reading the Online Documentation? (Larry Rosler)
Re: search and match (Eric Bohlman)
Re: search and match <chris.evans@tc.faa.gov>
Re: Simple write routine <cassell@mail.cor.epa.gov>
Sorting by mid-record without splitting? (Effie Rover)
Re: suggestions for CRAP <cassell@mail.cor.epa.gov>
using alarm under win32 <babailey@mediaone.net>
Using the system command thecopperkid@my-deja.com
Re: Using the system command n0jokeg@my-deja.com
Re: Web Calendar Help.... !!! <cassell@mail.cor.epa.gov>
Re: Why use Perl when we've got Python?! (Wayne Venables)
Re: Why use Perl when we've got Python?! (Matthew Bafford)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 10 Aug 1999 17:06:23 GMT
From: Christopher Allen <callen@boxcar.driver8.org>
Subject: Re: perl prog: Top site thingy..
Message-Id: <7opm6f$rpn$1@news1.spacestar.net>
arpith@hotmail.com wrote:
> Hi,
> best approach, or should I have just one file for all sites ?
> And a few more questions. How do I call another perl program from a perl
> program itself ?
> And:
> CGI- related question :)
You have several OT questions and one on topic.
1: more than one file
2: look at the function system, also look at combining your code into
a single script using subroutines to form a framework of your script.
3: you are correct in your assumption the cgi-script
Look into purchasing "programming perl" by O'REILLY.
ON your unix system, (you are using unix right?) try perldoc.
-out
------------------------------
Date: Tue, 10 Aug 1999 11:54:49 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: perl prog: Top site thingy..
Message-Id: <37B07579.8FABE427@mail.cor.epa.gov>
Alex Farber wrote:
>
> Hi Arpith,
>
> arpith@hotmail.com wrote:
> > How do I call another perl program from a perl
> > program itself ?
>
> see
>
> perldoc -tf system
> perldoc -tf exec
> perldoc -tf open
> perldoc perlop
It sounded more to me as if he wanted to know about
perldoc -f require
perldoc -f use
perldoc -f do
But you may be right here. It's not a very specific question.
> > Supposing halfway through the saving, the user Presses the "Stop" button
> > on the browser, will the CGI script STOP execution midway ? or will it
>
> My guess is: if the CGI-script tries reading from STDIN or writing
> to STDOUT after that, then it will die because it receives SIGPIPE.
I don't want to dissuade you from answering, but do you
*really* want to be making guesses in a newsgroup with TomC
and Abigail and Uri and LarryR ? :-)
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 10 Aug 1999 11:56:30 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: perl prog: Top site thingy..
Message-Id: <37B075DE.CC82E70F@mail.cor.epa.gov>
Christopher Allen wrote:
[snipperoonie]
> ON your unix system, (you are using unix right?) try perldoc.
Just for reference, perldoc works everywhere Perl does, AFAIK.
Although there do seem to be a couple oddities about its paging
on win95/98 systems.
HAND,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 10 Aug 1999 10:58:55 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: perl script - help
Message-Id: <MPG.121a083e4e30e343989e1a@nntp.hpl.hp.com>
In article <MPG.1219de9a239f546098969e@nntp1.ba.best.com> on Tue, 10 Aug
1999 08:01:21 -0700, Bill Moseley <moseley@best.com> says...
> Abigail (abigail@delanet.com) seems to say...
> > Bill Moseley (moseley@best.com) wrote on MMCLXX September MCMXCIII in
> > <URL:news:MPG.12196263903f96de98969d@nntp1.ba.best.com>:
> > || Abigail (abigail@delanet.com) seems to say...
> > || > perl -walne '$_{$F[0]}->{$F[3]}++;
> > || > END{map{print"For word $_ I found:";%_=%{$_{$_}};
> > || > map{print" $_{$_} instances of $_"}keys%_}keys%_}' file
> > ||
> > || I love well documented code.
> >
> > It's self documenting. Only obscure code needs comments.
>
> Say I wanted to find out more about using %_.
>
> 62) /usr/local/perl5.005/lib/5.005/pod %grep '%_' *
> perlguts.pod: L (none) Debugger %_<filename
> perlguts.pod: l vtbl_dbline Debugger %_<filename
>
> Oh. Not what I had wished for.
>
> Pardon me, but which exit to I take for nirvana?
You missed the little thread we had about this recently. I can't find
it reaily in Deja.com, because '%_' blows their search engine.
%_ shares the same typeglob as $_ and @_, thus it is implicitly global
as they are. But it has no special semantics, so it is available
without declaration as an obscurely named hash -- just fine for
Obfuscated Perl. But now too many people wil know about it, so the veil
of obscurity is lifting. Sigh...
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 10 Aug 1999 14:14:50 -0400
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: Perl/SSI hacking
Message-Id: <linberg-1008991414500001@ltl1.literacy.upenn.edu>
In article <elWr3.28447$k8.1203623@newscene.newscene.com>, "Michael D.
Kirkpatrick" <mkirkpatrick@webbuilders.top.net> wrote:
> You can put this in the beginning of your perl script:
>
> if ($ENV{'REQUEST_METHOD'} eq 'GET') {
> $querystring=$ENV{'QUERY_STRING'};
> @pairs = split(/&/, $querystring);
> foreach $pair (@pairs){
> ($name, $value) = split(/=/, $pair);
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $query{$name} = $value;
> }
> }
>
> if ($query{'VAR'} eq "IMAGE_PROTECTION_CODE"){&run_my_routine;}
>
> sub run_my_routine{
> $my_var = $query{'VALUE'};
> ## do what ever.....
> }
I seem to recall that when I first started writing CGI code, I too avoided
CGI.pm, but now I can't recall why.
---------------
use CGI;
my $q = new CGI;
&run_my_routine if ($q->param('VAR') eq 'IMAGE_PROTECTION_CODE');
# etc...
---------------
Easier, no?
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: Tue, 10 Aug 1999 10:48:14 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: POST via Imagemap - How?
Message-Id: <MPG.121a05bbc05e59b0989e19@nntp.hpl.hp.com>
In article <7ootsv$a5k$2@news.mch.sbs.de> on Tue, 10 Aug 1999 10:09:41
GMT, Michel Dalle <michel.dalle@usa.net> says...
> In article <MPG.1218efae421960e0989e12@nntp.hpl.hp.com>, lr@hpl.hp.com (Larry Rosler) wrote:
> >In article <37AF4472.71D55A1C@mail.cor.epa.gov> on Mon, 09 Aug 1999
> >14:13:22 -0700, David Cassell <cassell@mail.cor.epa.gov> says...
> [snip]
> >> Well *I* thought Abigail's intention was imminently clear. But then,
> >> I'm the sort of person who uses the word 'imminently' in conversation.
> >
> >When you should be using the word 'eminently'. Ow!
>
> Euh, you mean immanently ?
Cute, but no. Not even a bit!
My most convenient dictionary is electronic, but I hear the sound of
pages rustling around the world.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 10 Aug 1999 17:27:51 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: pricing a perl job
Message-Id: <riZr3.1331$EG4.232173@news.shore.net>
Eric Turner <erict@cc.wwu.edu> wrote:
: beginning programmers had median annual earnings of about $27,000..."
Are you being intentionally dense or did you miss the rest of this thread.
He's trying to find out how much an experienced perl programmer would
charge for this script. The average salary for full-time beginning
programmers seems tangential at best.
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Tue, 10 Aug 1999 17:30:49 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: pricing a perl job
Message-Id: <dlZr3.1333$EG4.232173@news.shore.net>
Abigail <abigail@delanet.com> wrote:
: Max Pinton (max@maxgraphic.com) wrote on MMCLXX September MCMXCIII in
: <URL:news:090819991743144695%max@maxgraphic.com>:
: []
: [] Would I have gotten a real response if I had posed as a client looking
: [] for a quote? Or has usenet simply ceased being a useful resource?
: Whiner.
Honestly. He came in here with a simple question and expected to get a
simple, non-condescending answer. What a loser!
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Tue, 10 Aug 1999 14:11:01 -0400
From: Ed Bogart <bogart@exis.net>
Subject: Re: pricing a perl job
Message-Id: <37B06B34.EEA20160@exis.net>
Max Pinton wrote:
>
> I hope you're joking. I'm asking for a rough estimate of cost for
> writing the Perl script I described. It has to do with Perl in that
> only a Perl scripter would be able to make such an estimate. I'm a
> graphic designer, but wrote the script without a contract for a client
> that I've worked closely with for a long time, and would like to charge
> her fairly for the work I did.
>
[a big snip here]
It amazes me that you have any long term clients with the attitude that you have
displayed here. You ask one of the most difficult questions in the consulting
realm and get mad when someone who does this every day gives you his best
answer. Writing code is easy, charging enough to live on without driving away
business is very very hard.
The Perl code I write is for my own use but I have been writing LabVIEW code for
years as a consultant but the games the same. When someone come to me with a
requirement, I tell them I charge $120 per hour in 8 hour increments up to 5
days and hourly after that. My estimate is based on the time I expect it will
take to do the job plus part of the time that I spent estimating and negotiating
the job. Installation, troubleshooting, upgrading, training, are all done on an
ad-hoc basis using the same pricing rules but with travel time and expenses
thrown in as required.
Now my advice. Why not write it off as customer relations and a good learning
experience and not charge anything.
------------------------------
Date: Tue, 10 Aug 1999 14:27:55 -0500
From: brian@pm.org (brian d foy)
Subject: Re: pricing a perl job
Message-Id: <brian-1008991427550001@news.panix.com>
Keywords: just another new york perl hacker
In article <7oor87$kta@dfw-ixnews8.ix.netcom.com>, Tom Mornini <tmornini@netcom9.netcom.com> posted:
> brian d foy <brian@pm.org> wrote:
>
> : * i'm a lot better and faster than you are, so the time it takes
> : *me* to do the job is of no relevance to the amount *you* should
> : charge
>
> : * i cost a lot more than you do.
>
> These statements are incredibly arrogant since they are likely not based on
> fact, regardless of how true they might be.
are you asserting that fact and truth are not the same? keep reading
and you wll find them based on fact - at least as factual that it
ever gets in this world.
> If, Brian D. Foy, (correct capitalization and punctuation not accidental),
that's a pretty pathetic troll, but does realize a certain,
hostile bias ;) i leave it to HFB to chastise you.
> you know these statements to be true because you have worked with him AND
> know what he charges, then I retract the above statement and humbly apologize.
i have enough experience to know that i can say both of
those with a high degree of confidence. he explicity stated
that it took him 16 hours. i would estimate that it would
take me four. that's to be expected since i've been doing
this a lot longer than he has. he also explicitly stated
that he is a newbie and that he spent a lot of his time
debugging and head-scratching. having already made many
similar systems, my time spent in debugging and
head-scratchng would be much less. again, this is to be
expected since i've been doing it a lot longer than he has.
furthermore, i know where my rates stand in relationship to
the industry average and to the industry average for graphic
designers, which he says he is. my rates are higher by a
large multiplier. this has nothing to do with personal
wealth and almost everything to do with the high rent for
Manhattan office space and the salary i need to pay support
employees and the tax i have to pay the IRS for them and ...
perhaps you are ready to "retract the above statement and humbly
apologize" since they are based on information that was publically
posted? you might want to read the original post.
--
brian d foy
------------------------------
Date: Tue, 10 Aug 1999 11:39:30 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: problem with DBI.pm
Message-Id: <37B071E2.18CBAE8B@mail.cor.epa.gov>
Sherry wrote:
>
> Hello,
> I also had the same problem, but a nice guy helped me.
You're welcome. Please feel free to quote me any time you can
lend assistance to other new Perlites.
[snip of precise quote of Yours truly]
[snip of poster's sig *followed* by querent's post]
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 10 Aug 1999 18:39:17 GMT
From: pacman@defiant.cqc.com (Alan Curry)
Subject: Re: problems with POSIX::isatty()
Message-Id: <pl_r3.2294$DY2.79776@typ11>
In article <7opj78$k21$1@eanews1.unisys.com>,
Paul Glidden <paul.glidden@unisys.com> wrote:
>So in order to do this I am trying to use POSIX::isatty(). Unfortunately I
>am not getting any return from the function nor an error.
No return? You mean it runs forever?
>Is it possible for a script to be able to find out whether or not itself is
>connected to a tty.
>I could be invoking the function incorrectly also, but I am assuming not as
>I am not getting an error of any type. The perldoc states that you are
>suppose to pass in a filehandle. I have tried both the name of the script
>and the pid.
Neither one of those is a filehandle.
>The manpage for the C func isatty shows an int should be passed into the
>function, which would make me assume it should be the pid. So in order to
You assume wrong. In C, POSIX filehandles are represented by ints. (And PIDs
are pid_t, not int)
>Am I not using this function correctly, or could there be a problem with my
>perl installation.
The problem is that a process usually has many files open, and some of them
may be ttys but the rest of them aren't. Each one of them can be tested
individually. If you really want to know whether you have a tty, you'll need
to get a list of all your open filehandles and test them all. There's no easy
way to do that.
However, isatty(STDIN)||isatty(STDOUT)||isatty(STDERR) is probably good
enough to tell you what you need to know.
--
Alan Curry |Declaration of | _../\. ./\.._ ____. ____.
pacman@cqc.com|bigotries (should| [ | | ] / _> / _>
--------------+save some time): | \__/ \__/ \___: \___:
Linux,vim,trn,GPL,zsh,qmail,^H | "Screw you guys, I'm going home" -- Cartman
------------------------------
Date: 10 Aug 1999 14:51:22 -0400
From: Jay Rogers <jay@rgrs.com>
Subject: Re: problems with POSIX::isatty()
Message-Id: <821zdbo4et.fsf@shell2.shore.net>
"Paul Glidden" <paul.glidden@unisys.com> writes:
> My goal is to determine whether or not the perl script that is currently
> running has been called from a tty or from a job such as cron.
>
> So in order to do this I am trying to use POSIX::isatty(). Unfortunately I
> am not getting any return from the function nor an error.
You should have better luck with -t
--
Jay Rogers
jay@rgrs.com
------------------------------
Date: Tue, 10 Aug 1999 17:39:49 GMT
From: thecopperkid@my-deja.com
Subject: Problems with the system function
Message-Id: <7opo53$ldd$1@nnrp1.deja.com>
Hi,
I have a command that is driving me nuts...
Perhaps some one here would be kind enough to
releave me of my insanity.
I'm running a comp. chem. tool kit call the
Daylight Tool kit. It has a cgi interface. The
line they use in a sh script is:
echo '$SMI<'$SMI'>|' | $DY_ROOT/bin/clogp
+PCMODELS_TABLEOUTPUT 2>&1
If you type the following (after all env vars are
set up -- I know that this is already taken care
of) thing at the tcsh prompt, the program works as
it should:
echo '$SMI<CCCCC>|' | $DY_ROOT/bin/clogp
+PCMODELS_TABLEOUTPUT
Here is what I'm trying to do in PERL to no
avail... (P.S., $SMI is just a string needed for
the formating. In the case below, it is not a
variable.)...
system ("echo '$SMI<CCCCC>|' |
/g/programs/daylight/v462/bin/clogp
+PCMODELS_TABLEOUTPUT");
preferably, I'd like to be able to do something
like:
$table = system(...);
and then print "$table\n"; to the web server.
Does anyone know how I should be going about
using the system function to do this? Is there a
better/right way to do what I am trying to do?
Thanks,
Ray.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 10 Aug 1999 18:20:05 +0100
From: Mark <Mark@Mark.Com>
Subject: Re: Questions about Perl/CGI scripts
Message-Id: <37B05F45.15CA48CF@Mark.Com>
Nick Filios wrote:
> Do you know where could I find a perl library for parsing data from a
> form?
http://stein.cshl.org/WWW/software/CGI/cgi_docs.html
>
>
> So, I would like to ask if I could pass data from a Perl CGI script to
> a another
> program that will process that data. If, yes how can I do it?
perldoc -f system
> Moreover, could I use one Perl/CGI script for every different HTML
> form I have,
> since the process will actually be the same for every form, OR do I
> have to use
> a separate file for each form?
>
No. You can use the same cgi script for the form(s) and parsers
>
> There is a Unix program (sendmail) which sends an e-mail message to
> someone. Is there
> a way of checking an e-mail address for new messages through a CGI
> script or a program?
CPAN Mail
------------------------------
Date: 10 Aug 1999 17:07:49 GMT
From: mesarchm@aol.com (Mesarchm)
Subject: Re: Reading the Online Documentation?
Message-Id: <19990810130749.16170.00000105@ng-cg1.aol.com>
<<All the *Best* teachers that I knew in school were understanding. I
never learned anything from the ones that used your ill-thought
technique, of humiliation and mind torture.
The best teachers show patience and understanding, and realize that
the only way to really teach anything, is from a positive side.>>
That is my whole point
------------------------------
Date: Tue, 10 Aug 1999 11:01:36 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Reading the Online Documentation?
Message-Id: <MPG.121a08de18ead458989e1b@nntp.hpl.hp.com>
In article <37B03E31.2C79F52C@texas.net> on Tue, 10 Aug 1999 09:58:57 -
0500, Tom Briles <sariq@texas.net> says...
> Mesarchm wrote:
> >
> > I am not argueing that the docs aren't the best place to look 1st. But what I
> > am saying is that if people turn to you for help, being willing to help. The
> > perfect example is Mr. Know it all (Just Another Larry) Rosler Hewlett-Packard
> > Laboratories.
>
> I can attest to at least one thing that Larry *doesn't* know. So there!
Oh, yeah? Tell me what that might be. (And then I'll know it.
Hehehe.)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 10 Aug 1999 17:21:39 GMT
From: ebohlman@netcom.com (Eric Bohlman)
Subject: Re: search and match
Message-Id: <7opn33$occ@dfw-ixnews3.ix.netcom.com>
Christian Evans (chris.evans@tc.faa.gov) wrote:
: while (<IN_FILE>) {
: if((/$search_for/) || ($search_for2)) {
: print "$_">OUT_FILE;
This is most likely your problem. You're trying to write awk code in
Perl. The above line means "treat the current value of $_ as a number.
Compare it numerically with the filehandle OUT_FILE. Print '1' to STDOUT
if it's greater, or '0' otherwise."
In Perl, what you want is:
print OUT_FILE $_;
which can be simplified to:
print OUT_FILE;
since $_ is the default argument to print().
------------------------------
Date: Tue, 10 Aug 1999 14:22:04 -0400
From: "Christian Evans" <chris.evans@tc.faa.gov>
Subject: Re: search and match
Message-Id: <7opqkk$asl$1@faatcrl.faa.gov>
that didnt work...the print OUT_FILE i mean
chris
Eric Bohlman <ebohlman@netcom.com> wrote in message
news:7opn33$occ@dfw-ixnews3.ix.netcom.com...
> Christian Evans (chris.evans@tc.faa.gov) wrote:
> : while (<IN_FILE>) {
> : if((/$search_for/) || ($search_for2)) {
> : print "$_">OUT_FILE;
>
> This is most likely your problem. You're trying to write awk code in
> Perl. The above line means "treat the current value of $_ as a number.
> Compare it numerically with the filehandle OUT_FILE. Print '1' to STDOUT
> if it's greater, or '0' otherwise."
>
> In Perl, what you want is:
>
> print OUT_FILE $_;
>
> which can be simplified to:
>
> print OUT_FILE;
>
> since $_ is the default argument to print().
------------------------------
Date: Tue, 10 Aug 1999 11:41:32 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Simple write routine
Message-Id: <37B0725C.EBD226E0@mail.cor.epa.gov>
Anno Siegel wrote:
>
> Uri Guttman <uri@sysarch.com> wrote in comp.lang.perl.misc:
>
> > $date_file = 'y2kcompatible' ;
> > open( DATE, ">$date_file" ) || die "can't create file $date_file $!" ;
> > print DATE scalar( localtime ), "\n" ;
> > close( DATE ) || die "can't close file $date_file $!" ;
>
> I have rarely seen a check on close of an ordinary file. Is there
> any particular reason why you include it here? Or just general
> tidiness?
I like to check my close()s because some of our Slowlaris boxes
have itty bitty /tmp partitions which sometimes get filled up by
other processes [read: big ugly SAS and ARC/INFO jobs]. So
it isn't quite tidiness on my part. I wish.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 10 Aug 1999 19:04:45 GMT
From: null@effierover.com (Effie Rover)
Subject: Sorting by mid-record without splitting?
Message-Id: <37b4759d.527933037@news.iinc.com>
Perl Gurus:
I have a database, pipe-delimited, which I read from a file into an
array (because it's read from two files and mashed together based on
flags, not because I want to take up the extra memory).
Once I have my array, I want to sort it by the third field in the
record, i.e. here's a sample of my database:
1|Effie's Birthday|effie|10/07/1999|||||||Owner's Birthday|
2|Basqual's Birthday|basqual|10/14/1999|||||||The Mighty Ranger|
3|Micah Jackson at Pyramid Games|micah|08/09/1999||08:00 pm
cdt|||||Gen Con Wrap!|
4|INWO Summer Leagues|sue|08/12/1999||06:00 pm cdt|||||INWO games|
[Newsreader wrapped some lines]
I already know how to split records, pull fields and either build a
hash or another array with the key field in front for sorting. Isn't
there a Perl construct to sort these without splitting? I thought
there was, but I pored over 'sort' in all my available resources
(book, docs, faq and Deja) and can't find a solution without building
an extraneous hash. Or maybe I'm just not understanding the code
correctly.
Many thanks in advance for a quick pointer or a No.
-- Loy
Loy Ellen Gross AKA Effie Rover -- effie @ effierover . com
The email address above goes straight to /dev/null :-)
Effie Rover's Fantasy RPG Library -- http://www.effierover.com
------------------------------------------------------------------
Dwoemers sent in the vile tongue of Redmond may be given as ritual
sacrifice to the void faerie. (Don't send me HTML formatted email)
------------------------------
Date: Tue, 10 Aug 1999 11:37:06 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: suggestions for CRAP
Message-Id: <37B07152.E60BC90A@mail.cor.epa.gov>
Uri Guttman wrote:
[big snip]
> maybe we should form a little project to create a web site with quality
> cgi (and other) scripts. if tom can raise support for the power tools
> project, this should be doable too. then we can finally direct folks to
> examples of cgi code we can be proud of. this crap is embarrassing to
> the perl community.
Jeff already has the www.mattright.com site.
^^^^^
Sounds good here...
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 10 Aug 1999 13:56:23 -0400
From: Brian Bailey <babailey@mediaone.net>
Subject: using alarm under win32
Message-Id: <37B067C6.63B5A847@mediaone.net>
I can't get alarm() to work under win32. Is there any way to do
something similar to alarm() under win32. Here's a simple example of
how I intended to use it. This works under unix:
print "Enter a number:";
eval{
local $SIG{ALRM} = sub { die };
alarm 5;
$no = <STDIN>;
print "You typed $no\n";
alarm 0;
1;
} or print "Too Late!\n";
------------------------------
Date: Tue, 10 Aug 1999 17:48:27 GMT
From: thecopperkid@my-deja.com
Subject: Using the system command
Message-Id: <7opol6$lrl$1@nnrp1.deja.com>
Hi,
I'm trying to use the system command in PERL to fire off a program
which needs piped input in the form of:
echo 'CCCC' | program
I've tried tons of different orientations and I can't seem to find one
that works. Note: this is being run via a webserver. Here is the
actual sh line:
echo '$SMI<CCCCC>|' | $DY_ROOT/bin/clogp +PCMODELS_TABLEOUTPUT
and here is what I would like to do in perl (Note: $SMI is needed for
the formated input to the program... It is not a variable):
$smiles = "CCCCC";
system ("echo $SMI<$smiles>|", "| $DY_ROOT/bin/clogp
+PCMODELS_TABLEOUTPUT");
Is there a way I can do this using system (or any other function) and
how would you suggest that I do the ""ing so that my variable
interpolation works correctly?
Thanks,
Ray.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 10 Aug 1999 18:05:00 GMT
From: n0jokeg@my-deja.com
Subject: Re: Using the system command
Message-Id: <7oppk4$mlr$1@nnrp1.deja.com>
In article <7opol6$lrl$1@nnrp1.deja.com>,
thecopperkid@my-deja.com wrote:
> Hi,
>
> I'm trying to use the system command in PERL to fire off a program
> which needs piped input in the form of:
>
> echo 'CCCC' | program
>
> I've tried tons of different orientations and I can't seem to find one
> that works. Note: this is being run via a webserver. Here is the
> actual sh line:
> echo '$SMI<CCCCC>|' | $DY_ROOT/bin/clogp +PCMODELS_TABLEOUTPUT
>
> and here is what I would like to do in perl (Note: $SMI is needed for
> the formated input to the program... It is not a variable):
>
> $smiles = "CCCCC";
> system ("echo $SMI<$smiles>|", "| $DY_ROOT/bin/clogp
> +PCMODELS_TABLEOUTPUT");
>
> Is there a way I can do this using system (or any other function) and
> how would you suggest that I do the ""ing so that my variable
> interpolation works correctly?
You need to use \$SMI because $SMI will interpolate null into your
string.
There's no need to use system() in this case just use backticks:
$output = `command`;
~konrad
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Tue, 10 Aug 1999 12:01:15 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Web Calendar Help.... !!!
Message-Id: <37B076FB.D4CE044D@mail.cor.epa.gov>
vnova94@aol.com wrote:
>
> I have looked at the FAQ, but have not found the answer to my problem.
> I think my problem is that I'm not using unix. I am running the script
> on a Windows NT machine. It is not accepting inputs.... i.e. when i
> select a new month from the form, it will not advance to that form. How
> can i enable this script to run on my site. Are there different
> commands I need to substitute?
If it isn't even accepting inputs, how do you know that it is
even being executed? One thing you need to check first is
whether your webserver is executing *any* Perl scripts. If it
is, then you need to see what the server logs tell you about
the process. If you can't get at the server logs, look at
the CGI::Carp module, in particular the helpful code:
use CGI::Carp qw(fatalsToBrowser); # right out of module docs
I would expect that the code to read the inputs ought to be
fairly platform-independent.. although I wouldn't count on
it, given the ghastly state of free web code on the net.
HTH,
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Tue, 10 Aug 1999 18:35:52 GMT
From: wvenable_net@iname.com (Wayne Venables)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <37b07036.920970@news.sprint.ca>
On Tue, 10 Aug 1999 14:00:29 GMT, *@dragons.duesouth.net (Matthew
Bafford) wrote:
>The first thing I look for when choosing a new language to learn is its
>aesthetic qualities. If I don't like the way a language looks or feels,
>I drop it immediately.
How did you ever manage to become a Perl programmer?? My first week
with Perl was an experience in "what the f***"... and it still
manages to baffle me sometimes (what the hell is with those procedure
prototypes *grin*)
>I never bother trying to program in a language that has no appeal to me.
>If, after my first few attempts, a language leaves my head spinning, I
>drop it.
Perl orginally drove me absolutely insane; it took me a few weeks
(as I'm sure it takes everyone) to really get a feel for it.
Later,
------------------------------
Date: Tue, 10 Aug 1999 19:02:21 GMT
From: *@dragons.duesouth.net (Matthew Bafford)
Subject: Re: Why use Perl when we've got Python?!
Message-Id: <slrn7r0t62.cit.*@dragons.duesouth.net>
Wayne:
: On Tue, 10 Aug 1999 14:00:29 GMT, *@dragons.duesouth.net (Matthew
: Bafford) wrote:
: >The first thing I look for when choosing a new language to learn is its
: >aesthetic qualities. If I don't like the way a language looks or feels,
: >I drop it immediately.
:
: How did you ever manage to become a Perl programmer?? My first week
: with Perl was an experience in "what the f***"... and it still
: manages to baffle me sometimes (what the hell is with those procedure
: prototypes *grin*)
Oh, at first I wasn't sure what was going on, but I knew I liked it the
first time I saw something written in it. Right before I learned Perl I
was programming extensively in C. For me, Perl was cleaner, more
compact, and all around more beautiful (sexy?) than any C code I'd ever
seen.
Now that I've been programming in Perl for a while, I've found things
that I don't like about it. But, all in all, I still enjoy programming
in it more than other languages. If something better came along, I'd
probably go that route instead.
: >I never bother trying to program in a language that has no appeal to me.
: >If, after my first few attempts, a language leaves my head spinning, I
: >drop it.
:
: Perl orginally drove me absolutely insane; it took me a few weeks
: (as I'm sure it takes everyone) to really get a feel for it.
I dunno, I guess (The Larry) Wall and I think a little bit alike.
Maybe not.
: Later,
--Matthew
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
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" from
almanac@ruby.oce.orst.edu. The real FAQ, as it appeared last in the
newsgroup, can be retrieved with the request "send perl-users FAQ" from
almanac@ruby.oce.orst.edu. 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" from
almanac@ruby.oce.orst.edu.
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 449
*************************************