[10440] in Perl-Users-Digest
Perl-Users Digest, Issue: 4033 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 21 13:03:29 1998
Date: Wed, 21 Oct 98 10:00:24 -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 Wed, 21 Oct 1998 Volume: 8 Number: 4033
Today's topics:
Re: Changing passwords with a perl scripts... <rootbeer@teleport.com>
Re: Displaying the Time (Jeffrey R. Drumm)
Re: Displaying the Time <gary.ennis@strath.ac.uk>
Re: Displaying the Time (Daniel Beckham)
Re: Equivalent of "unload" after "require"? (Andrew M. Langmead)
Finding Win32 Registry Values <Aaron.Moss@nsc.com>
Free Pizza for Win32 Tk::JPEG compiled AS or GSAR (Clinton Pierce)
From scalar to array to output?? <baughmankr@appstate.edu>
Has anyone experience of using News::NNTPClient? tmcguiga@my-dejanews.com
Re: how do you search subdirectories for a file? (Daniel Beckham)
Re: How to copy a 2-dimensional array to another array <Alex.Davies@tiuk.ti.com>
Re: LWP documentation (I R A Aggie)
MUST SEE TO BELIEVE!! (Smackerhrd)
Re: Net::Ping WON'T WORK!!!!! hippie@net-alert.com
Re: Perl & Y2K - booby trap code (Snowhare)
Re: Perl & Y2K - booby trap code <merlyn@stonehenge.com>
Re: Perl & Y2K - booby trap code (Snowhare)
Re: Perl & Y2K - booby trap code (Lack Mr G M)
Re: Perl & Y2K - booby trap code <murrayb@vansel.alcatel.com>
Re: Perl Cookbook - is this the best perl book? (PM Jenkins)
Re: PERL mailer program times out <murrayb@vansel.alcatel.com>
perl newbie trying to reference pseduoarray, better way <davem@skantech.net>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 21 Oct 1998 15:51:43 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Changing passwords with a perl scripts...
Message-Id: <Pine.GSO.4.02A.9810210841400.5534-100000@user2.teleport.com>
On 21 Oct 1998, ADAMS wrote:
> I have writtena perl script that changes users passwords when run as
> root, but now I would like to edit it to allow user nobody (and
> anybody else) to run it for use on changing passwords over the web.
Is it okay if I change your root password? :-)
> One problem is that when a user nobody 'su somebodu' and the 'passwd'
> runs passwd on user nobody, not somebodu.
That's not the way to do it. First, read up on the security issues
involved, then see the perlvar manpage to see how a set-id root program
can change its userid. Then, before you implement anything involving
having a program set-id to root running over the web, have your head
examined. Remember that, normally, the data being passed from a web
browser is in plaintext, so anyone who can sniff packets can see the
password. And many, many of the CERT advisories are about programs which
are set-id to root: Don't let yours be another of them.
Cheers!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Wed, 21 Oct 1998 15:39:08 GMT
From: drummj@mail.mmc.org (Jeffrey R. Drumm)
Subject: Re: Displaying the Time
Message-Id: <362dff09.425380965@news.mmc.org>
[ posted to comp.lang.perl.misc and a courtesy copy was mailed to the cited
author ]
On Wed, 21 Oct 1998 15:28:15 -0700, Gareth Ennis <gary.ennis@strath.ac.uk>
wrote:
>> print scalar localtime(time);
>>
>> will generate:
>> Wed Oct 21 07:34:01 1998
>>
>
>Perhaps something is set up wrong here... but the above does not
>generate anything at all????
Did you try your script at the command prompt? If this is CGI (and I suspect it
is, based on the mail you sent me), There's something missing from the HTML
you're wrapping arount the print statement.
--
Jeffrey R. Drumm, Systems Integration Specialist
Maine Medical Center - Medical Information Systems Group
drummj@mail.mmc.org
"Broken? Hell no! Uniquely implemented!" - me
------------------------------
Date: Wed, 21 Oct 1998 17:02:20 -0700
From: Gareth Ennis <gary.ennis@strath.ac.uk>
Subject: Re: Displaying the Time
Message-Id: <362E760C.167E@strath.ac.uk>
Gareth Ennis wrote:
>
> > print scalar localtime(time);
> >
> > will generate:
> > Wed Oct 21 07:34:01 1998
> >
>
> Perhaps something is set up wrong here... but the above does not
> generate anything at all????
Unfortunately - i have discovered that Perl 4 (which we still use here)
does not support localtime.
I did come up with a workaround which produces similar results and that
is to :
print | date
which produces the date as it does from the command prompt when you type
date.
--
Gareth Ennis
ABACUS - Strathclyde University
email: gary.ennis@strath.ac.uk
http://iris.abacus.strath.ac.uk/new/
------------------------------
Date: Wed, 21 Oct 1998 12:01:48 -0400
From: danbeck@eudoramail.com (Daniel Beckham)
Subject: Re: Displaying the Time
Message-Id: <MPG.1097cf75aa66baf8989698@news.supernews.com>
Look up the time(), localtime() and gmtime() functions in the perl docs.
They explain everything. But, just a quick note, time gives you the
number of seconds since epoch (c. 1970) and if you feed that number to
localtime, you get an array of time elements such as the hour, minute and
seconds, etc.
Read those docs, it's pretty simple to use.
In article <362E2EA2.41C6@strath.ac.uk>, gary.ennis@strath.ac.uk says...
> Easy......
>
> I want to simply display the time and date in a logical format -
> (something like - 12:34 Tuesday 23 Oct 1998)
>
> I tried using -
> print localtime (time);
>
> but it prints out a whole range of numbers like :
>
> 1357112199832931
>
>
> Please help.....
>
------------------------------
Date: Wed, 21 Oct 1998 15:01:13 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Equivalent of "unload" after "require"?
Message-Id: <F16n21.D8B@world.std.com>
wyndo@cxo.com writes:
>[grin] that's exactly what I'm doing. I put the code into a subroutine & call
>it when I need to run it. The problem is, I require the file.... I change the
>file....
If you are dynamically creating perl source code inside your program,
storing it in a file, and then calling "require" to load and compile
the code, why not just keep use "eval" to directly compile your
dynamic code into the currently running program?
undef &subname;
eval "sub subname {\n\t#contents of the subroutine here\n}\n";
would probably be close to what you are trying to do.
You might want to use anonymous code references though, if you have
done any work with, (or think that this might be a good time to learn
about) references.
$subref = eval "sub {#...\n}";
&$subref()
--
Andrew Langmead
------------------------------
Date: Wed, 21 Oct 1998 16:10:22 GMT
From: Aaron Moss <Aaron.Moss@nsc.com>
Subject: Finding Win32 Registry Values
Message-Id: <362E076E.BA249046@nsc.com>
I am trying to use perl to find the specfic value of certain keys in the
NT registry, if I use GetValues it returns a hash (too much data). I am
looking for a way to return the data from one value. Any ideas? I
tried NTRegQueryValueEx but it was not working right.
------------------------------
Date: 21 Oct 1998 14:50:28 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
Subject: Free Pizza for Win32 Tk::JPEG compiled AS or GSAR
Message-Id: <70ksbk$icp3@eccws1.dearborn.ford.com>
I give up. I've tried lying, stealing and cheating and I still
can't get Perl to compile (with Tk) under Win32 (specifically,
Windows 95).
I really don't want to invest in Win NT for a stable command
interpreter and the README.win32 says it's required for VC++, I just
don't have the hardware for NT. Win 95 won't run CygWin's bash in anything
that resembles "stable". (CygWin's bash is pure guano under 95.)
I won't buy a Microsoft product, and so I'm stuck with a borrowed,
antiquated VC++ compiler (4.0) that just isn't cutting it.
My customer requires a Win32 port, so the One True OS is out of
the question. *sigh*
So, I'm offering a free pizza to anyone, anywhere in the world who
can give me a compiled version of Tk::JPEG that's ready to drop into
one of the Win32 Perl ports. I'd prefer ActiveState since GSAR's
port is becoming a bit dated.
My work E-Mail will be disconnected in
a week or so, send inquiries to: fubar@ameritech.net
--
+------------------------------------------------------------------------+
| Clinton A. Pierce | "If you rush a Miracle Man, | http://www. |
| | you get rotten miracles" | dcicorp.com/ |
| fubar@ameritech.net |--Miracle Max, The Princess Bride| ~clintp |
+------------------------------------------------------------------------+
GCSd-s+:+a-C++UALIS++++P+++L++E---t++X+b+++DI++++G++e+>++h----r+++y+++>y*
------------------------------
Date: Wed, 21 Oct 1998 12:35:37 -0400
From: Kinney Baughman <baughmankr@appstate.edu>
Subject: From scalar to array to output??
Message-Id: <362E0D59.9CF05560@appstate.edu>
I'm hoping someone can give me a more elegant solution than the one I've
been able to concoct myself.
My problem.
I have phone numbers stored in a database in the form: 1234567890
I want to collect the value of a phone number and output it in the form
of: (123) 456-7890.
So far, here is what I have:
-----
$phone=8282977837;
@nph = split(//, $phone);
print "(@nph[0]@nph[1]@nph[2])
nph[3]@nph[4]@nph[5]\-@nph[6]@nph[7]@nph[8]@nph[9]\n";
-----
Surely there is a better solution than this.
I've tried, for example, to index the @aph array to pick out the area
code with:
$ac=@phone[0,1,2];
But when I print "$ac" I get zilch.
Thanks for any help.
Kinney Baughman
------------------------------
Date: Wed, 21 Oct 1998 16:36:39 GMT
From: tmcguiga@my-dejanews.com
Subject: Has anyone experience of using News::NNTPClient?
Message-Id: <70l2in$5cd$1@nnrp1.dejanews.com>
We need to see if a particular newsgroup exists, and have checked for it via
if( $MyClients->group($Name) ) {
# Exists.
} else {
# Non-existant.
}
But from the documentatiom to this module I'm told it is an error to attempt
to select a non-existent news group. Should I be using another method?
So how do I check for a group's existance? Getting a list of all newsgroups
whould such an overhead.
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Wed, 21 Oct 1998 11:19:06 -0400
From: danbeck@eudoramail.com (Daniel Beckham)
Subject: Re: how do you search subdirectories for a file?
Message-Id: <MPG.1097c579afea92fc989697@news.supernews.com>
Well, in a way, I was sort of dissapointed. I almost never have a reason
to write a recursive function and I was enjoying the challenge.
But, since I rewrote the entire script in less time than it took for me
to work out just the recursive function, I wasn't too dissapointed for
long.
After a simple test and one modification, it worked like a charm.
Regards,
Daniel Beckham
In article <362CFE3A.25B7ACAD@min.net>, jdporter@min.net says...
> Daniel Beckham wrote:
> >
> > Holy cow. I never new about File::Find. I'm sitting here writing a
> > recursive function to search html files for a string to replace and I
> > nearly finished it when I stumbled across this thread.
>
> This is often the thing that jolts a perl hacker's mentality from
> "I know I can write this" to "Better check the CPAN first".
>
> CPAN is our friend. (So is Deja News.)
>
>
------------------------------
Date: Wed, 21 Oct 1998 16:41:53 +0100
From: Alex Davies <Alex.Davies@tiuk.ti.com>
Subject: Re: How to copy a 2-dimensional array to another array
Message-Id: <362E00C1.B2B72348@tiuk.ti.com>
One way of copying 'simple' structures is to make use of the nifty
Data::Dumper package, and eval a dumped out structure:
use Data::Dumper;
my ($struct, $struct2);
$struct = {
'foo' => 'bar',
'goo' => [1, 2, 3, 4],
};
$struct2 = eval Data::Dumper->Dump([$struct], ['struct2']);
print "1:\n", Data::Dumper->Dump([$struct], ['struct']), "\n";
print "2:\n", Data::Dumper->Dump([$struct2], ['struct2']), "\n";
alex.
_________________________________________________________________________
Alex Davies, MOS Design, Email: Alex.Davies@tiuk.ti.com
Texas Instruments Limited,
800 Pavillion Drive, Tel (work): 01604 663450
Brackmills Industrial Estate, (home): 01604 764961
Northampton, NN4 7YL.
U.K.
Tien Pham wrote:
> Hello there,
>
> I have a (stupid) question regarding to copying an array
>
> to another (both are 2-dimensional).
>
> Can we do this: @A = @B;
>
> Or we have to copy element by element of B to A?
>
> Thank you very much in advance,
>
> tien pham
>
> tpham@ee.gatech.edu
>
> --
> Plan:
>
> To live
> To enjoy
> To appreciate
> every opportunity and every minute here, in America!
> --------------------------------------
------------------------------
Date: Wed, 21 Oct 1998 11:55:17 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: LWP documentation
Message-Id: <fl_aggie-2110981155170001@aggie.coaps.fsu.edu>
In article <70juf3$b8n@news.nl.compuware.com>,
koos_pol@nl.compuware.com.NO_JUNK_MAIL wrote:
+ On Tue, 20 Oct 1998 16:49:50 -0500, I R A Aggie <fl_aggie@thepentagon.com>
+ wrote:
+ | In article <slrn72podi.qt.root@ernie.sesamstraat>,
+ | kp@multiweb.nl.NO_JUNK_MAIL wrote:
+ |
+ | + Am I correct that URI::Escape is not mentioned anywhere in the LWP
+ | + docs?
+ |
+ | As far as I can tell, no.
+ That's the other way around, bro'. How do you know it exists if it
+ isn't mentioned in LWP?
Because URI::Escape was mentioned. When in doubt, try a
'(man|perldoc) Lib::Name' and see if something useful pops back.
James
------------------------------
Date: 21 Oct 1998 16:55:03 GMT
From: smackerhrd@aol.com (Smackerhrd)
Subject: MUST SEE TO BELIEVE!!
Message-Id: <19981021125503.25626.00002935@ng86.aol.com>
How to turn $6 into $6,000!
READING THIS COULD CHANGE YOUR LIFE!
"I found this on a bulletin board and decided to try it. A little while
back, I was browsing through newsgroups, just like you are now,and came
across an article similar to this that said you could make thousands of
dollars within weeks with only an initial investment of $6.00! So I
thought,
"Yeah right, this must be a scam", but like most of us, I was curious,
so I
kept reading. Anyway, it said that you send $1.00 to each of the 6 names
and
address stated in the article. You then place your own name and address
in
the bottom of the list at #6, and post the article in at least 200
newsgroups. (There are thousands) No catch, that was it.
So after thinking it over, and talking to a few people first, I thought
about trying it. I figured: "what have I got to lose except 6 stamps and
$6.00, right?" Then I invested the measly $6.00. Well GUESS WHAT!!...
within
7 days, I started getting money in the mail! I was shocked! I figured it
would end soon, but the money just kept coming in. In my first week, I
made
about $25.00. By the end of the second week I had made a total of over
$1,000.00! In the third week I had over $10,000.00 and it's still
growing.
This is now my fourth week and I have made a total of just over
$42,000.00
and it's still coming in rapidly. It's certainly worth $6.00, and 6
stamps,
I have spent more than that on the lottery!! Let me tell you how this
works
and most importantly, why it works....Also, make sure you print a copy
of
this article NOW, so you can get the information off of it as you need
it. I
promise you that if you follow the directions exactly, that you will
start
making more money than you thought possible by doing something so easy!
Suggestion: Read this entire message carefully! (print it out or
download
it.) Follow the simple directions and watch the money come in!
It's easy. It's legal. And, your investment is only $6.00 (Plus postage)
IMPORTANT: This is not a rip-off; it is not indecent; it is not illegal;
and
it is virtually no risk - it really works!!!!
If all of the following instructions are adhered to, you will receive
extraordinary dividends.
PLEASE NOTE:
Please follow these directions EXACTLY, and $50,000 or more can be yours
in
20 to 60 days. This program remains successful because of the honesty
and
integrity of the participants. Please continue its success by carefully
adhering to the instructions.
You will now become part of the Mail Order business. In this business
your
product is not solid and tangible, it's a service. You are in the
business
of developing Mailing Lists. Many large corporations are happy to pay
big
bucks for quality lists. However, the money made from the mailing lists
is
secondary to the income which is made from people like you and me asking
to
be included in that list.
Here are the 4 easy steps to success:
STEP 1: Get 6 separate pieces of paper and write the following on each
piece
of paper:
"PLEASE PUT ME ON YOUR MAILING LIST."
Now get 6 US $1.00 bills (or Canadan lun) and place ONE inside EACH of
the 6 pieces of paper
so the bill will not be seen through the envelope (to prevent thievery).
Next, place one paper in each of the 6 envelopes and seal them. You
should
now have 6 sealed envelopes, each with a piece of
paper stating the above phrase, your name and address, and a $1.00 bill.
What you are doing is creating a service. THIS IS ABSOLUTELY LEGAL! You
are
requesting a legitimate service and
you are paying for it! Like most of us I was a little skeptical and a
little
worried about the legal aspects of it all. So I checked it out with the
U.S.
Post Office (1-800-725-2161) and they confirmed that it is indeed legal!
Mail the 6 envelopes to the following addresses
#1)JK Longing
PO Box 5000
Suite 27 Oroville Wash
98844
#2) Chd Dave
Keremeos B.C Canada
R.R.1 S-40 C-6
V0X 1N0
#3) Wendy Le
10242, Beardon Dr #1,
Cupertino, CA, 95014.
#4) Raymond Garrett
Rt 1 Box 189
Wing AL, 36483
#5)Walt Molnar
13 St Raymond
St Peters MO. 63376
#6) Matt Asaro
2013 Appaloosa Dr.
Petaluma, Ca, 94954
STEP 2: Now take the #1 name off the list that you see above, move the
other
names up (6 becomes 5, 5 becomes 4, etc...) and add YOUR Name as number
6 on
the list.
STEP 3: Change anything you need to, but try to keep this article as
close
to original as possible. Now, post your amended article to at least 200
newsgroups. (I think there are close to 24,000 groups) All you need is
200,
but remember, the more you post, the more money you make!
This is perfectly legal! If you have any doubts, refer to Title 18 Sec.
1302
& 1341 of the Postal lottery laws. Keep a copy of these steps for
yourself
and, whenever you need money, you can use it again, and again.
PLEASE REMEMBER that this program remains successful because of the
honesty
and integrity of the participants and by their carefully adhering to the
directions. Look at it this way. If
you are of integrity, the program will continue and the money that so
many
others have received will come your way.
NOTE: You may want to retain every name and address sent to you, either
on a
computer or hard copy and keep the notes people send you. This VERIFIES
that
you are truly providing a service. (Also, it might be a good idea to
wrap
the $1 bill in dark paper to reduce the risk
of mail theft.)
So, as each post is downloaded and the directions carefully followed,
six
members will be reimbursed for their participation as a List Developer
with
one dollar each. Your name will move up the list geometrically so that
when
your name reaches the #1 position you will
be receiving thousands of dollars in CASH!!! What an opportunity for
only
$6.00 ($1.00 for each of the first six people listed above) Send it now,
add
your own name to the list and you're in business!
-----DIRECTIONS ----- FOR HOW TO POST TO NEWSGROUPS------------
Step 1) You do not need to re-type this entire letter to do your own
posting. Simply put your cursor at the beginning of this letter and drag
you
r cursor to the bottom of this document, and select 'copy' from the edit
menu. This will copy the entire letter
into the computer's memory.
Step 2) Open a blank 'notepad' file and place your cursor at the top of
the
blank page. From the 'edit' menu select 'paste'. This will paste a copy
of
the letter into notepad so that you can add your name to the list.
Step 3) Save your new notepad file as a .txt file. If you want to do
your
postings in different settings, you'll always have this file to go back
to.
Step 4) Use Netscape or Internet explorer and try searching for various
newsgroups (on-line forums, message boards, chat sites, discussions.)
Step 5) Visit these message boards and post this article as a new
message by
highlighting the text of this letter and selecting paste from the edit
menu.
Fill in the Subject, this will be the header that everyone sees as they
scroll through the list of postings in a
particular group, click the post message button. You're done with
your first one!
Congratulations...THAT'S IT! All you have to do is jump to different
newsgroups and post away, after you get the hang of it, it will take
about
30 seconds for each newsgroup!
**REMEMBER, THE MORE NEWSGROUPS YOU POST IN, THE MORE MONEY YOU WILL
MAKE!!
BUT YOU HAVE TO POST A MINIMUM OF 200** That's it! You will begin
receiving
money from around the world within days! You may eventually want to
rent a
P.O.Box due to the large amount of mail you
will receive. If you wish to stay anonymous, you can invent a name to
use,
as long as
the postman will deliver it. **JUST MAKE SURE ALL THE ADDRESSES ARE
CORRECT.**
Now the WHY part:
Out of 200 postings, say I receive only 5 replies (a very low example).
So
then I made $5.00 with my name at #6 on the letter. Now, each of the 5
persons who just sent me $1.00 make the
MINIMUM 200 postings, each with my name at #5 and only 5 persons respond
to
each of the original 5, that is another $25.00 for me, now those 25 each
make 200 MINIMUM posts with my name at #4 and only 5 replies each, I
will
bring in an additional $125.00! Now, those 125
persons turn around and post the MINIMUM 200 with my name at #3 and only
receive 5 replies each, I will make an additional $626.00! OK, now here
is
the fun part, each of those 625 persons post a MINIMUM 200 letters with
my
name at #2 and they each only receive 5 replies,
that just made me $3,125.00!!!
Those 3,125 persons will all deliver this message to 200 newsgroups with
my
name at #1 and if still 5 persons per 200 newsgroups react I will
receive
$15,625,00! With an original investment of only $6.00! AMAZING! When
your
name is no longer on the list, you just take the latest posting in the
newsgroups, and send out another $6.00 to names on the list, putting
your
name at number 6 again. And start posting again. The thing to remember
is:
do you realize that thousands of people all over the world are joining
the
internet and reading these articles everyday?, JUST LIKE YOU are now!!
So, can you afford $6.00 and see if it really works?? I think so...
People
have said, "what if the plan is played out and no one sends you the
money?
So what! What are the chances of that happening when there are tons of
new
honest users and new honest people who are joining the internet and
newsgroups everyday and are willing to give it a try? Estimates are at
20,000 to 50,000 new users, every day, with thousands of those joining
the
actual internet.
Remember, play FAIRLY and HONESTLY and this will really work."
Give it a try. If you want add your e-mail address will the dollar
bill and I will add you to my e-mail data base.
Good luck!!!
------------------------------
Date: Wed, 21 Oct 1998 15:09:28 GMT
From: hippie@net-alert.com
Subject: Re: Net::Ping WON'T WORK!!!!!
Message-Id: <70ktf6$ub3$1@nnrp1.dejanews.com>
In article <705hjp$rq5@news-central.tiac.net>,
mike@mike.stok.co.uk (Mike Stok) wrote:
> In article <705e3h$d9q$1@nnrp1.dejanews.com>, <engen@ix.netcom.com> wrote:
> >I am having a similar problem with the Net::Ping module. I am using version
> >5.004_04 on a Linux system. It does not work when trying to ping Linux or
> >Windows systems from a Linux machine. It does work, however, when pinging
> >Solaris X86 and HP/UX machines. Very strang indeed. I tried various timeouts
> >without success. All of these machines are actually up and pingable from the
> >command line. Any help would be greatly appreciated.
>
> pingecho uses tcp rather than icmp, so you're relying on a different
> mechanism. To see if the machineis responding on the tcp echo port you
I, too, am having this problem, but using UDP and ICMP. In this example I'm
using UDP (as it's the default, according to Perldoc Net::Ping):
# perl -MNet::Ping -e '$p = Net::Ping->new(); print $p->ping("12.13.137.66");'
I get this:
Bad arg length for Socket::unpack_sockaddr_in, length is 0, should be 16 at
/usr/lib/perl5/i486-linux/5.00404/Socket.pm line 249
The only times it actually works (returns a 1 or 0) is when the IP address is
my own or the loopback (returns 1) or the machine is actually or imaginarily
down (returns 0). For instance, most legitimate live (command-line ping works
fine) machines return the error message above, but some simply return 0.
(Test running as root, on Linux 2.0.35, Perl 5.004_04.)
--
Jim Davis
http://www.net-alert.com/hippie/
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 21 Oct 1998 09:26:25 -0600
From: snowhare@xmission.xmission.com (Snowhare)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <70kuf1$bnj$1@xmission.xmission.com>
Nothing above this line is part of the signed message.
In article <70ktgf$8rf$1@xmission.xmission.com>,
Snowhare <snowhare@xmission.xmission.com> wrote:
>
>Did I forget to mention that in this language localtime returns 'year -
>1900' for years < 2000 and 'year+10000' for dates >= 2000?
^^^^^
Sorry about that. Typo.
Benjamin Franz
Version: 2.6.2
iQCVAwUBNi39GujpikN3V52xAQFrHwQAmCXAJTyBC7SgIGZGYkZJAXonshUI6/IR
/KydxiiTjju4Jl/44oMD1wVU/XQ5N0wNKAUJ3jVtM6ttp1Up2QOvTZ8J9xF6jPdS
1wEdrb0x3zN9NHJd7Bz8leLksYusArhYqfAAIMK7z3JitCf0+VvYd3eIZ8NM41k3
ug4nvFeBrRg=
=KfcH
-----END PGP SIGNATURE-----
------------------------------
Date: Wed, 21 Oct 1998 15:28:19 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <8cogr6rl2p.fsf@gadget.cscaper.com>
>>>>> "Snowhare" == Snowhare <snowhare@xmission.xmission.com> writes:
Snowhare> *ANY* system that does not use at least 4 digit years for
Snowhare> *ALL* dates is Y2K booby trapped. This includes Perl (which
Snowhare> inherited the booby trap from C).
You undermine your argument by including this incorrect statement.
There's nothing that says that a program that doesn't print (or
interpret) a four digit year is not Y2K safe.
A date is relative. If you were standing next to me, and I said "go
to 123 main street", or "call 555-2345", you'd *know* I was talking
about this town that we were both in. You wouldn't ask me "what city"
(unless you were a computer programmer or a jerk :).
In the same way, it'll make perfect sense past the millennium (or even
now) to talk about years like 11/22/03 (to mean my birthday in the
year 2003) and 11/22/98 (to mean my birthday this year).
The problem is one of identifying the correct *neighborhood* for
the date interpretation.
So, demanding that all years be treated with 4 digits, either
externally or internally, is only ONE style of solution. There are
others. Open your mind to the options.
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 21 Oct 1998 09:10:07 -0600
From: snowhare@xmission.xmission.com (Snowhare)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <70ktgf$8rf$1@xmission.xmission.com>
Nothing above this line is part of the signed message.
In article <70kngo$aic$1@pilot.njin.net>,
David Alan Black <dblack@pilot.njin.net> wrote:
>You know, they say that capital letters mean you're shouting. Well, in
>eight+ years of Usenet participation I've never done it. However....
>
>
>WE KNOW ABOUT THIS. IT'S BEEN TALKED ABOUT A MILLION TIMES. THERE
>IS NO "BOOBY TRAP" IN PERL. THERE IS NO SECRET. IF YOU CAN'T ADD 1900
>TO A NUMBER THEN UNPLUG YOUR COMPUTER AND DO SOMETHING ELSE WITH
>YOUR TIME.
Let me put it bluntly - YOU'RE WRONG.
Here is a code fragment in a language I just made up on the spot (although
it should look very familiar ;) ):
(year,month,day,hour,minute,second) = localtime (time);
if (year < 40) { year = year + 2000; }
if (year < 1900) { year = year + 1900; }
Look safe to you? If they are returning '%100' - it works through 2039
(assumming your system doesn't suffer from the Y2038 bug). If they are
returning '-1900' it works for any date after 1900. If they are returning
'%100' for dates before 2000 and 4 digits for dates after that date it
works perfectly for dates after 1900 as well. You're covered, right?
Did I forget to mention that in this language localtime returns 'year -
1900' for years < 2000 and 'year' for dates >= 2000? Sorry about that. But
you can find it clearly stated in the .lha compressed Amiga word processor
document describing my language available from the Huntsville, Alabama
Chamber of Tourism for 60 US dollars payable only by US cash or a check
drawn on a local bank. Sorry if that doesn't happen to be an easily
available reference source _for you_. That's your problem: If you can't
subtract 10000 from a number, unplug your computer.
The Pink Camel contained that _kind_ of 'booby trap' by its failure to
state what is returned for the year field from localtime clearly. So
people tried it, and got something that _looks_ like '%100'. And there
*IS* Perl code out there that *IS* going to break because of it. *YOU*
won't be caught by it because you -already know- that Perl returns '-1900'
instead of '%100'. Many programs written by people with Pink Camels (some
with _no_ Camels) will be caught.
I would even argue that the use of '-1900' is _inherently_ booby trapped
that way. It was a way of _pretending_ to deal with Y2K while actually
avoiding corrective action. It allowed people to pretend that their using
2 digit years was somehow 'ok'. Instead - it added _even more problems_.
Now people have to worry about whether a date is '%100','-1900','%100
until 1999, 4 digit thereafter','-1900 from 1970 to 1999, -2000 after
2000' or any of a dozen other bad hacks designed to simply NOT do the
right thing by using 4 digits dates _ALL_ the time.
*ANY* system that does not use at least 4 digit years for *ALL* dates is
Y2K booby trapped. This includes Perl (which inherited the booby trap
from C).
Benjamin Franz
Version: 2.6.2
iQCVAwUBNi35PejpikN3V52xAQF+bAQAvgd7wE7mSvk8zyAMdC6bV6qunVwKADn4
jo6k/64kek1OkVZRJJq67XZnXPFi7mhvfSgDck3ZvoZZFQj7w73hv/vz5inXXQM/
LMqzPSEBjmJteJY0ZH0WM5Qqzo8WbnLkLpAAFpscGTHDsCzhS0D2vpQ7eLuZ1fFv
ECtqQMAJmyI=
=DG8g
-----END PGP SIGNATURE-----
------------------------------
Date: Wed, 21 Oct 1998 16:43:04 BST
From: gml4410@ggr.co.uk (Lack Mr G M)
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <1998Oct21.164304@ukwit01>
In article <70ktgf$8rf$1@xmission.xmission.com>, snowhare@xmission.xmission.com (Snowhare) writes:
|>
|> Now people have to worry about whether a date is '%100','-1900','%100
|> until 1999, 4 digit thereafter','-1900 from 1970 to 1999, -2000 after
|> 2000' or any of a dozen other bad hacks designed to simply NOT do the
|> right thing by using 4 digits dates _ALL_ the time.
No they don't. They have to read their documentation.
Even if it returned 1998 at the moment, people would still have to
know that it returned 1998.
|> *ANY* system that does not use at least 4 digit years for *ALL* dates is
|> Y2K booby trapped. This includes Perl (which inherited the booby trap
|> from C).
*ANY* use who uses an interface, doesn't bother to read how it works
but just *expects* it to do what they want anyway, *IS* a booby.
----------- Gordon Lack ----------------- gml4410@ggr.co.uk ------------
The contents of this message *may* reflect my personal opinion. They are
*not* intended to reflect those of my employer, or anyone else.
------------------------------
Date: 21 Oct 1998 08:50:50 -0700
From: Brad Murray <murrayb@vansel.alcatel.com>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <ur9w1ud5x.fsf@vansel.alcatel.com>
snowhare@xmission.xmission.com (Snowhare) writes:
> *ANY* system that does not use at least 4 digit years for *ALL* dates is
> Y2K booby trapped. This includes Perl (which inherited the booby trap
> from C).
It would be as sane to argue that a function that returned year as number
of seconds from the beginning of year 1 is not Y2K compliant because if
you just print the year you don't get 2001, but rather some huge integer.
It's awkward, but the year is still correctly contained in the output.
If you don't understand how to cope with offsets, you should not be
programming. If you can't read the documentation for your language
you cannot blame the language when you fail. 4 digit years will fail in
the year 10000. Big deal. Year as an integer from some arbitrary
starting point is not a buggy way to cope with years. It does demand
that you have rudimentary programming and reading skills, which
seems too demanding for many.
--
Brad Murray "The fall of modern man will be preceded by the
Software Analyst de-evolution of communications to the days of
Alcatel Canada oral tradition." --Tom Christiansen paraphrased
------------------------------
Date: Wed, 21 Oct 1998 16:15:24 GMT
From: pmj@hotmail.com (PM Jenkins)
Subject: Re: Perl Cookbook - is this the best perl book?
Message-Id: <70l16n$204@ohnasn01.houston.omnes.net>
In article <70foh8$c13$1@nnrp1.dejanews.com>, paulwade@my-dejanews.com wrote:
>In article <6vv8h6$799$1@nnrp1.dejanews.com>,
> lqyrms@nottingham.ac.uk wrote:
>> Could anybody who has read the Perl Cookbook please tell me if this is the
>> best perl book to get. There are a couple of reviews of this book at amazon
>> http://www.amazon.com/exec/obidos/ASIN/1565922433/bibs/ , but I would
>> appreciate the views of the experts in this newsgroup too.
>>
>
>Depends what you mean by 'best' and for what purpose. However, it is an
>excellent book.
I suggest that people buy this book when the next
release comes out. There are SO MANY typos/bugs/... in this book
(757 of them). Probably you don't want to hand-fix them by marking
over 757 spots. Nor do you want to attach/insert 27 pages of bug listing
in the book. My guess is that after authors typed in, they never looked it
back until the book printed out. Authors argue that 757 bugs are very
small comparing the size (less than 1 bugs / page !). Gees what an
attitude !! I think that they owe an apology to the buyers for publishing
such a screwed-up error-ridden version.
One question that I had was, how come authors ended up typing
variables in all CAPS ? Are they MS-DOS or VMS users ?
PM Jenkins
------------------------------
Date: 21 Oct 1998 07:57:22 -0700
From: Brad Murray <murrayb@vansel.alcatel.com>
Subject: Re: PERL mailer program times out
Message-Id: <u90ia0xpp.fsf@vansel.alcatel.com>
Atul Hajela <atulh@kepler.emi.net> writes:
> I have the PERL/CGI script which send out mass email to my clients. The
> problem is that the browser times out before the job finishes if the number
> of email addresses are about 2000. As a result the CGI/PERL script is
> terminated on the server and the emails are not sent to all the addresses
> in the list. Is there any way to keep the browser from timing out and
> hence keep the CGI script going until all the emails are sent ?
Have your CGI start a background task that does the mailing. This has the
advantage of returning control to the user immediately, without actually
having to wait for any of the mail processing to complete.
--
Brad J. Murray
Software Analyst "Cogito ergo am."
Alcatel Canada (DRH)
------------------------------
Date: Wed, 21 Oct 1998 11:32:53 -0400
From: "David Mears" <davem@skantech.net>
Subject: perl newbie trying to reference pseduoarray, better way to do this?
Message-Id: <362dfedd.0@news.Skantech.com>
I have code that goes:
for ($x = 1; $x le 99; $x++)
{
$tQtyRef = "L $x Qty"; $tQtyRef =~ s/\s+?//g;
$tDescRef = "L $x Desc"; $tDescRef =~ s/\s+?//g;
$tPriceRef = "L $x Price"; $tPriceRef =~ s/\s+?//g;
..
print $FORM{$tQtyRef},"\n";
...
}
which works, abet a bit ineffeciently, converting L 1 Qty to L1Qty
is there a faster way to do this?
print $FORM{'L' + $x + 'Desc'} tries to print $FORM{'1'} and so forth,
which isn't what I want. the form that feeds this script should have an
ordered list as output. I could pass the number of items as a hidden
varable, but that brings me to my second question..
for ($x = 1; $x le 20; $x++)
{
...
}
seams to want to drop out when it gets to past 2.. (3rd item won't print) -
the reason why isn't obvious, though I saw an earlier message where a
varable was apparently declared an integer and I think that will probably
solve this little problem. Generally languages would presume the $x when
assigned to unquoted number.. this is more of a neusence than a problem, in
pascal or c I couldn't get away with creating a varable that is undeclared.
;)
any help or direction would be appreciated.
David Mears daveREMOVETHISm@skantech.net - Webmaster
------------------------------
Date: 12 Jul 98 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Special: Digest Administrivia (Last modified: 12 Mar 98)
Message-Id: <null>
Administrivia:
Special notice: in a few days, the new group comp.lang.perl.moderated
should be formed. I would rather not support two different groups, and I
know of no other plans to create a digested moderated group. This leaves
me with two options: 1) keep on with this group 2) change to the
moderated one.
If you have opinions on this, send them to
perl-users-request@ruby.oce.orst.edu.
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 4033
**************************************