[17018] in Perl-Users-Digest
Perl-Users Digest, Issue: 4430 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Sep 26 06:05:24 2000
Date: Tue, 26 Sep 2000 03:05:09 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <969962709-v9-i4430@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 26 Sep 2000 Volume: 9 Number: 4430
Today's topics:
Re: /me bangs head agains't brick wall <darryl@work-thicker.co.uk>
Re: ActivePerl ppm install DB_File on NT <bubby_titch@hotmail.com>
Re: Candidate for the top ten perl mistakes list (Craig Berry)
Re: Candidate for the top ten perl mistakes list (Abigail)
Re: Candidate for the top ten perl mistakes list (Logan Shaw)
Re: cgi behind proxy server <nico@monnet.to>
Controlling line length read by <> (Bernard El-Hagin)
Re: deamonize (Logan Shaw)
Re: determine where visitors are "living" (Chris Fedde)
Re: determine where visitors are "living" (Craig Berry)
Re: determine where visitors are "living" (Philip 'Yes, that's my address' Newton)
Re: determine where visitors are "living" <graham.wood@iona.com>
Enviroment Interaction For A Newbie <jon.klaff@rdel.co.uk>
fax with Win32-Serialport <murielross@sprint.ca>
freeware perl script to binary... <p.m.spandler@bton.ac.uk>
Re: freeware perl script to binary... (Abigail)
Re: freeware perl script to binary... <p.m.spandler@bton.ac.uk>
Re: freeware perl script to binary... (Rafael Garcia-Suarez)
Halloween Fun <jtjohnston@courrier.usherb.ca>
Re: Halloween Fun (Martien Verbruggen)
Re: Halloween Fun <godzilla@stomp.stomp.tokyo>
Re: Halloween Fun (Abigail)
Re: Massive kill Unix and Perl <mikecook@cigarpool.com>
Re: matching a date <derek@ooc.com.au>
Re: New to PERL (Chris Fedde)
Re: New to PERL (Abigail)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 26 Sep 2000 09:26:29 +0100
From: "CJ Llewellyn" <darryl@work-thicker.co.uk>
Subject: Re: /me bangs head agains't brick wall
Message-Id: <huqpq8.f56.ln@paulweller>
"Martien Verbruggen" <mgjv@verbruggen.comdyn.com.au> wrote in message
news:slrn8svoht.m9.mgjv@verbruggen.comdyn.com.au...
-snip-
> The Cookbook is an excellent book to use when you know Perl, but sort
> of need to get an idea on how to accomplish certain tasks. However, it
> shouldn't be used to _learn_ the language.
I'm not I got Learn Perl In 21 days for that. /me waits for roaring
laughter.
I remembered the actual reason I didn't want to use find, I wanted a
list/hash of files and directories to ignore such tmp/ or data/ and .xvpic/
(a directory created by gimp wherever you edit pics).
--
Regards, CJ Llewellyn
http://www.cjll.uklinux.net/
------------------------------
Date: Tue, 26 Sep 2000 02:20:36 -0500
From: Matthew Leonhardt <bubby_titch@hotmail.com>
Subject: Re: ActivePerl ppm install DB_File on NT
Message-Id: <39d04e80$0$56644$392904a7@news.execpc.com>
On Mon, 25 Sep 2000 14:02:38 GMT, acunet3278@my-deja.com wrote:
>Activestate perl is running on NT. We want to install DB_File to run a
>perl website search engine from kscripts.com.
>
>The people at kscript, suggested installing 'DB_File' by using this
>command: "ppm install DB_File"
>
>C:\Perl>ppm install DB_File
>Retrieving package 'DB_File'...
>HTTP POST failed: 500 (Can't connect to www.activestate.com:80 (Bad
>hostname 'ww
>w.activestate.com')), in SOAP method call. Content of response:
>at C:/Perl/site/lib/PPM/SOAPClient.pm line 222
>
>The machine where this command is run is behind a firewall. Could that
>be why the workstation cannot conenct to www.activestate.com
Anything's possible behind a firewall :)
>What can be done to get DB_File installed? Please advise. I look
>forward to hearing from you. Thank you.
You can download a Zip file directly from
http://www.activestate.com/PPMPackages/
You might have to read up on the PPM docs because I've found
installation from a local directory to be trickier than installation
from the web.
Good luck,
Matt
------------------------------
Date: Tue, 26 Sep 2000 06:14:31 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <st0fm7dkp7pae0@corp.supernews.com>
Abigail (abigail@foad.org) wrote:
: Of course, =< already has a meaning in Perl. < is the start of a glob,
: or a handleread, and the lexer will skip to the next >.
...until it is patched to do magic lookahead context parsing to determine
if it is seeing the start of a glob assignment or an =< operator. Plenty
of precedent for that sort of thing.
: @@ : - Logan, who wants to know when the ":-)" operator will be added[1].
: @@ :
: @@ : [1] And who is trying to think what its semantics would be if it
: @@ : were[2].
: @@
: @@ I would make it an alternative for the : in the ?: operator. The
: @@ semantics would be that in
: @@
: @@ a ? b :-) c
: @@
: @@ if a evaluated true, then the value would be b -- *unless* b evaluated
: @@ false, in which case it would be c. The idea would be 'a is true? Okay,
: @@ pick b -- wait, just kidding! It's c.'
:
: But that's as long as:
:
: a && b || c;
Parsimony arguments have no weight when proposing Perl features! :)
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Quidquid latine dictum sit, altum viditur."
|
------------------------------
Date: 26 Sep 2000 06:40:05 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <slrn8t0h3o.lo9.abigail@alexandra.foad.org>
Craig Berry (cberry@cinenet.net) wrote on MMDLXXXIII September MCMXCIII
in <URL:news:st0fm7dkp7pae0@corp.supernews.com>:
'' Abigail (abigail@foad.org) wrote:
'' : Of course, =< already has a meaning in Perl. < is the start of a glob,
'' : or a handleread, and the lexer will skip to the next >.
''
'' ...until it is patched to do magic lookahead context parsing to determine
'' if it is seeing the start of a glob assignment or an =< operator. Plenty
'' of precedent for that sort of thing.
Yeah, except that Perl is still supposed to be a 1-token lookahead parser.
Determinining a possible end of a glob however, takes more than 1 token.
In fact, it can take more than k tokens for any k.
Abigail
--
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
${qq$\x5F$} = q 97265646f9 and s g..g;
qq e\x63\x68\x72\x20\x30\x78$&eggee;
{eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'
------------------------------
Date: 26 Sep 2000 04:50:49 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: Candidate for the top ten perl mistakes list
Message-Id: <8qprhp$6p6$1@provolone.cs.utexas.edu>
In article <ssvqiskrlsckc1@corp.supernews.com>,
Craig Berry <cberry@cinenet.net> wrote:
>Logan Shaw (logan@cs.utexas.edu) wrote:
>[snip]
>: Well then, since "<=" and ">=" are opposites, logically what we really
>: should have is "=<" as the opposite of "=>". So,
>:
>: push @array =< $value;
>:
>: Pretty, isn't it?
>
>Both pretty and kinky. I vote yes! But we need to come up with some
>additional, non-obvious, and context-dependent ways for it to differ from
>=>, in order to give it that Perl feel.
O.K., here's a suitably vague and squishy "do what I mean" feature that
could be added.
If inside of parenthesis that happen to be being assigned to something
that Perl thinks might be hash or be used as a hash later, then =<
would reverse the key/value relationship of the arguments. So, this:
%x = ( 1 =< a, 2 =< b, 3 =< c );
would be equivalent to this:
%x = ( a => 1, b => 2, c => 3 );
But of course it would be muddy and unclear and not the same across all
perl versions whether this:
@x = ( 1 =< a, 2 =< b, 3 =< c );
%x = @x;
would be equivalent to this:
@x = ( a => 1, b => 2, c => 3 );
%x = @x;
or this:
@x = ( 1 =< a, 2 => b, 3 => c );
%x = @x;
But surely this:
%x = ( a => 1, 2 =< b, c => 3 );
would be considered bad style in all versions and by all reasonable
people, except those who speak languages whose written format
alternates left-to-right with right-to-left.
- Logan
------------------------------
Date: Tue, 26 Sep 2000 10:37:47 +0100
From: "Nicolas MONNET" <nico@monnet.to>
Subject: Re: cgi behind proxy server
Message-Id: <_lZz5.156$My3.3882@tengri.easynet.fr>
What the fuck was "BlueStar" <brandon.bartlett@mouat.com> trying to say:
> Greetings,
>
> Thank you for your kind and understanding reply! To further explain, I
> didn't install the proxy, I just have to deal with it now without access
> to the guy who did.
By "you" I meant your organization. Someone has installed this
firewall, right? They should know better about it that
comp.lang.perl.misc!!!
> Based on your suggestion, I guess I can ignore the "Urinating
> Vertically" section of the proxy documentation, right?
--
perl -e 'print `echo Just a Lame Perl Luser | gzip -9 | cat | gzip -cd`'
------------------------------
Date: 26 Sep 2000 10:00:45 GMT
From: bernard.el-hagin@lido-tech.net (Bernard El-Hagin)
Subject: Controlling line length read by <>
Message-Id: <slrn8t0suc.en.bernard.el-hagin@gdndev25.lido-tech>
Hi,
Is it possible to make the <> ignore lines which contain more than
an arbitrary amount of characters when reading a file (or any other
source of data)?
Regards,
Bernard
--
perl -le 'open JustAnotherPerlHacker,""or$_="B$!e$!r$!n$!a$!r$!d$!";
print split/No such file or directory/;'
------------------------------
Date: 26 Sep 2000 04:58:23 -0500
From: logan@cs.utexas.edu (Logan Shaw)
Subject: Re: deamonize
Message-Id: <8qprvv$6t9$1@provolone.cs.utexas.edu>
In article <8qp31u$7gr$1@nnrp1.deja.com>,
amonotod <amonotod@netscape.net> wrote:
>In article <8qop25$4rr$1@provolone.cs.utexas.edu>,
> logan@cs.utexas.edu (Logan Shaw) wrote:
>> In article <%syy5.245$hs2.11039@news.globetrotter.net>,
>> Neb <berube@odyssee.net> wrote:
>> >information about their OS version. How can I get it ?
>>
>> $q->pre (qx{uname -sr}),
>
>Wrong! Try this:
> $q->pre ( $^O ), # <--This is the Perl way
It also just prints "solaris" on my system, whereas the other prints
"SunOS 5.7". So the one has a version and the other doesn't.
Also, philosophically, all kinds of programs invent their own names for
operating system versions, and they're all different, and sometimes
they're wrong. (Solaris 2.8 or whatever, being one example.) For that
reason, I prefer to stick with the operating system version that the
operating system believes in.
- Logan
------------------------------
Date: Tue, 26 Sep 2000 04:55:11 GMT
From: cfedde@u.i.sl3d.com (Chris Fedde)
Subject: Re: determine where visitors are "living"
Message-Id: <P_Vz5.421$W3.190528512@news.frii.net>
In article <ssvp1osi2sj594@corp.supernews.com>,
Craig Berry <cberry@cinenet.net> wrote:
>Alan J. Flavell (flavell@mail.cern.ch) wrote:
>: On Mon, 25 Sep 2000, Craig Berry wrote:
>:
>: > This is extremely hard to do.
>:
>: No Sir. I am confident that on the basis of my headers (and lacking
>: any external evidence to the contrary), it is not just "extremely
>: hard", it is in fact impossible, for you to determine that I am right
>: now in the bedroom of my owner-occupied flat in Glasgow, Scotland.
>
>Right you are; I was speaking loosely. More to the point would be
>"impossible to do for all users, extremely hard to do correctly for most
>users, and impossible to distinguish the two cases or detect errors
>reliably."
>
Right you are. It is not possible to get a _useful_ geographic
location from an IP address without collusion on the part of the
address holder. This takes the problem out of the realm of technology
and into the realm of sociology. And that makes the problem hard
by definition.
Note: that by _useful_ I mean sellable.
chris
--
This space intentionally left blank
------------------------------
Date: Tue, 26 Sep 2000 06:18:34 -0000
From: cberry@cinenet.net (Craig Berry)
Subject: Re: determine where visitors are "living"
Message-Id: <st0ftq60s4r42f@corp.supernews.com>
Chris Fedde (cfedde@u.i.sl3d.com) wrote:
: Right you are. It is not possible to get a _useful_ geographic
: location from an IP address without collusion on the part of the
: address holder. This takes the problem out of the realm of technology
: and into the realm of sociology. And that makes the problem hard
: by definition.
:
: Note: that by _useful_ I mean sellable.
Well, I think your version overshoots the mark. Akamai has proved that a
system which has a high error rate but gives better-than-chance results on
average (admittedly in terms of network topology rather than geography,
but the two can be correlated) is sellable. If a good guess can often
help and a bad guess usually doesn't hurt (like Akamai's trick of routing
browsers to 'nearby' caching servers), this can pay off.
--
| Craig Berry - http://www.cinenet.net/~cberry/
--*-- "Quidquid latine dictum sit, altum viditur."
|
------------------------------
Date: Tue, 26 Sep 2000 06:32:51 GMT
From: nospam.newton@gmx.li (Philip 'Yes, that's my address' Newton)
Subject: Re: determine where visitors are "living"
Message-Id: <39d03ecf.6151615@news.tiscalinet.de>
On 25 Sep 2000 20:24:38 GMT, nospam@hairball.cup.hp.com (Richard J.
Rauenzahn) wrote:
> I've seen some sites try to determine if you're from the U.S. -- I
> think netscape.com used to attempt this to determine whether or not you
> were allowed to download the 128bit encryption version of netscape.
>
> I assumed they did this by querying the whois databases to see where
> (geographically) your hostname/domain was registered.
Of course, this is easily foiled by using a proxy that's in the US (a
co-worker of mine said he did this once, but I think it was for PGP).
("How come all AOL users live in Virginia?")
Cheers,
Philip
--
Philip Newton <nospam.newton@gmx.li>
If you're not part of the solution, you're part of the precipitate.
------------------------------
Date: Tue, 26 Sep 2000 09:58:22 +0100
From: "Graham Wood" <graham.wood@iona.com>
Subject: Re: determine where visitors are "living"
Message-Id: <8qpou1$2v6$1@bvweb.iona.com>
Why not ask them instead of deviously trying to guess? I can't see many
people objecting to selecting a country specific version of a web page. Get
them to click on the flag of their choice. That way you can even catch the
people who are on holiday somewhere else but are dying to know what's on
sale in the web shop back home.
Graham Wood
<kebr@my-deja.com> wrote in message news:8qnpql$l22$1@nnrp1.deja.com...
> Hello,
>
>
> Based on where my website visitors are coming from I would like to
> serve them another/a modified page. Now I hear you all say, use
> http_referrer and things like that, but this is not what I mean.
> I'm looking for a script that will determine the geographic location of
> a visitor.
> The ultimate goal would be to serve country/region specific pages based
> on the IP-address (?) or some other parameter. Is this at all possible
> or am I dreaming aloud ?
>
>
> I have looked at various code archives and searched the net but haven't
> as yet found something suitable.
> Any ideas for something along this line ?
>
>
> kind regards,
>
> Kenneth.
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: 26 Sep 2000 09:36:48 GMT
From: "Jonathan Klaff" <jon.klaff@rdel.co.uk>
Subject: Enviroment Interaction For A Newbie
Message-Id: <01c0279d$54bdd690$30b815ac@ntwc0585>
Hi,
I am trying to use an alias I have set up in my .cshrc file from a perl
script. Unfortunatly I have no idea how to do this!
Please help (even if it is to say that this is not possible).
Jon
------------------------------
Date: Mon, 25 Sep 2000 21:52:09 -0700
From: "Muriel Ross" <murielross@sprint.ca>
Subject: fax with Win32-Serialport
Message-Id: <WKVz5.3666$%S4.75093@newscontent-01.sprint.ca>
This is a multi-part message in MIME format.
------=_NextPart_000_0014_01C0273A.DA771E80
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
How can I fax a file to a fax machine using Win32-Serialport
finding the modem and dialing is easy now what does the script look =
like?
------=_NextPart_000_0014_01C0273A.DA771E80
Content-Type: text/html;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content=3D"text/html; charset=3Diso-8859-1" =
http-equiv=3DContent-Type>
<META content=3D"MSHTML 5.00.2314.1000" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>How can I fax a file to a fax machine using=20
Win32-Serialport</FONT></DIV>
<DIV><FONT size=3D2>finding the modem and dialing is easy now what does =
the script=20
look like?</FONT></DIV></BODY></HTML>
------=_NextPart_000_0014_01C0273A.DA771E80--
------------------------------
Date: Tue, 26 Sep 2000 09:11:27 +0100
From: Paul Spandler <p.m.spandler@bton.ac.uk>
Subject: freeware perl script to binary...
Message-Id: <39D05A2F.6703023C@bton.ac.uk>
Hi
I'm looking for a freeware unix perl to executable file converter.
I have found perl2exe (http://www.indigostar.com/perl2exe.htm,) and it's
very good, but I can't justify the cost to register it. It's shareware
and it echoes back a nag message when the binary is converted...
Thanks
Paul
--
mailto:p.m.spandler@bton.ac.uk
Systems Manager
IT Research Institute
Faculty of IT
University of Brighton
Telephone (01273) 642925
------------------------------
Date: 26 Sep 2000 08:53:41 GMT
From: abigail@foad.org (Abigail)
Subject: Re: freeware perl script to binary...
Message-Id: <slrn8t0ou9.lo9.abigail@alexandra.foad.org>
Paul Spandler (p.m.spandler@bton.ac.uk) wrote on MMDLXXXIII September
MCMXCIII in <URL:news:39D05A2F.6703023C@bton.ac.uk>:
==
== I'm looking for a freeware unix perl to executable file converter.
chmod, which can be found at: <ftp://ftp.gnu.org/gnu/fileutils/>, and
runs on more Unices than you can think of.
HTH. HAND.
Abigail
--
# Perl 5.6.0 broke this.
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
------------------------------
Date: Tue, 26 Sep 2000 10:24:19 +0100
From: Paul Spandler <p.m.spandler@bton.ac.uk>
Subject: Re: freeware perl script to binary...
Message-Id: <39D06B43.A22A74B7@bton.ac.uk>
Oops, sorry...maybe I should have explained myself better!
I want to convert perl scripts into binaries (basically to hide the
script source in a chrooted environment.)
Thanks
Paul
Abigail wrote:
>
> Paul Spandler (p.m.spandler@bton.ac.uk) wrote
> == I'm looking for a freeware unix perl to executable file converter.
>
> chmod, which can be found at: <ftp://ftp.gnu.org/gnu/fileutils/>, and
> runs on more Unices than you can think of.
--
mailto:p.m.spandler@bton.ac.uk
Systems Manager
IT Research Institute
Faculty of IT
University of Brighton
Telephone (01273) 642925
------------------------------
Date: Tue, 26 Sep 2000 09:54:24 GMT
From: rgarciasuarez@free.fr (Rafael Garcia-Suarez)
Subject: Re: freeware perl script to binary...
Message-Id: <slrn8t0suv.e53.rgarciasuarez@rafael.kazibao.net>
Paul Spandler wrote in comp.lang.perl.misc:
>
>I want to convert perl scripts into binaries (basically to hide the
>script source in a chrooted environment.)
perldoc -q source ==>
=head2 How can I hide the source for my Perl program?
[...]
If your program does insecure things, and relies on people not knowing
how to exploit those insecurities, it is not secure.
[...]
--
# Rafael Garcia-Suarez / http://rgarciasuarez.free.fr/
------------------------------
Date: Fri, 22 Sep 2000 12:23:46 -0400
From: jtjohnston <jtjohnston@courrier.usherb.ca>
Subject: Halloween Fun
Message-Id: <39CB8792.6C11@courrier.usherb.ca>
I need a date function based on my server's time/date.
I've fooled around with this and cannot put together what I want. If
someone could pass along a couple of lines of code, it would be much
appreciated. I don't seem to have enough to hack into?? Real newbie
question, but ... blah blah :)
Here's basically what I need to do:
if (($date eq "October 31 2000") && ($time >09:00 || <17:00))
{
&spookystory1;
}
elsif (($date eq "November 01 2000") && ($time >09:00 || <17:00))
{
&spookystory2;
}
elsif (($date eq "November 02 2000") && ($time >09:00 || <17:00))
{
&spookystory3;
}
else{
if ($date comes before "October 31 2000")
{
&display1;
}elseif{
if ($date comes after "November 02 2000")
{
&display2;
}else{
&display5;
#will display something between 5pm and 9am TIME OF MY SERVER
between the dates of October 31 and November 02
}
}
:) I'm an educational programmer.
An e-mail reply would be a real BIIIIIIIG help. I won't re-reply unless
you want me to.
Thanks
John
------------------------------
Date: Tue, 26 Sep 2000 05:19:02 GMT
From: mgjv@verbruggen.comdyn.com.au (Martien Verbruggen)
Subject: Re: Halloween Fun
Message-Id: <slrn8t0ce1.5er.mgjv@verbruggen.comdyn.com.au>
On Fri, 22 Sep 2000 12:23:46 -0400,
jtjohnston <jtjohnston@courrier.usherb.ca> wrote:
> I need a date function based on my server's time/date.
>
> I've fooled around with this and cannot put together what I want. If
> someone could pass along a couple of lines of code, it would be much
> appreciated. I don't seem to have enough to hack into?? Real newbie
> question, but ... blah blah :)
>
> Here's basically what I need to do:
>
> if (($date eq "October 31 2000") && ($time >09:00 || <17:00))
I think you meant ($time > 9:00 && $time < 17:00), right? The above is
always true.
You could consider getting the time() values for those particular
times, although that's a bit hard to read:
if ($time > 972943200 && $time < 972972000)
{
spooky_story_1();
}
Or you could explicitly get them with timelocal:
use Time::Local;
if ($time > timelocal( 0, 0, 9, 31, 9, 2000) &&
$time < timelocal( 0, 0, 17, 31, 9, 2000))
{
spooky_story_1();
}
Note the month number in the call to timelocal.
# perldoc Time::Local
> :) I'm an educational programmer.
>
> An e-mail reply would be a real BIIIIIIIG help. I won't re-reply unless
> you want me to.
Sorry, I don't do that. I expect people who ask questions to read the
group. You might learn something.
I try to be an educational poster.
Martien
--
Martien Verbruggen |
Interactive Media Division | Hi, John here, what's the root
Commercial Dynamics Pty. Ltd. | password?
NSW, Australia |
------------------------------
Date: Mon, 25 Sep 2000 22:31:34 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Halloween Fun
Message-Id: <39D034B6.41412047@stomp.stomp.tokyo>
jtjohnston wrote:
> I need a date function based on my server's time/date.
Have you tried localtime () function? Usually this
works well to pull your date/time stamp.
> I've fooled around with this and cannot put together what I want. If
> someone could pass along a couple of lines of code, it would be much
> appreciated. I don't seem to have enough to hack into?? Real newbie
> question, but ... blah blah :)
(snipped eye candy code)
Visually pretty code. Nice article and all.
However you forgot something of importance,
your question.
What is your question?
Godzilla!
--
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class
------------------------------
Date: 26 Sep 2000 07:13:19 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Halloween Fun
Message-Id: <slrn8t0j20.lo9.abigail@alexandra.foad.org>
Martien Verbruggen (mgjv@verbruggen.comdyn.com.au) wrote on MMDLXXXIII
September MCMXCIII in <URL:news:slrn8t0ce1.5er.mgjv@verbruggen.comdyn.com.au>:
** On Fri, 22 Sep 2000 12:23:46 -0400,
** jtjohnston <jtjohnston@courrier.usherb.ca> wrote:
** > I need a date function based on my server's time/date.
** >
** > I've fooled around with this and cannot put together what I want. If
** > someone could pass along a couple of lines of code, it would be much
** > appreciated. I don't seem to have enough to hack into?? Real newbie
** > question, but ... blah blah :)
** >
** > Here's basically what I need to do:
** >
** > if (($date eq "October 31 2000") && ($time >09:00 || <17:00))
**
** I think you meant ($time > 9:00 && $time < 17:00), right? The above is
** always true.
**
** You could consider getting the time() values for those particular
** times, although that's a bit hard to read:
**
** if ($time > 972943200 && $time < 972972000)
** {
** spooky_story_1();
** }
**
** Or you could explicitly get them with timelocal:
**
** use Time::Local;
**
** if ($time > timelocal( 0, 0, 9, 31, 9, 2000) &&
** $time < timelocal( 0, 0, 17, 31, 9, 2000))
** {
** spooky_story_1();
** }
Instead of having two inequalities per condition, I rather use one:
#!/opt/perl/bin/perl -w
use Time::Local;
use subs qw / display1 display2 display5
spookystory1 spookystory2 spookystory3/;
my @MORNING = ( 0, 0, 9); # 9:00
my @EVENING = ( 0, 0, 17); # 17:00
my @HALLOWEEN = (31, 9); # Oct 31
my @ALLSAINTS = ( 1, 10); # Nov 1
my @ALL_SOULS = ( 2, 10); # Nov 2
my $YEAR = (localtime) [5]; # This year.
my $HALLOWEEN_MORNING = timelocal (@MORNING, @HALLOWEEN, $YEAR);
my $HALLOWEEN_EVENING = timelocal (@EVENING, @HALLOWEEN, $YEAR);
my $ALLSAINTS_MORNING = timelocal (@MORNING, @ALLSAINTS, $YEAR);
my $ALLSAINTS_EVENING = timelocal (@EVENING, @ALLSAINTS, $YEAR);
my $ALL_SOULS_MORNING = timelocal (@MORNING, @ALL_SOULS, $YEAR);
my $ALL_SOULS_EVENING = timelocal (@EVENING, @ALL_SOULS, $YEAR);
my $now = time;
if ($now < $HALLOWEEN_MORNING) { display1}
elsif ($now < $HALLOWEEN_EVENING) {spookystory1}
elsif ($now < $ALLSAINTS_MORNING) { display5}
elsif ($now < $ALLSAINTS_EVENING) {spookystory2}
elsif ($now < $ALL_SOULS_MORNING) { display5}
elsif ($now < $ALL_SOULS_EVENING) {spookystory3}
else { display2}
__END__
But I'm unfamiliar with the practise of telling spooky stories after
Halloween. Isn't the Halloween period from labour day up till Oct 31,
and on Nov 1, as soon as the shops open, Thanksgiving starts?
Abigail
--
$"=$,;*{;qq{@{[(A..Z)[qq[0020191411140003]=~m[..]g]]}}}=*_=sub{print/::(.*)/};
$\=$/;q<Just another Perl Hacker>->();
------------------------------
Date: Mon, 25 Sep 2000 23:02:15 -0700
From: "Michael Cook" <mikecook@cigarpool.com>
Subject: Re: Massive kill Unix and Perl
Message-Id: <0_Wz5.697$7Q2.545989@news.uswest.net>
I think this is better handled with (gasp) shell - attached is a shell
script I wrote to kill any (or all) users on a box...
Michael
--
== CigarPool ==
http://www.cigarpool.com
"vivekvp" <vivekvp@spliced.com> wrote in message
news:8qn6f7$v1s$1@nnrp1.deja.com...
> Hello,
>
> I have a server - and users log in with a common user name.
>
> Sometimes I have to kill processes that are hogging to many resouces -
> I want to write a script that will do mulitple kills. I do not want to
> kill the users - just knock off the rogue process.
>
> Let say the user name is USER the proces need to be killed is TEST
>
>
> What I usually have to is do a ps -ef | grep TEST then do a kill on the
> process id of TEST:
>
>
> UID PID PPID C STIME TTY TIME COMMAND
> USER 0 0 0 Sep 23 ? 0:05 NEEDED
> USER 1 0 0 Sep 23 ? 0:03 TEST
> USER 2 0 0 Sep 23 ? 0:07 NEEDED
> USER 3 0 0 Sep 23 ? 3:10 TEST
> USER 4 0 0 Sep 23 ? 0:05 NEEDED
>
>
> So I would want to kill 1 and 3 - how would I write a Perl script to do
> this using Unix system commands?
>
> Thanks!
>
> V
> --
> He who fights and runs away, lives to run another day!
>
>
> Sent via Deja.com http://www.deja.com/
> Before you buy.
------------------------------
Date: Tue, 26 Sep 2000 16:11:15 +1000
From: Derek Thomson <derek@ooc.com.au>
Subject: Re: matching a date
Message-Id: <39D03E03.AC7DA890@ooc.com.au>
Hi Larry,
Larry Rosler wrote:
>
> In article <39CD6F43.87D2B2F6@ooc.com.au> on Sun, 24 Sep 2000 13:04:35
> +1000, Derek Thomson <derek@ooc.com.au> says...
> ...
> > use Time::Local;
> >
> > while(<>) {
> > while (/(\d+)-(\d+)-(\d+)/g) {
> > my ($yyyy, $mm, $dd) = ($1, $2, $3);
> >
> > eval { timelocal(0, 0, 0, $dd, $mm, $yyyy); };
> >
> > if (!$@) {
> > print "$yyyy-$mm-$dd is okay\n";
> > } else {
> > print "$yyyy-$mm-$dd is not a valid date: $@";
> > }
> > }
> > }
>
> Three things wrong here:
>
> 1. The month value should be reduced by 1 from the input value,
> in accordance with the conventions of localtime().
>
> 2. The day-of-month checking in timelocal is far too primitive:
>
> croak "Day '$_[3]' out of range 1..31" if $_[3] > 31 || $_[3] < 1;
I'm really reticent to say this, but isn't this wrong in the Perl
Cookbook? That's where I grabbed the basic code from. You're right,
though, looking at the Time::Local docs. I just trust Christiansen and
Torkington implicitly.
"Unexpected, this is" ;)
I suspect that the Cookbook example is incorrect WRT the year as well,
if the Time::Local doc is right (year is year-1900).
And if that's the code, day-of-month checking *is* too primitive in
timelocal. I did think it would be stricter.
So, what's the real answer? - I answered this because I wanted to figure
it out. Is Date::Manip stricter when parsing dates? I'll try it out when
I get a chance, anyway.
>
> 3. A bug in interior caching lets bogus dates through. Try the
> following values (month has been offset correctly), every one of
> which is accepted:
>
> 2000-00-31
> 2000-00-32
> 2000-01-29
> 2000-01-30
> 2000-01-31
> 2000-01-32
> 2000-01-1000
>
> This is an unreliable reed indeed!
OK, that does it. timelocal is no good for validation :(
Regards,
Derek.
------------------------------
Date: Tue, 26 Sep 2000 04:33:16 GMT
From: cfedde@u.i.sl3d.com (Chris Fedde)
Subject: Re: New to PERL
Message-Id: <gGVz5.419$W3.190528512@news.frii.net>
In article <slrn8t04a8.lo9.abigail@alexandra.foad.org>,
Abigail <abigail@foad.org> wrote:
>Bill Moseley (usenet@hank.org) wrote on MMDLXXXIII September MCMXCIII in
><URL:news:MPG.143991b531c5573098969b@news.newsguy.com>:
>::
>:: This one caught me the other day.
>:: package 'vars' not registered for warnings at Test123.pm line 7
>
>That's because it's a warning from a module, and not from the core
>language. Most warnings from modules aren't in perldiag, but it can
>be argued that they should be there.
>
That would seem to be a hard argument to make. Maybe warnings from
core modules and pragmas could be included in perldiag but wouldn't
it be hard to get arbitrary messages from the run of the mill CPAN
module into a static manual page? Maybe I'm reading too much into
your comments.
chris
--
This space intentionally left blank
------------------------------
Date: 26 Sep 2000 05:15:47 GMT
From: abigail@foad.org (Abigail)
Subject: Re: New to PERL
Message-Id: <slrn8t0c5m.lo9.abigail@alexandra.foad.org>
Chris Fedde (cfedde@u.i.sl3d.com) wrote on MMDLXXXIII September MCMXCIII
in <URL:news:gGVz5.419$W3.190528512@news.frii.net>:
__ In article <slrn8t04a8.lo9.abigail@alexandra.foad.org>,
__ Abigail <abigail@foad.org> wrote:
__ >Bill Moseley (usenet@hank.org) wrote on MMDLXXXIII September MCMXCIII in
__ ><URL:news:MPG.143991b531c5573098969b@news.newsguy.com>:
__ >::
__ >:: This one caught me the other day.
__ >:: package 'vars' not registered for warnings at Test123.pm line 7
__ >
__ >That's because it's a warning from a module, and not from the core
__ >language. Most warnings from modules aren't in perldiag, but it can
__ >be argued that they should be there.
__ >
__
__ That would seem to be a hard argument to make. Maybe warnings from
__ core modules and pragmas could be included in perldiag but wouldn't
__ it be hard to get arbitrary messages from the run of the mill CPAN
__ module into a static manual page? Maybe I'm reading too much into
__ your comments.
I wasn't talking about CPAN stuff. I was talking about everything
that comes with Perl. But then, there's so much junk in there, and not
everything is really under control of p5p.
Abigail
--
perl -MLWP::UserAgent -MHTML::TreeBuilder -MHTML::FormatText -wle'print +(
HTML::FormatText -> new -> format (HTML::TreeBuilder -> new -> parse (
LWP::UserAgent -> new -> request (HTTP::Request -> new ("GET",
"http://work.ucsd.edu:5141/cgi-bin/http_webster?isindex=perl")) -> content))
=~ /(.*\))[-\s]+Addition/s) [0]'
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4430
**************************************