[10490] in Perl-Users-Digest
Perl-Users Digest, Issue: 4082 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Oct 27 13:05:47 1998
Date: Tue, 27 Oct 98 10:00:22 -0800
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, 27 Oct 1998 Volume: 8 Number: 4082
Today's topics:
ActiveState Perl: problem with PerlPacketManager: ppm.p <rkoch@sbs.de>
Re: Array to Hash Keys <jdporter@min.net>
Re: Array to Hash Keys <uri@fastengines.com>
Re: CGI database (brian d foy)
Re: Date compare routine dzuy@my-dejanews.com
Re: Dynamic Function Calls???? <jdporter@min.net>
Re: Dynamic Function Calls???? (Brand Hilton)
Re: Email address Checker (brian d foy)
LWP::UserAgent, how to get headers? (Clinton Pierce)
Math::BigFloat - initializing value <anders.rawlins@comdev.ca>
Re: Not to start a language war but.. <jdporter@min.net>
Re: Not to start a language war but.. <jdporter@min.net>
Re: Not to start a language war but.. <jdporter@min.net>
Re: Not to start a language war but.. <jdporter@min.net>
Re: Not to start a language war but.. <murrayb@vansel.alcatel.com>
Re: Not to start a language war but.. (Dennis Lee Bieber)
Re: Not to start a language war but.. (Abigail)
Re: Opendir and Readdir not working as expected (I.J. Garlick)
Re: Passing args from one perl script to another using (Brand Hilton)
Re: Perl & Y2K - booby trap code <jdporter@min.net>
Re: Perl & Y2K - booby trap code dave@mag-sol.com
Perl / DNS Module <Bachand@tamu.edu>
psychology of language choice (was Re: language war ... <uri@fastengines.com>
require help on require (Maelstrom)
socket connection via udp <jschubert@syskonnect.de>
Re: sockets (Brand Hilton)
sorting a hash by values (sorry if this is a stupid que <elmo@innocent.com>
Re: sorting a hash by values (sorry if this is a stupid <uri@fastengines.com>
Re: Web Client Automation (brian d foy)
Re: What isn't Perl good for? droby@copyright.com
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 27 Oct 1998 17:45:29 +0100
From: rk <rkoch@sbs.de>
Subject: ActiveState Perl: problem with PerlPacketManager: ppm.pl (proxy/internet)
Message-Id: <3635F8A9.66AD3C6C@sbs.de>
I need to install the tk package for Active State Perl.
Has anybody an idea, how this could work (or where else I could download
the packages) ???
Documentation:
Q:\perl\5.00502\bin>echo %HTTP_proxy%
proxy.fth.sbs.de <=
same proxy as defined in netscape navigator (Internet access via Proxy)
Q:\perl\5.00502\bin>perl ppm.pl
PPM interactive shell (0.9.1) - type 'help' for available commands.
PPM> set
Commands will be confirmed.
Temporary files will be deleted.
Case-sensitive searches will be performed.
Package installations will continue if a dependency cannot be installed.
Screens will not pause.
Current PPD repository paths:
ActiveState Package Repository:
http://www.ActiveState.com/packages
Packages will be installed under: q:\perl\5.00502
Packages will be built under: C:\TEMP
PPM> search
Packages available from http://www.ActiveState.com/packages:
<== No packages / no error displayed
PPM>
So, how can I get the packages?
R|diger Koch
===================
SBS Account KSB
J-Kleinstr. 9
67227 Frankenthal
Tel.: 06233/86-3978
Fax.: 06233/86-3931
email: mailto:rkoch@sbs.de
===================
------------------------------
Date: Tue, 27 Oct 1998 11:29:23 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Array to Hash Keys
Message-Id: <3635F4E3.D9E60188@min.net>
Larry Rosler wrote:
>
> Tk Soh <r28629@email.sps.mot.com> says...
> > grep {$hash_table{$_} = 0} <IN>;
>
> Absolutely not. The purpose of 'grep' (or 'map', which would make more
> sense in this context) is to create a new list from its list operand.
> To do that and throw the new list away makes little sense, esthetically
> or in terms of efficiency.
By that token, grep would be preferable to map in this case, since
the grep here would build an empty list. You could get the same effect
with map, but then you'd have to do the "grep implemented by map" thing:
map { $hash_table{$_} = 0; () } <IN>;
--
John "Throbblefoot" Porter
Please Don't "Courtesy CC" me.
I read this newsgroup fanatically. You know that!
("Emailed only" is fine, though.)
"The people at the Grey Hotel
Are either aged or unwell." -- EG
------------------------------
Date: 27 Oct 1998 11:48:07 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: Array to Hash Keys
Message-Id: <sar1znukl2v.fsf@camel.fastserv.com>
>>>>> "JP" == John Porter <jdporter@min.net> writes:
JP> Larry Rosler wrote:
>> Tk Soh <r28629@email.sps.mot.com> says... > grep {$hash_table{$_}
>> = 0} <IN>;
>>
>> Absolutely not. The purpose of 'grep' (or 'map', which would make
>> more sense in this context) is to create a new list from its list
>> operand. To do that and throw the new list away makes little
>> sense, esthetically or in terms of efficiency.
JP> By that token, grep would be preferable to map in this case, since
JP> the grep here would build an empty list. You could get the same
JP> effect with map, but then you'd have to do the "grep implemented
JP> by map" thing:
JP> map { $hash_table{$_} = 0; () } <IN>;
this still is map in a void context. you just return a null list.
why not do this:
%hash_table = map { $_, 0 } <IN> ;
internal loops and very clear what is going on.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Tue, 27 Oct 1998 13:06:03 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: CGI database
Message-Id: <comdog-ya02408000R2710981306030001@news.panix.com>
In article <3635CA56.750E@yahoo.com>, William <msl1997@yahoo.com> posted:
> How can I write a CGI database? Which language can I use?(Perl, C++,
> Visual Basic,etc.)
use any language that you like, although your options are most likely
limited by your choice of database product.
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 27 Oct 1998 15:48:48 GMT
From: dzuy@my-dejanews.com
Subject: Re: Date compare routine
Message-Id: <714q11$mcc$1@nnrp1.dejanews.com>
In article <36349097.5810BACC@counter.w-dt.com>,
Mike <support@counter.w-dt.com> wrote:
> I don't want some big long module, I just want to know a short snipplet that
will
> tell me if one date is after another.
>
I just wrote a script that compares date in yy/mm/dd format. It checks
whether the date passed in is earlier than 98/10/24. You can reverse it for
later date.
#!/usr/local/bin/perl
$fryr = 98;
$frmo = 10;
$frdate = 24;
print "Cutoff date is $fryr/$frmo/$frdate.\n";
date_compare("$ARGV[0]");
sub date_compare {
my ($yr, $mo, $date) = "@_" =~ m|(\d\d)/(\d\d)/(\d\d)|;
if ($yr < $fryr) {
print "Year is earlier.\n";
} elsif ($yr == $fryr) {
print "Same year, check month.\n";
if ($mo < $frmo) {
print "Month is ealier.\n";
} elsif ($mo == $frmo) {
print "Same year and month, check date.\n";
if ($date <= $frdate) {
print "Date is same or ealier.\n";
} else {
print "Date is older.\n";
return;
}
} else {
print "Same year, but month is older.\n";
}
} else {
print "Year is older.\n";
}
}
#!/usr/local/bin/perl
$fryr = 98;
$frmo = 10;
$frdate = 24;
print "Cutoff date is $fryr/$frmo/$frdate.\n";
date_compare("$ARGV[0]");
sub date_compare {
my ($yr, $mo, $date) = "@_" =~ m|(\d\d)/(\d\d)/(\d\d)|;
if ($yr < $fryr) {
print "Year is earlier.\n";
} elsif ($yr == $fryr) {
print "Same year, check month.\n";
if ($mo < $frmo) {
print "Month is ealier.\n";
} elsif ($mo == $frmo) {
print "Same year and month, check date.\n";
if ($date <= $frdate) {
print "Date is same or ealier.\n";
} else {
print "Date is older.\n";
return;
}
} else {
print "Same year, but month is older.\n";
}
} else {
print "Year is older.\n";
}
}
Hope this helps.
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 27 Oct 1998 11:37:40 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Dynamic Function Calls????
Message-Id: <3635F6D4.9651B150@min.net>
karl.dyson@in-linea.com wrote:
>
> Except, writing a programming language is beyond my ability right now.
> Then I thought - why can't I use Perl?
>
> Is is not possible to have a Perl file for each location, with a load of
> functions that can be called when certain things happen? Erm.. can I have a
> variable/pointer that can be loaded with a function name dynamically and then
> executed. So in one loop it might be loaded with "North32()" but on the second
> "North50()"???
Not to worry.
If you have a string that contains some perl code -- even just a simple
function call, like "North32()" -- then you can cause it to be executed
by passing the string to the eval() function. E.g.
$s = "North32()"; # gotten from file, maybe
eval( $s ); # causes a call to North32(), just like you wanted
Hope this helps.
John Porter
Please Don't "Courtesy CC" me.
I read this newsgroup fanatically. You know that!
("Emailed only" is fine, though.)
------------------------------
Date: 27 Oct 1998 16:53:17 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: Dynamic Function Calls????
Message-Id: <714tpt$9qv4@mercury.adc.com>
[ Posted and mailed }
In article <714g1k$8j4$1@nnrp1.dejanews.com>,
<mordred00@my-dejanews.com> wrote:
> [snip]
>something occured to me. Why can't I use Perl? If each room had an associated
>Perl file containing functions, conditional statements etc. etc. and these
>functions could be run dynamically (e.g. if the room contains a North()
>function then run it etc. etc.) then you could accomplish severe flexibility.
>
>But is there a way to run a Perl function via a string? So, you might load the
>string with the name of a room function (e.g. North32) and call it like that.
>But the next time, you might have loaded the string with the name North35 and
>want to run that function instead.
Yes, what you want to do is very possible in Perl... in fact,
relatively simple compared to many languages. As with almost any
large programming task, figuring out what the data structures should
be will be half the battle. Expect to invest a few hours in reading
in order to learn what you need to know to do this.
To answer your basic question above, yes, it's possible to run a Perl
function via a string. You would use "eval" for this. However, I
think you'll probably end up using a hash, where the key to the hash
is the string and the corresponding value is a reference to a
subroutine.
You need to read (carefully and thoroughly) the following sections of
documentation, which come with perl: perldata, prelref, perldsc, and
perllol. You will probably end up using modules to some extent, so
take a look at perlmod and perlmodlib when the time comes. However,
my guess is you'll be "require"ing, rather than "use"ing, a lot of
stuff, so be sure to read up on the differences between those.
Have fun!
Brand
--
_____
|/// | Brand Hilton bhilton@adc.com
| ADC| ADC Telecommunications, ATM Transport Division
|_____| Richardson, Texas
------------------------------
Date: Tue, 27 Oct 1998 13:15:47 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Email address Checker
Message-Id: <comdog-ya02408000R2710981315470001@news.panix.com>
In article <713cb7$s4d$1@nnrp1.dejanews.com>, cdtoad@hotmail.com posted:
> Theres a new book out called the Perl Cookbook and it has an example of how to
> use regular expression to do it... Although you can't tell if it's a REAL
> account or not. Just a validly formed email.
i think you misread that section. just because there is a section heading
doesn't mean the authors supplied a solution. from section 6.19, "Mactching
a Valid Email Address:, on page 206:
Solution:
There isn't one.
from there the authors go on to explain that assertion while offering
methods which they admit are imperfect.
however, they missed the preferred solution of big web services company.
if you assign their email address a unique string, the send to that
email address a message the contains a URL such as
http://www.domain.tld/validate.cgi?unique_string
so that when they access that URL their address is validated (since it
was obviously deliverable). computer purists might prefer the authors'
solution of making the user reply to an email, but i've found that that
task is often too confusing for the garden variety web user.
btw, for systems that i have developed, i like to use the MD5 module
to make the unique string. :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: 27 Oct 1998 16:23:08 GMT
From: cpierce1@cp500.fsic.ford.com (Clinton Pierce)
Subject: LWP::UserAgent, how to get headers?
Message-Id: <714s1c$o055@eccws1.dearborn.ford.com>
I've checked LWP::UserAgent, the pod, the FAQ and done a DejaNews search,
and didn't find this answer. It's either a stupid question, or I'm just
thinking about it the wrong way.
If I've made a request for a page using LWP::UserAgent, how can I
get the _headers_ of the received information. Code snippet follows:
sub open_url {
my($url)=@_;
my $ua=new LWP::UserAgent;
$ua->proxy(['http'], 'http://workproxy.ford.com:8080/');
$ua->agent('Getstuff/1.1');
my $request=new HTTP::Request('GET', $url);
$request->proxy_authorization_basic("userid", "password");
$res=$ua->request($request);
if (! $res->is_success) {
warn "Error! " . $res->code . " ". $res->message;
return(undef);
}
return( $res->content );
}
What I'm interested in is the "Content-type" returned, which describes
the $res->content. Where can I get that? Is it part of the $res
object, or part of the $request object?
Thanks.
--
+------------------------------------------------------------------------+
| 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: Tue, 27 Oct 1998 11:29:39 -0500
From: Anders Rawlins <anders.rawlins@comdev.ca>
Subject: Math::BigFloat - initializing value
Message-Id: <3635F4F3.64107CFF@comdev.ca>
This is what I'm trying to do:
-create a bigfloat number
-multiply that number (by a number string)
-round the number
-take the absolute value of the number
Problem:
When using the fmul(), fround() and fabs() methods, I get the following
warning:
"Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78."
Anyone know how I can get rid of this?
CODE:
#!/opt/perl5/bin/perl -w
use Math::BigFloat;
$val = "5.431634E-11";
$scale = "1";
$digits = 3;
print "creating big float\t$val\n";
$tmp_1 = Math::BigFloat->new( $val );
print "multiplying big float\t$tmp_1\n";
$tmp = $tmp_1->fmul( $scale );
$tmp_2 = Math::BigFloat->new( $tmp );
print "rounding big float\t$tmp_2\n";
$tmp = $tmp_2->fround( $digits );
$tmp_3 = Math::BigFloat->new( $tmp );
print "abs big float\t$tmp_3\n";
$tmp = $tmp_3->fabs();
print $tmp, "\n";
OUTPUT:
creating big float 5.431634E-11
multiplying big float .00000000005431634
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78.
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78.
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78.
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78.
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 96.
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78.
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78.
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78.
rounding big float .00000000005431634
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78.
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78.
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78.
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78.
abs big float .0000000000543
Use of uninitialized value at /opt/perl5/lib/Math/BigFloat.pm line 78.
+543E-13
TIA,
Anders
------------------------------
Date: Tue, 27 Oct 1998 11:10:14 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <3635F066.64E32843@min.net>
Ian Collier wrote:
> John Porter <jdporter@min.net> wrote:
> >Hmm, is there anyone reading that [rexx] newsgroup? ;-)
>
> Of course. Have you checked it recently?
Did you see my winky?
--
John Porter
Please Don't "Courtesy CC" me.
I read this newsgroup fanatically. You know that!
("Emailed only" is fine, though.)
------------------------------
Date: Tue, 27 Oct 1998 11:07:44 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <3635EFD0.E89EFA5D@min.net>
James Logajan wrote:
>
> Check out my post where I argue that Perl appears too cluttered because
> it's syntax's scope is too small. Think I got a hit there?
Possibly, except I can't figure out what you mean by
"Perl's syntax's scope is too small".
Care to elucidate?
--
John Porter
Please Don't "Courtesy CC" me.
I read this newsgroup fanatically. You know that!
("Emailed only" is fine, though.)
------------------------------
Date: Tue, 27 Oct 1998 11:12:30 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <3635F0EE.A696E6DA@min.net>
Klaus Schilling wrote:
>
> John Porter <jdporter@min.net> writes:
>
> > Klaus Schilling wrote:
> > >
> > > Cool syntaxes like Scheme's don't need curly braces or indentation for
> > > delimiting blocks, so there's no advantage in using either.
> >
> > If Scheme's syntax is so cool, why is it used even less than Python,
> > not to mention Perl?
>
> Because Scheme lacks a module system.
So the difference in popularity between various programming
languages might actually stem from real technical differences
in their capabilities? I thought so.
--
John Porter
Please Don't "Courtesy CC" me.
I read this newsgroup fanatically. You know that!
("Emailed only" is fine, though.)
------------------------------
Date: Tue, 27 Oct 1998 11:15:26 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Not to start a language war but..
Message-Id: <3635F19E.482C0977@min.net>
Andrew M. Kuchling wrote:
>
> ... JPython uses whatever GC your Java VM has, of course.
Ugh! Reason enough to eschew JPython.
Java's gc has notorious problems.
(Not that I'm making any excuses for Perl's so-called gc!)
--
John Porter
Please Don't "Courtesy CC" me.
I read this newsgroup fanatically. You know that!
("Emailed only" is fine, though.)
------------------------------
Date: 27 Oct 1998 07:17:11 -0800
From: Brad Murray <murrayb@vansel.alcatel.com>
Subject: Re: Not to start a language war but..
Message-Id: <uemru9gqw.fsf@vansel.alcatel.com>
James Logajan <JamesL@Lugoj.Com> writes:
> P.P.S. What DO Perl programmers call themselves? Perlers? Perlists?
> Something else? I think Python programmers are just beginning to grapple
> with that issue, based on some recent threads.
Productive members of society. Or some variation thereon.
--
BMurray "But there is another deep source of conflict built into
SW Analyst the office of the ruler.... It is the conflict between
Alcatel what the public good requires and what the public happens
to want." ---Joseph Tussman
------------------------------
Date: Tue, 27 Oct 1998 16:45:44 GMT
From: wlfraed@ix.netcom.com (Dennis Lee Bieber)
Subject: Re: Not to start a language war but..
Message-Id: <3635f671.2262142@nntp.ix.netcom.com>
On Tue, 27 Oct 1998 12:39:28 GMT, Brent Michalski
<perlguy@technologist.com> declaimed the following in comp.lang.python:
>
> I have not found a SINGLE real world computing problem that I have not
> been able to find a way to do it with Perl. I write for the "web world"
By definition, a Turing machine would do...
--
> ============================================================== <
> wlfraed@ix.netcom.com | Wulfraed Dennis Lee Bieber KD6MOG <
> wulfraed@dm.net | Bestiaria Support Staff <
> ============================================================== <
> Bestiaria Home Page: http://www.beastie.dm.net/ <
> Home Page: http://www.dm.net/~wulfraed/ <
------------------------------
Date: 27 Oct 1998 17:37:39 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Not to start a language war but..
Message-Id: <7150d3$l0j$1@client3.news.psi.net>
Klaus Schilling (Klaus.Schilling@home.ivm.de) wrote on MDCCCLXXXIII
September MCMXCIII in <URL:news:87vhl671tf.fsf@ivm.de>:
++
++
++ Would python or perl change severely if one replaced ref-counting with a real
++ gc like Boehm's?
No.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
------------------------------
Date: Tue, 27 Oct 1998 16:04:12 GMT
From: ijg@csc.liv.ac.uk (I.J. Garlick)
Subject: Re: Opendir and Readdir not working as expected
Message-Id: <F1Htz0.57E@csc.liv.ac.uk>
In article <m3n26ikxxp.fsf@joshua.panix.com>,
Jonathan Feinberg <jdf@pobox.com> writes:
> ijg@csc.liv.ac.uk (I.J. Garlick) writes:
>
>> > opendir(DIR,".") || die "cant open /etc/lvmconf";
>>
>> Why have you got parenthesese (sp?) around the args for opendir? and
>> why are you using '||' and not 'or'
>
> That's a matter of taste, and not a bug. You answer your own
> question: the parentheses give opendir() a higher precedence than ||,
> as documented in perlop.
I know it was rhetorical. I was trying to get him to think about TIMTOWTDI
Also the code he posted was almost a direct copy from the camel where 'or'
is used. So who is right Larry, Tom and Randal? or everyone else?
I remeber vaguely reading chapter and verse on where it was better to use
one form over another somewhere but i just can't remember where.
Besides holy wars have been started about less here abouts. :-)
--
--
Ian J. Garlick
<ijg@csc.liv.ac.uk>
<postmaster@merseymail.com>
Democracy is a government where you can say what you think even if you
don't think.
------------------------------
Date: 27 Oct 1998 17:30:25 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: Passing args from one perl script to another using 'do'
Message-Id: <714vvh$gov11@mercury.adc.com>
In article <714ik3$bug@newsops.execpc.com>,
Mark Stackhouse <stackhou@execpc.com> wrote:
>I can successfully call another perl script using 'do' but can't figure
>out how to pass args to it. I've read the perldocs on 'sub', '$_',
>'@ARGS', 'do', and searched Dejanews, but can't seem to locate what I'm
>looking for.
The key is in perlfunc. The entry for "do" says that it's just like
"eval", but more efficient, etc. The entry for "eval" says that it's
"executed in the context of the current Perl program...". So,
basically, whatever you "do" inherits your @ARGV.
--
_____
|/// | Brand Hilton bhilton@adc.com
| ADC| ADC Telecommunications, ATM Transport Division
|_____| Richardson, Texas
------------------------------
Date: Tue, 27 Oct 1998 11:24:38 -0500
From: John Porter <jdporter@min.net>
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <3635F3C6.599FBF79@min.net>
jkane@my-dejanews.com wrote:
>
> I had already read that,
> but nowhere did it mention that in 2000 that the return would become 3
> digits! Kinda useless. I was left without anything.
Hmmm, maybe your mind was stuck in the rut that the value returned
was somehow "digit-constrained". localtime returns integers.
How many digits in an integer? Depends on the radix of the conversion
to string, I guess. Why even assume base 10?
If you want to be concerned about the limitations of the values
returned by localtime, think about the limit of an integer on your
platform. It's probably a 32-bit number. That means you won't have
a problem until at least the year 1900+(2^31).
Of course, that's assuming your system survives the Year 2038 Problem.
--
John "Throbblefoot" Porter
Please Don't "Courtesy CC" me.
I read this newsgroup fanatically. You know that!
("Emailed only" is fine, though.)
"The people at the Grey Hotel
Are either aged or unwell." -- EG
------------------------------
Date: Tue, 27 Oct 1998 16:04:41 GMT
From: dave@mag-sol.com
Subject: Re: Perl & Y2K - booby trap code
Message-Id: <714qup$nbu$1@nnrp1.dejanews.com>
In article <714m3q$gbc$1@nnrp1.dejanews.com>,
jkane@my-dejanews.com wrote:
> In article <slrn73a60q.mba.sholden@pgrad.cs.usyd.edu.au>,
> sholden@cs.usyd.edu.au wrote:
>
> > >Thanks and I hope this is not a FAQ. :{ (
> >
> > Why don't you go and read the FAQ to find out first.
> >
> > =head2 Does Perl have a year 2000 problem? Is Perl Y2K compliant?
>
> I really appreciate your helpful response. (NOT!) I had already read that,
> but nowhere did it mention that in 2000 that the return would become 3
> digits! Kinda useless. I was left without anything.
Well, without anything except the thousand or so pages of free documentation
that came with your copy of Perl and clearly answered the questions you were
raising.
Dave...
--
dave@mag-sol.com
London Perl M[ou]ngers: <http://london.pm.org/>
[Note Changed URL]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Tue, 27 Oct 1998 11:11:32 -0600
From: Dan <Bachand@tamu.edu>
Subject: Perl / DNS Module
Message-Id: <3635FEC4.C82C27EA@tamu.edu>
I'm look for a simple way to take the log file on an NT web server and
extract the domain name from the addresses. Has anyone already written
a module to do this?
------------------------------
Date: 27 Oct 1998 12:41:01 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: psychology of language choice (was Re: language war ...)
Message-Id: <sarzpahkimq.fsf_-_@camel.fastserv.com>
it is interesting how language wars start and go on. in reading this and
other threads it is clear that the way a person's mind functions has a
great deal to do with the languages they choose to use (unless they are
required to by outside forces).
python types always talk about rigid structure, fixed indenting,
consistant forms. this is a very academic view going back to the purest
(in the minimalist way) language, lisp. academic like only one way to do
something and no complex syntax and semantics. also pythoners (and tcl
and rexx) dislike perl's use of 'noise' chars for language conciseness
and power. this is not a rigid syntax or semantic kind of thing. you
have to choose what you do from an array of possibilities. i don't know
python but having seen enough code snipets here and there i think
understand its design philosophy and style. like java in some ways it
tries to enforce a object and coding style on you. some people like that
structure. in art, it is said that form liberates, so that works for
some brains. not being allowed variations at each step allows them to
focus on what they think is important in the program.
perl hackers tend to like flexibility, TMTOWTDI, a melange of semantic
options, a chunky chowder of code constructs, etc. that works for our
mind set. restricting our coding methods us is like handcuffing our
brains. perl's origins are unix shells, sed, awk, C, lisp and
english. there is no way to be academically rigorous with that
ancestry. you can do some types of operations (e.g. padding a string) in
dozens of equally functional ways. this is an anethema to academic and
rigid minds, but nirvana for perl hackers. sometimes conciseness can
lead you down the path to obsfucation but that is true in any
language. most good perl hackers don't get anal about conciseness
(randall excepted :-) and write readable and if it is a module, reusable
code.
the language does not force bad code out of us. if you can't read
it easily it is because of how you think about code and not the
language. i can hack lisp (for emacs) but i hate it. i have written many
procs for my emacs startup but i spend too much time on what would be a
trivial thing in perl for me. lispers can whip out functional (if not
readable to me) code in minutes that would take me hours. i could do the
same in perl for them. to each their own.
this is not a wrong approach. having taken some seminars which taught me
how to analyze how different people process information, i can
understand how different languages attract different people. that is the
first choice you can make in a software project. it could be for cost,
fun, sucking up to the boss, speed of execution, speed of development,
availability, being a u$hit zombie, or any other combination of reasons
to chose a language. i, like many of you have a long and deep exposure to
languages from assembler, PL/I, C, unix tools, etc. perl works for me
for most projects. i am working on a testing program in perl but the
things it is testing are c modules (fast cgi) which should never be in
perl (or any language that doesn't compile to machine code). a new
server i am writing will be in C but again the test programs will be in
perl. i conciously make those design decisions.
languages that reach a certain critical mass never seem to die out
completely. there is still production pascal (an oxymoron) being
created, fresh cobol being written, etc. with all theses new languages,
we still write shell amd awk scripts when it is appropriate. would you
write an install system in perl (or python) not knowing if it was
preinstalled? no way, you do that in shell since it is on all unix
systems by default. a lousy language but it has the advantage of
ubiquitous availablilty. a language isn't better than another but better
for the programmer or project than another. languages are human
artifices and if they are turing compatible than it comes down to our
needs and the project's. given a free choice we will choose a language
that works best in our minds. i choose perl for all projects where i can
use it effectively. these day i only choose C for projects which need
raw speed. i have no need to learn python or rexx, etc since i know i
can do my jobs in perl and my mind likes to think in perl. i have
actively searched for perl work over the last 8 years just because i
like the language. i have been to the first 2 perl conferences,
participate in the c.l.p.* groups, proseletyze perl because *I* like
it, not because it is the best language.
if perl users migrate to python, more power to them. perl will not die
because of that and python will not take over the computing world
either. i dislike having a fixed indent and rigid coding style force on
me but that is my choice. others agree and disagree and that is their
choice. so stop this language war crap or we will all become POB and
work in VB++ (DOJ and god help us all!)
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Tue, 27 Oct 1998 16:40:31 GMT
From: maelstrom@deathsdoor.com (Maelstrom)
Subject: require help on require
Message-Id: <3635f539.51760064@news.iinet.net.au>
Hi. I'm currently trying to sort through all my hacked-together scripts and
create some libraries of structured, reusable code which I use with
something like
require "common.pl";
At the moment everything's in common.pl but I'd like to split things up
further into email/cgi/password etc etc. Anyway a lot of the routines in
the sub-libraries still use routines from common.pl so my question is if I
have a script with a header like this
#!/usr/bin/perl
require "common.pl";
require "htpasswd.pl";
require "email.pl";
where htpasswd.pl and email.pl both have ''require "common.pl";`` have I
just loaded three instances of common.pl into memory or will the compiler
ignore duplicate files? Also is there any benefit in using the use
statement and modules rather than require?
Thanks,
--Steve
"In fact, it's cold as Hell. The bottom, __________________________
frozen part, not the rivers of fire part." / ~This space for let~
Joe Bay /http://www.sexgods.base.org/
------------------------------
Date: Tue, 27 Oct 1998 17:04:28 +0100
From: Schubert Juergen <jschubert@syskonnect.de>
Subject: socket connection via udp
Message-Id: <3635EF0C.EA4EE99A@syskonnect.de>
Hi everybody
I would like to create a socket connection via udp from a client to a
server.
How can I create a timeout if the receive from the server fail (may be
the server is down)?
Thanks for any help
Juergen
------------------------------
Date: 27 Oct 1998 16:19:08 GMT
From: bhilton@tsg.adc.com (Brand Hilton)
Subject: Re: sockets
Message-Id: <714rps$gov10@mercury.adc.com>
In article <7144gk$6dl$1@ascomax.hasler.ascom.ch>,
Henri Periat <periat@ens.ascom.ch> wrote:
>Hi everybody
>
>I would like to create two Perl programs which communicate bidirectional
>with each other. A says something to B and B responds.
Sockets are bi-directional, so unless there's some other compelling
reason, you really don't need two of them.
--
_____
|/// | Brand Hilton bhilton@adc.com
| ADC| ADC Telecommunications, ATM Transport Division
|_____| Richardson, Texas
------------------------------
Date: Mon, 26 Oct 1998 21:33:48 +1100
From: just <elmo@innocent.com>
Subject: sorting a hash by values (sorry if this is a stupid question)
Message-Id: <3634500C.DB47DB96@innocent.com>
hiya,
i'm really new to perl and i'm making a genuine effort to teach myself
it without bothering u kind ppl, but i've got stuck so pls forgive me if
this is a stupid question.
i'm writing a little script and in it i have a has which has the players
names as the keys and stores their score in the value part (it's a
starcraft ladder i'm making for my friend). anyway, so far everything
works beautifully, password checking, file saving and everything (i
really surprised myself) except i need to display everyone's score in
descending order. i can quite easily sort my has by keys and display the
info (using foreach $whatever (sort keys %myhash) or whatever it is) but
i really need to sort the hash by values (ie the scores, which
obviously means it would be a numerical sort)... even if it is only
temporarily while i output them as html
once again, sorry to bother u ppl... and thanx in advance to anyone who
can help me,
brian.
------------------------------
Date: 27 Oct 1998 12:48:17 -0500
From: Uri Guttman <uri@fastengines.com>
Subject: Re: sorting a hash by values (sorry if this is a stupid question)
Message-Id: <sarvhl5kiam.fsf@camel.fastserv.com>
>>>>> "j" == just <elmo@innocent.com> writes:
j> i'm writing a little script and in it i have a has which has the
j> players names as the keys and stores their score in the value part
j> (it's a starcraft ladder i'm making for my friend). anyway, so far
j> everything works beautifully, password checking, file saving and
j> everything (i really surprised myself) except i need to display
j> everyone's score in descending order. i can quite easily sort my
j> has by keys and display the info (using foreach $whatever (sort
j> keys %myhash) or whatever it is) but i really need to sort the hash
j> by values (ie the scores, which obviously means it would be a
j> numerical sort)... even if it is only temporarily while i output
j> them as html
it is in the FAQ. find it. read it. learn it. then all your problems will
be solved. you can find it with your perl distribution or at
www.perl.com.
uri
--
Uri Guttman Fast Engines -- The Leader in Fast CGI Technology
uri@fastengines.com http://www.fastengines.com
------------------------------
Date: Tue, 27 Oct 1998 13:16:53 -0400
From: comdog@computerdog.com (brian d foy)
Subject: Re: Web Client Automation
Message-Id: <comdog-ya02408000R2710981316530001@news.panix.com>
In article <712lku$mad$1@nnrp1.dejanews.com>, debel@my-dejanews.com posted:
> I'm using the ActiveState port of Perl (5.005) and I'm encoding the "space"
> character like this:
>
> $city =~ s/(\W)/sprintf("%%%x", ord($1))/eg;
perhaps you'd like to use the URI::Escape module. saves time *and* money :)
--
brian d foy <comdog@computerdog.com>
CGI Meta FAQ <URL:http://computerdog.com/CGI_MetaFAQ.html>
------------------------------
Date: Tue, 27 Oct 1998 17:05:57 GMT
From: droby@copyright.com
Subject: Re: What isn't Perl good for?
Message-Id: <714uhk$t7e$1@nnrp1.dejanews.com>
In article <3635069f.795963@news.junctionnet.com>,
jlewchuk@junctionnet.com wrote:
>
> >> Also, from my POV, PERL is treated as a programming language, which it's
not.
> >
> >Please elaborate on exactly how it is not a programming language.
>
> I believe localization is my biggest concern: the ability to structure an
> entire program as a hierarchical series of modules, each containing its own
> environment. Such a task is natural in some ASM, C, heck, most programming
> languages, but not in perl.
>
Perhaps we need now to define "natural". Perl certainly has localization.
What is it about Perl's localization that you find unnatural?
>
> High-level tasks only. Also, I did not assert that it could not be a
> replacement for C/C++. I said that I didn't consider it a programming
> language. The two are different. For example, APL can be a great replacement
> for C/C++, if you're only doing matrix/vector manipulation.
>
Is APL also not a programming language?
Why must we switch from one language to another? Is it so horrid to be
multilingual and choose the language appropriate to the task? I use Perl alot
because it works well with what I have to do. I wouldn't use it for a device
driver, but I don't write those very often. If I were doing something heavily
involving vector/matrix/tensor manipulation, I might well brush up on my
long-forgotten APL, but I wouldn't call it a replacement for C/C++.
And why do we have TWO language-war theads going on at once?
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
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 4082
**************************************