[9496] in Perl-Users-Digest
Perl-Users Digest, Issue: 3090 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 8 01:07:33 1998
Date: Tue, 7 Jul 98 22:00:18 -0700
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, 7 Jul 1998 Volume: 8 Number: 3090
Today's topics:
Re: -w on production code (was Re: better way of gettin <tchrist@mox.perl.com>
Re: -w on production code (was Re: better way of gettin (Craig Berry)
Re: -w on production code (was Re: better way of gettin <ljz@asfast.com>
Re: -w on production code (was Re: better way of gettin (Abigail)
Re: any way to measure sub-seconds? was Re: how long do <dtbaker_@flash.net>
Re: any way to measure sub-seconds? was Re: how long do <dtbaker_@flash.net>
DESPERATE hitters? <azman@bnex.com>
Re: Do we need lame msgs in discussions? Re : Martien V <azman@bnex.com>
Re: Do we need lame msgs in discussions? Re : Martien V <azman@bnex.com>
Re: Do we need lame msgs in discussions? Re : Martien V <azman@bnex.com>
Re: Getting Yesterday's Date <tchrist@mox.perl.com>
Re: How to get files in a directory? (Tad McClellan)
module installation problem madcow99@my-dejanews.com
Re: new charter and moderator for comp.lang.perl.announ (Tad McClellan)
Re: New mind to mold. (Craig Berry)
Re: on the fly subs with special tag markers Re: method <dtbaker_@flash.net>
Re: on the fly subs with special tag markers Re: method <dtbaker_@flash.net>
Re: Pattern matching problems (brian d foy)
Perl trivia: hash definition w/o initialization? <NOSPAMkEynOn@panix.comNOSPAM>
Problems running Perl CGI with Apache <smiths@erols.com>
Re: running a cgi/perl program every 7 am? (Lab Rat)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 8 Jul 1998 03:45:59 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6nuq1n$3eq$3@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
Lloyd Zusman <ljz@asfast.com> writes:
:If using `-w' was clearly an advantage in all production code, then
:why is this an *option* in the first place? Wouldn't it be best, if
:this were the case, that `-w' disappear as an option altogether, and
:its behavior be the default?
% man perl
[...]
If something strange has gone wrong with your program and you're
not sure where you should look for help, try the -w switch first.
It will often point out exactly where the trouble is.
[...]
o Many usability enhancements
It is now possible to write much more readable Perl code (even
within regular expressions). Formerly cryptic variable names can
be replaced by mnemonic identifiers. Error messages are more
informative, and the optional warnings will catch many of the
mistakes a novice might make. This cannot be stressed enough.
Whenever you get mysterious behavior, try the -w switch!!!
Whenever you don't get mysterious behavior, try using -w anyway.
DIAGNOSTICS
The -w switch produces some lovely diagnostics.
See the perldiag manpage for explanations of all Perl's diagnostics.
[...]
Did we mention that you should definitely consider using
the -w switch?
BUGS
The -w switch is not mandatory.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
--
"Don't let it get to you. Shout happens." --Larry Wall
------------------------------
Date: 8 Jul 1998 04:14:03 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6nurmb$msr$2@marina.cinenet.net>
Lloyd Zusman (ljz@asfast.com) wrote:
: If using `-w' was clearly an advantage in all production code, then
: why is this an *option* in the first place? Wouldn't it be best, if
: this were the case, that `-w' disappear as an option altogether, and
: its behavior be the default?
>From 'perldoc perl', 5.004_04:
BUGS
The -w switch is not mandatory.
So clearly someone in the Larry/Randal/Tom triumvirate agrees with you
(and me).
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: 08 Jul 1998 00:42:46 -0400
From: Lloyd Zusman <ljz@asfast.com>
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <lt67h97y2h.fsf@asfast.com>
Tom Christiansen <tchrist@mox.perl.com> writes:
> [ ... ]
> Lloyd Zusman <ljz@asfast.com> writes:
> : [ ... ] Wouldn't it be best, if
> :this were the case, that `-w' disappear as an option altogether, and
> :its behavior be the default?
>
> % man perl
>
> [ ... ]
>
> BUGS
> The -w switch is not mandatory.
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Yes, I've seen all this. And now I realize that I should probably
re-pose my original question in a somewhat different manner:
Why has this `-w' bug not yet been fixed?
This is not a rhetorical question. I'm really wondering what the
reasons are for `-w' not being mandatory and for its behavior to not
be the default. Is this on the official bug list, but perhaps higher
priority items are also there that need to be addressed first? Is
this change in behavior going to appear in an upcoming Perl release?
Are there differences of opinion among the Perl developers as to the
mandatoriness of `-w'? Are there perhaps "prior art" considerations?
I see and recognize the value of the `-w' switch, and therefore, I
believe that there must be *some* reason for its associated behavior
not becoming the default.
--
Lloyd Zusman ljz@asfast.com
perl -e '$n=170;for($d=2;($d*$d)<=$n;$d+=(1+($d%2))){for($t=0;($n%$d)==0;
$t++){$n=int($n/$d);}while($t-->0){push(@r,$d);}}if($n>1){push(@r,$n);}
$x=0;map{$x+=(($_>0)?(1<<log($_-0.5)/log(2.0)+1):1)}@r;print"$x\n"'
------------------------------
Date: 8 Jul 1998 04:48:47 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: -w on production code (was Re: better way of getting the last modified file?)
Message-Id: <6nutnf$hug$1@client3.news.psi.net>
Lloyd Zusman (ljz@asfast.com) wrote on MDCCLXXII September MCMXCIII in
<URL: news:ltr9zx83v6.fsf@asfast.com>:
++
++ If using `-w' was clearly an advantage in all production code, then
++ why is this an *option* in the first place? Wouldn't it be best, if
++ this were the case, that `-w' disappear as an option altogether, and
++ its behavior be the default? There could then be a different option
++ to turn off these warnings in the odd, occasional, esoteric cases
++ where they might not be wanted.
Backwards compatibility demands that the -w switch cannot suddenly become
the default. Furthermore, if you type a quick, one-shot one-liner on
the command line, you probably don't need -w. (Although I almost always
do anyway).
Abigail
--
perl -wle '$, = " "; print grep {(1 x $_) !~ /^(11+)\1+$/} 2 .. shift'
------------------------------
Date: Tue, 07 Jul 1998 22:21:14 -0500
From: Dan Baker <dtbaker_@flash.net>
Subject: Re: any way to measure sub-seconds? was Re: how long does it take to execute some code?
Message-Id: <35A2E5AA.5193@flash.net>
Larry Rosler wrote:
> > > printf "%.2f\n", $t1 - $t0; # The difference is in seconds.
>
> Perhaps I wasn't clear enough about this. Note the two-decimal print
> format. The unit reported is seconds, but the resolution is system-
> dependent. According to `man 2 times`, it is 1/CLK_TCK of a second. On
> my system, CLK_TCK is 100, so my resolution is 100 milliseconds; YMMV.
-------------
ooohhhhh, I missed that part! I'll have to test to se if that works on
win95...
D
------------------------------
Date: Tue, 07 Jul 1998 22:22:56 -0500
From: Dan Baker <dtbaker_@flash.net>
Subject: Re: any way to measure sub-seconds? was Re: how long does it take to execute some code?
Message-Id: <35A2E610.2DA8@flash.net>
brian d foy wrote:
>
> In article <35A2A74D.4B61@flash.net>, dtbaker_@flash.net posted:
>
> >I've kinda been wonding about this too.... measuring to the nearest
> >second sometimes isn't too accurate. Is there anything for better
> >accuracy? Sometimes you can't build a test loop to repeat 1000x while
> >testing...
>
> did you try Time::HiRes?
----------
ahhhh, so many modules, so little time!
Dan
------------------------------
Date: Tue, 07 Jul 1998 12:16:21 +0800
From: Azman Shariff <azman@bnex.com>
Subject: DESPERATE hitters?
Message-Id: <35A1A114.7B783B07@bnex.com>
Well for one thing, how come a lot of support for this is coming into my
email box and not into the newsgroup?
It seems that people would spend the time flaming another and making our
day worse instead of making it far better. :) Selfish lot I would say. I
do get a lot of replies that just helped you straight without telling
you off. I find this kind of help is very beneficial and also what is
needed by most of us.
IMHO, I see some egoistic postings just out to score another. That was
the first question I posted in tha manner. I know this would come but
just to see how many people are just so desperate to score a hit. People
can just write a whole long reply to hit back when they could have used
the time writing that reply to be placed into perl codes for others to
learn and see.
What is the intention of browsing through this newgroup? To flame? To
score a hit? Yes, we sometimes needs to be 'flamed' in order to learn or
be pointed to another resource but flaming also has it's ways. Most
people just flame and go overboard and get hated upon.
To those who have nothing better to say, take my advice...... go spend
time with your grandchildren. I think what everyone needs here is just
help and dicussions..... no flames.... i can have that by just lighting
a matchstick.... I do not need that in the mail.
#this is to check for lame remarks and some lame idiot
sub lame_remarks_or_idiot_detected {
$_ =~ s/lame_remarks//gi;
if (found lame idiot){
give lame idiot grandchildren to play with;
}
}
(anyone wanna help me change that code? )
:)
cherios .......
Anyway no offence to the lot of you flamers..... just that what we need
is REAL help and advice.... if should you need to 'attack' someone for
his stupidity or ignorance.... please use a better approach ... maybe
you lamers should read the book entitled "Flaming for IDIOTS".. thank
you :)
Azman Shariff
"Perl is a great languange but not some of it's users"
Ronald J Kimball wrote:
>
> Azman Shariff <azman@bnex.com> wrote:
>
> > I noticed three kinds of repliers here basically they all in the
> > catogeries
> > 1) Sincere answer to solve the problem
> > 2) Just a flame telling ppl off
> > 3) An answer to the question but added a flame
>
> You forgot one...
>
> 4) Posts criticizing other peoples' posting styles.
>
> Been there, done that.
>
> By the way, your newsreader is not line-wrapping properly, so your
> message is a bit awkward to read. :-)
>
------------------------------
Date: Tue, 07 Jul 1998 12:17:56 +0800
From: Azman Shariff <azman@bnex.com>
Subject: Re: Do we need lame msgs in discussions? Re : Martien Verbruggen
Message-Id: <35A1A174.60C90EAE@bnex.com>
brian d foy wrote:
>
> In article <1dbtim9.1y7t9on7f41s7N@bay2-137.quincy.ziplink.net>, rjk@coos.dartmouth.edu (Ronald J Kimball) posted:
>
> >Azman Shariff <azman@bnex.com> wrote:
> >
> >> I noticed three kinds of repliers here basically they all in the
> >> catogeries
> >> 1) Sincere answer to solve the problem
> >> 2) Just a flame telling ppl off
> >> 3) An answer to the question but added a flame
> >
> >You forgot one...
> >
> >4) Posts criticizing other peoples' posting styles.
>
> [i think you should indent more, you nazi[1] ]
>
> the more i think about this, the more i think 1) and 3) are
> not mutually exclusive. nor 1) and 2). i think the values
> for "sincere" and "problem" are nebulous at best. but then,
> what do you expect with a forum that crosses so many demographic
> boundaries?
>
> kill files are nice, but the best flamers usually have the best
> nuggets of wisdom too ;)
The best flamers have the best level of stoooooooooopidity :)
They waste time......
:)
Azman
------------------------------
Date: Tue, 07 Jul 1998 12:22:42 +0800
From: Azman Shariff <azman@bnex.com>
Subject: Re: Do we need lame msgs in discussions? Re : Martien Verbruggen
Message-Id: <35A1A291.475F043F@bnex.com>
Why would a simple request to know how to check the size of an array be
given a reply that is included with a flame from you??
I have asked some obvious questions before here ( i admit) but then the
replies i get are great like
"please refer to the docs by typing perldoc blah blah "
That is much a better reply... than one that comes from the 3rd class
The moment i got your reply i was shocked to receive a stopid remark
with the answer at the bottom. Think about it.... or go play with your
granchildren.
Azman
> Just for the record: If you take the trouble of going through some of
> the messages that I have posted here, you will notice that I make a
> serious attempt to answer any perl questions, even if the answer is
> accompanied by what you call 'a flame'. I do not harrass people for
> being new to perl, or for not knowing things. I do harrass people for
> being lazy, or for having a gimme mentality. That is exactly what the
> above quoted paragraph from my post was about.
>
> Martien
> --
> Martien Verbruggen |
> Webmaster www.tradingpost.com.au |
> Commercial Dynamics Pty. Ltd. | What's another word for Thesaurus?
> NSW, Australia |
------------------------------
Date: Tue, 07 Jul 1998 12:31:47 +0800
From: Azman Shariff <azman@bnex.com>
Subject: Re: Do we need lame msgs in discussions? Re : Martien Verbruggen
Message-Id: <35A1A4B3.FC50DBBF@bnex.com>
Alan J. Flavell wrote:
>
> On Mon, 6 Jul 1998, Azman Shariff wrote:
>
> > he question here is "Do we need his kind of replies to questions posed?"
>
> Have you considered the possibility that low-quality answers are often
> provoked by low-quality questions? I'd say the solution is pretty much
> in the hands of those who post the lame questions. There's even an FAQ
> advising how to compose an effective question, and every day we see a
> whole string of questions that appear to have been composed by taking
> that FAQ and carefully violating each of the points.
low quality????
1) I asked a question
2) I receive an answer plus a flame remark
in the first place..... if the sender of that remark thinks that i
should look up the manual..... TELL ME SO!! no need to be a sarcastic
person just to give me the answer.
It is like going to your day and asking him "daddy what is the meaning
of indulgence?"
and he replies "you are sooo irritating!!! don't you know how to go to
your room and then look through your dictionary and look it up there??
ok ok if you want the answer it is ......"
:)
Azman
------------------------------
Date: 8 Jul 1998 04:46:13 GMT
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Getting Yesterday's Date
Message-Id: <6nutil$9kr$1@csnews.cs.colorado.edu>
[courtesy cc of this posting sent to cited author via email]
In comp.lang.perl.misc,
allbery@kf8nh.apk.net writes:
:Technically, though, he's correct: what about leap seconds? :-) :-)
Leap seconds are ignored. time() is 29 seconds wrong, be definition.
--tom
--
Timesharing: the use of several people by the computer
------------------------------
Date: Tue, 7 Jul 1998 22:12:29 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: How to get files in a directory?
Message-Id: <t2oun6.mo2.ln@localhost>
John Chambers (jc@ral1.zko.dec.com) wrote:
: brian d foy wrote:
: >
: > In article <359BAB97.9CCFC665@perrier.bmc.uu.se>, m94tne@student.tdb.uu.se posted:
: >
: > >What is the command for getting (all) files (as a list) in the current
: > >directory?
: Jeez, why didn't anyone even mention the much simpler solution:
^^^^
I don't think Jesus reads this newsgroup... ;-)
: @files = glob("*");
Maybe because globbing is system specific and
and opendir() and friends work on all perl ports?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 08 Jul 1998 04:14:46 GMT
From: madcow99@my-dejanews.com
Subject: module installation problem
Message-Id: <6nurnm$fs3$1@nnrp1.dejanews.com>
I've been trying to install the TK package and the Data dumper package into
the merged activeware version. I've used the ppm.pl to install them and i've
tried installing them manually, but no matter what i get an error like: can't
find something.pm in @INC and it lists all the paths. or i get something like
can't find loadable object. Any ideas what the problem is? Everything works
fine under Gurusamy Sarathy's Version. Thanks.
Steve
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 7 Jul 1998 23:25:23 -0500
From: tadmc@flash.net (Tad McClellan)
Subject: Re: new charter and moderator for comp.lang.perl.announce
Message-Id: <jbsun6.2v2.ln@localhost>
Pat Gunn (pgunn01@ibm.net) wrote:
: I would like to nominate myself as moderator for comp.lang.perl.misc.
s/misc/announce/;
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 8 Jul 1998 03:56:52 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: New mind to mold.
Message-Id: <6nuqm4$msr$1@marina.cinenet.net>
n/a (crash323@jps.net) wrote:
: A few weeks ago, I learned that my ISP gives me a shell account to a BSD
: machine.
Cool...but note that you can also run Perl on your own personal machine,
unless it's something really strange. Developing scripts locally is often
much easier than doing so on a remote machine.
: After the elation died down I set my mind to learning the system,
: and soon after Perl. I have understood for a while that the Internet's
: backbone is UNIX and to truly be an Internet-wise person I had to harness
: it's power.
So quickly you come to wisdom, Grasshopper. :)
: So I tried my hand at the "Hello World" program which I had
: already done with BASIC and C (which I soon dropped, but am eager to learn.)
: and then looked for the on-line tutorials. After getting a _very_ basic
: knowledge of Scalars, Arrays, and so on, I realized I need a more detailed
: source of Perl wisdom to refer to. I have read about The Camel and Lama
: books, but it was soon brought to my attention that these were more of the
: Perl-inclined.
It certainly sounds like *you* are Perl-inclined...and the Llama's target
audience is precisely people like you, with a modicum of programming
experience but no knowledge whatsoever about Perl.
: So my basic question is this: where (online or printed
: literature) can I find tutorials and related information about Perl for a
: non-expert?
Get the to a Llama!
: Someone who _wants_ to be "Just Another Perl Hacker." - hope that was the
: right thing to say.
I can imagine few righter things to say around here.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Tue, 07 Jul 1998 22:29:35 -0500
From: Dan Baker <dtbaker_@flash.net>
Subject: Re: on the fly subs with special tag markers Re: methods to insert/substitute blocks of text?
Message-Id: <35A2E79F.EEF@flash.net>
brian d foy wrote:
> time for your homework ;)
>... see
>
> Learning Perl
> Randal L. Schwartz & Tom Christiansen
> ISBN 1-56592-284-0
> <URL:http://www.oreilly.com>
--------------
ok ok, I get the point. The standard RFM response is a little daunting
to those of us who HAVE been reading desperately and are still a little
confused and looking for a little straightforward help... I realize that
if I read every Oreilly book out there I'd probably have the answer! The
question is a matter of when....
If all you want to do if point me to a book, I'd find it more helpful if
you could give a hint like maybe what chapter, or page you you don't
want to re-type.
Dan
------------------------------
Date: Tue, 07 Jul 1998 22:51:26 -0500
From: Dan Baker <dtbaker_@flash.net>
Subject: Re: on the fly subs with special tag markers Re: methods to insert/substitute blocks of text?
Message-Id: <35A2ECBE.2D46@flash.net>
Larry Rosler wrote:
> Dan Baker <dtbaker_@flash.net> says...
> ...
> > In case anyone wants
> > to explain a little, I've put my questions below... I'm a novice, so be
> > patient. ;)
> ...
>
> Well, since you asked so nicely...
--------------
THANK YOU LARRY! Your response is VERY helpful and instructive. I'm sure
that it probably helped point out some of the more subtle things to
newbies like me. I appreciate the time and clarity with which you've
explained the constructs I hadn't seen in the beginners books!
> > > print template("/home/httpd/templates/simple.template", \%fields);
> > >
> > > sub template {
> > > my ($filename, $fillings) = @_;
> > ---
> > how can both of these be assigned @_ ? I don't see what happens here,
> > anyone explain?
>
> This statement assigns a list to a list, which is done scalar by scalar.
> The first argument $_[0] is assigned to $filename; the second argument
> $_[1] is assigned to $fillings.
--------------
ok, I'm sorta getting this, but just to make sure... I can see how the
scalar "/home/httpd/templates/simple.template" maps right into
$filename, but am a little confused on how the %fields list gets
flattened into the string $fillings ??? Why wouldn't the assignment have
to match types like:
my ($filename, @fillings) = @_;
?
>
> > > my $text;
> > > local $/; # slurp mode (undef)
> > ---
> > what's this? any suggested reading? i.e. why do we need to worry about
> > the input record separator, or is that not what it is here?
>
> Yes, it is, and we don't want no steenkeen' input record separator (in
> order to handle parameter substitutions that span more than one line).
> See the discussion of $/ in perlvar.
----------------
okdoky.... read I shall.
>
> > > # replace quoted words with value in %$fillings hash
> > > $text =~ s{ %% ( .*? ) %% }
> > > { exists( $fillings->{$1} )
> > > ? $fillings->{$1}
> > > : ""
> > > }gsex;
> > ---
> > can someone go slow and explain what each line of this expression does?
>
> Extract into $1 the fewest number of characters between pairs of '%%' and
> '%%' (including none; the * could as well have been a +). If that string
> is a key of the hash referred to by $fillings, replace the matched string
> by the value of the hash member; otherwise replace the matched string by
> nothing. [Even more compactly: { exists $fillings->{$1} && $fillings-
> >{$1} } .]
>
> Do it over and over ('g'), allowing the '.' to match the embedded "\n"
> characters ('s'), evaluating the second part of the substitution as a
> Perl expression ('e'), and allowing for white space and comments in the
> regular expression ('x'). [The order of these four options is
> irrelevant. Hmmm...]
---------
great, thank you! .... I like the gsex order, it will be easy to
remember... ;)
> All this is somewhat beyond 'Learning Perl' but certainly clear enough
> from 'Programming Perl' or perlre.
---------
well I'm barely at "learning perl" when it comes to some of the subtle
syntax... so thanx for explaining!
Dan
------------------------------
Date: Wed, 08 Jul 1998 00:46:09 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Pattern matching problems
Message-Id: <comdog-ya02408000R0807980046090001@news.panix.com>
Keywords: from just another new york perl hacker
In article <1dbtk3h.1qqhw1bns6h6hN@bay2-137.quincy.ziplink.net>, rjk@coos.dartmouth.edu (Ronald J Kimball) posted:
>Larry Rosler <lr@hpl.hp.com> wrote:
>
>> $newword =~ s/([aeiou])/$newvowel{$1}/g;
>
>That changes all the vowels all at once, whereas the original poster
>wanted to change one vowel, print the result, change the next vowel, and
>so on.
>
>I don't think it can be done using just a s///. (Yes, /e would help,
>but the prints would be in the wrong place. :-)
does this count? :)
#!/usr/bin/perl
%h = qw( a e i o u a e i o u );
$_ = 'facetious';
print "$_\n";
s/([aeiou])/$old.=substr($`,length $old,length $`-length $old).$h{$1};
print "$old$'\n";
$h{$1}
/ge;
__END__
facetious
fecetious
fecitious
fecitoous
fecitouus
fecitouas
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
Comprehensive Perl Archive Network (CPAN) <URL:http://www.perl.com>
Perl Mongers Travel Deals! <URL:http://www.pm.org/travel.html>
------------------------------
Date: 8 Jul 1998 04:55:31 GMT
From: k y n n <NOSPAMkEynOn@panix.comNOSPAM>
Subject: Perl trivia: hash definition w/o initialization?
Message-Id: <6nuu43$9nm@news1.panix.com>
I often use hashes for solely for the hash lookup capability (i.e. the
values corresponding to the keys is immaterial). So often I find
myself writing stuff like:
$some_set{$item} = 1;
or, more efficiently,
%some_set = map { $_, 1 } @items;
so that I can later write something like
&create($item) unless $some_set{$item};
But with the "exists" function, I don't even need the initialization
value:
&prompt($item) unless exists $some_set{$item};
Quoth the camel: "A hash element... can only be defined if it exists,
but the reverse doesn't necessarily hold true...". So I was curious
about whether there was a way to define a hash corresponding to a
whole list of key values, without initializing the individual hash
elements. (Of course, this question falls under the heading of "Perl
trivia"; there's nothing wrong with "%some_set = map { $_, 1 }
@items".)
K.
--
To those who prefer to reply by e-mail, please remove the upper-case
letters from the return address in the header. Thank you. K.
------------------------------
Date: Wed, 8 Jul 1998 00:21:35 -0400
From: "The Smiths" <smiths@erols.com>
Subject: Problems running Perl CGI with Apache
Message-Id: <6nurrb$1hh$1@winter.news.erols.com>
Hi,
I just installed Apache 1.3.0 on Win95. I also have ActiveWare Win32 Perl
5.003_07 installed. I am using mod_cgi (versus mod_perl) and always receive
"couldn't spawn child process" in my Apache error log when I attempt to run
my Perl CGI. On the browser side, I receive error 500. I don't think that
it matters, but the HTTP request is a GET and there is no QUERY_STRING.
Executing the Perl CGI from a DOS command line works fine. Yet, from the
GET request, it always fails with this error.
Does anyone have any ideas that I could try. I suspect that I have a setup
problem, but have run out of configuration changes that look like they could
help.
Thanks,
Tim.
------------------------------
Date: 8 Jul 1998 04:01:37 GMT
From: mhaycr1@umbc.edu (Lab Rat)
Subject: Re: running a cgi/perl program every 7 am?
Message-Id: <6nuqv1$8tm$1@news.umbc.edu>
Hold up, you have a "cgi program" that you need to run at 7am???
This sounds incorrect.
A CGI program is a program invoked by a web server as a side effect
because a http client (ie: netscape/ie/lynx/etc..) requested the service.
If you really wanted to run a CGI prgroam at 7am then one would probably
want to make a request to the web server..
ie: `echo "GET /cgi-bin/program.name?arguments HTTP/1.0\n\n" |\
telnet host port`
(or simply opening a dual filehandle connection to the port and sending the
HTTP command directly)
However by the other posts I have seen, it looks like you simply want to
run a perl script at 7 am.
In that case, when you download IE 4.0 for windows95, one of the add ons
gives you support for running a command at a specific time.
(not that I've used it)
And yes windows NT has a cron like feature. Unix ofcourse has cron :)
But yes one could write a simple cron like functionality
with sleep or even select (if you really want to ;-p)
I think select (undef, undef, undef, $seconds) gives you a more refined
wait routine.. both of which return cpu control to the kernel
therby saving cpu time
: I have got a cgi program written in perl.
: I need run it 7 am every day. In UNIX one
: can simply use the command `at' to do so.
: Are they any equivalent command in perl/cgi
: that can do such background job?
: -----== Posted via Deja News, The Leader in Internet Discussion ==-----
: http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
--
.-.-..--._|_ _|_ AND SOMETIMES I THINK THAT WE ARE ALL BALLOONS WITH
| | |.--| | | LONG STRINGS SEARCHING FOR SOMETHING TO TIE ON TO.
| ||__| | | http://umbc.edu/~mhaycr1 quote by:terrell neuage
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V8 Issue 3090
**************************************