[11112] in Perl-Users-Digest
Perl-Users Digest, Issue: 4712 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Jan 21 15:06:07 1999
Date: Thu, 21 Jan 99 12:00:21 -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 Thu, 21 Jan 1999 Volume: 8 Number: 4712
Today's topics:
Re: "News Group Not Found" (Steve Linberg)
Re: dereference entire array of array references (M.J.T. Guy)
Re: dereference entire array of array references (M.J.T. Guy)
Re: dereference entire array of array references <abey@hill.ucr.edu>
Re: Example of Perl Cookie Implementation please dhosek@webley.com
Re: glob "toggle" behaviour (urgent!) (M.J.T. Guy)
Re: glob "toggle" behaviour (urgent!) (Tad McClellan)
Re: handling STDERR in open() (Tad McClellan)
Re: handling STDERR in open() <Jean-Yves.Burlett@scinfo.u-nancy.fr>
Re: Help with RE for separate Perl codes and comments (Greg Ward)
Re: Help with regular expression (Eric Pement)
Re: How long would the Unixes last without Perl? (Abigail)
Re: How long would the Unixes last without Perl? <Arved_37@chebucto.ns.ca>
Re: How long would the Unixes last without Perl? (Greg Ward)
Re: IS THIS POSSIBLE?? (Abigail)
Re: large data arrays (Tad McClellan)
Re: list of hashes dhosek@webley.com
Re: Matching Numbers from a string. (Thomas Brian Holdren)
Re: Newbie string question, please help :) (Abigail)
Re: Perl 5.005_2 fails op/pack test 9 on DEC OSF1 (Donald L. Nash)
Re: Perl Criticism droby@copyright.com
Re: Perl Criticism droby@copyright.com
PLease Help CGI configuration problem <bsh@mindspring.com@mindspring.com@mindspring.com>
Problems with Socket.pm on AIX kriggins@ibm.net
Running -T <alcazar@netcomp.net>
Re: Running a SQL query from a Perl CGI program (Abigail)
Re: Status of Threaded Perl (M.J.T. Guy)
Re: Sys::Syslog equivalent for Win32 <toddl@SiTera.com>
Re: test <jjarrett@ecpi.com>
Re: Y2K? (Larry Rosler)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 21 Jan 1999 13:17:10 -0500
From: linberg@literacy.upenn.edu (Steve Linberg)
Subject: Re: "News Group Not Found"
Message-Id: <linberg-2101991317100001@ltl1.literacy.upenn.edu>
In article <19133-36A758BD-22@newsd-101.iap.bryant.webtv.net>,
KernelKlink@webtv.net wrote:
> Not a Perl issue...but could be one day.
No, this is a WebTV issue, and/or a Microsoft issue. Not a Perl issue at
all. Complain to your server admins that you're unhappy with your
newsfeed.
--
Steve Linberg, Systems Programmer &c.
National Center on Adult Literacy, University of Pennsylvania
email: <linberg@literacy.upenn.edu>
WWW: <http://www.literacyonline.org>
------------------------------
Date: 21 Jan 1999 18:27:50 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: dereference entire array of array references
Message-Id: <787rj6$ldt$1@pegasus.csx.cam.ac.uk>
Abraham Grief <abey@hill.ucr.edu> wrote:
>
>How about something ot the effect of:
>
>(@array1,@array2,@array3) = map {${$_}} @results;
>
>I haven't tried it, but I'm pretty sure that it should work.
No way. In an assignment like that, everything gets assigned to
@array1, and @array2 and @array3 remain empty. And you probably
meant to write @{$_} rather than ${$_}.
You _could_ do something on those lines by pre-allocating the arrays,
then assigning to all the elements:
(@array1[0..$#array1],@array1[0..$#array1],@array1[0..$#array1]) =
map {@{$_}} @results;
But it's not what I'd call elegant.
Or if you have a Perl 4 mentality, and your stomach can stand it (and
you don't mind the slightly different semantics):
(*array1, *array2, *array3) = @results;
Mike Guy
------------------------------
Date: 21 Jan 1999 18:34:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: dereference entire array of array references
Message-Id: <787rvl$lid$1@pegasus.csx.cam.ac.uk>
I mistakenly wrote:
>You _could_ do something on those lines by pre-allocating the arrays,
>then assigning to all the elements:
>
>(@array1[0..$#array1],@array1[0..$#array1],@array1[0..$#array1]) =
> map {@{$_}} @results;
Ooops. Make those arrays different:
(@array1[0..$#array1],@array2[0..$#array2],@array3[0..$#array3]) =
map {@{$_}} @results;
Mike Guy
------------------------------
Date: Thu, 21 Jan 1999 11:52:02 -0800
From: Abraham Grief <abey@hill.ucr.edu>
Subject: Re: dereference entire array of array references
Message-Id: <Pine.LNX.4.05.9901211150180.10499-100000@hill.ucr.edu>
Ok, I failed with my code. That (*array1, *array2, *array3) = @results I
think is pretty elegant, even if it looks weird.
On 21 Jan 1999, M.J.T. Guy wrote:
> Abraham Grief <abey@hill.ucr.edu> wrote:
> >
> >How about something ot the effect of:
> >
> >(@array1,@array2,@array3) = map {${$_}} @results;
> >
> >I haven't tried it, but I'm pretty sure that it should work.
>
> No way. In an assignment like that, everything gets assigned to
> @array1, and @array2 and @array3 remain empty. And you probably
> meant to write @{$_} rather than ${$_}.
>
> You _could_ do something on those lines by pre-allocating the arrays,
> then assigning to all the elements:
>
> (@array1[0..$#array1],@array1[0..$#array1],@array1[0..$#array1]) =
> map {@{$_}} @results;
>
> But it's not what I'd call elegant.
>
> Or if you have a Perl 4 mentality, and your stomach can stand it (and
> you don't mind the slightly different semantics):
>
> (*array1, *array2, *array3) = @results;
>
>
> Mike Guy
>
>
------------------------------
Date: Thu, 21 Jan 1999 18:54:50 GMT
From: dhosek@webley.com
Subject: Re: Example of Perl Cookie Implementation please
Message-Id: <787t5k$100$1@nnrp1.dejanews.com>
In article <7853u8$ejs$4@client2.news.psi.net>,
abigail@fnx.com wrote:
> Steve . (syarbrou@nospam.enteract.com) wrote on MCMLXVIII September
> MCMXCIII in <URL:news:36a60631.1769028@news.enteract.com>:
> [A rather inoffensive request to see some sample code]
> Can I have an almond cookie please?
...
> You would do it the same as in a fortran program using cookies.
> Your question has nothing to do with perl. Since you are using a keyboard,
> I suggest asking your question in alt.comp.periphs.keyboard.
Actually, it has plenty to do with Perl. He wanted to see an example of how
the task would be done with Perl. A pointer at the CGI and CGI::Cookies
modules was appropriate. A lame attack of the poster was, quite frankly, rude
and uncalled for.
I've already posted a useful answer to the query, so I won't repeat that in
this post.
-dh
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 21 Jan 1999 18:04:42 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: glob "toggle" behaviour (urgent!)
Message-Id: <787q7q$k8g$1@pegasus.csx.cam.ac.uk>
Claudio Strizzolo <Claudio.Strizzolo@trieste.infn.it> wrote:
>Hi all,
> I have a strange problem with a small script using glob
>on a Unix machine.
>When running glob to expand a filepath for a number of times, it
>seems to work the first time, but it returns null on the second
>one; then it works again the third one, but not the fourth, and
>so on.
>Here is the script:
>
>#!/usr/local/bin/perl
>
>for ($i=0; $i<5; $i++) {
> printf("=========== %d ===========\n",$i);
> $file=glob("~myname/myfile");
> printf("%s",qx{ls -la $file});
>}
You are using glob() in a scalar context. glob() behaves just like
<~myname/myfile> and in a scalar context, it returns the next value
each time it is evaluated, or undef if there are no more values.
You need to force a list context, for example by writing
($file)=glob("~myname/myfile");
This *can* be discovered in the documentation, but it's hardly easy to
find. Look in "perldoc -f glob", then follow the pointer to
L<perlop/"I/O Operators">, where you'll (eventually) find it buried.
Mike Guy
------------------------------
Date: Thu, 21 Jan 1999 12:02:14 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: glob "toggle" behaviour (urgent!)
Message-Id: <63q787.7qs.ln@magna.metronet.com>
Claudio Strizzolo (Claudio.Strizzolo@trieste.infn.it) wrote:
: I have a strange problem with a small script using glob
: on a Unix machine.
It is not strange.
It is behaving as documented.
Did you read the description of the function that you
don't understand? That often helps with understanding...
: When running glob to expand a filepath for a number of times, it
: seems to work the first time, but it returns null on the second
: one; then it works again the third one, but not the fourth, and
: so on.
: Here is the script:
: #!/usr/local/bin/perl
You are missing a -w switch there!
: for ($i=0; $i<5; $i++) {
: printf("=========== %d ===========\n",$i);
: $file=glob("~myname/myfile");
It is a Bad Idea to ask for interpolation with double quotes
when you don't need or want interpolation. You should use
single quotes if you do not need or want interpolation.
: printf("%s",qx{ls -la $file});
: }
'perlfunc' says to see the "I/O Operators" section of 'perlop',
which says:
------------------
A glob evaluates its (embedded) argument only when it is starting a new
list. All values must be read before it will start over. In a list
context this isn't important, because you automatically get them all
anyway. In scalar context, however, the operator returns the next value
each time it is called, or a C<undef> value if you've just run out.
------------------
It is doing what it said it will do.
You are calling it in a scalar context.
: Is there any workaround?
Call glob() in a list context if you don't want the behavior
that comes with a scalar context:
$file=(glob('~myname/myfile'))[0];
Or, call in scalar context and check to see when it has
gotten to the end of the list:
while (defined ($file = glob('~myname/myfile'))) {
printf("%s",qx{ls -la $file});
}
Why would you glob() a constant string anyway?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 21 Jan 1999 12:52:03 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: handling STDERR in open()
Message-Id: <j0t787.gdt.ln@magna.metronet.com>
Andrew S Gianni (agianni@acsu.buffalo.edu) wrote:
: open(SESAME, "system_call -foo |");
: and the call kicks some stuff out the standard error which I want to
: capture
: Any hints on dealing with this?
Like in a Frequently Asked Question or something?
Perl FAQ, part 8:
"How can I capture STDERR from an external command?"
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 21 Jan 1999 20:24:18 +0100
From: JYB <Jean-Yves.Burlett@scinfo.u-nancy.fr>
Subject: Re: handling STDERR in open()
Message-Id: <i8naezcbfa5.fsf@pollux.scinfo.u-nancy.fr>
tadmc@metronet.com (Tad McClellan) writes:
> Andrew S Gianni (agianni@acsu.buffalo.edu) wrote:
>
> : open(SESAME, "system_call -foo |");
>
> : and the call kicks some stuff out the standard error which I want to
> : capture
>
> : Any hints on dealing with this?
Try to open(STDERR,">& STDOUT);
before your opening and STDERR will be in STDOUT ...
--
login:burlett
Contact: Jean-Yves.Burlett@scinfo.u-nancy.fr / jburlett@lemel.fr
------------------------------
Date: 21 Jan 1999 19:23:56 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: Help with RE for separate Perl codes and comments
Message-Id: <787usc$do3$2@news0-alterdial.uu.net>
Jerry Chen <016781c@acadiau.ca> wrote:
> I have some difficulties to parse Perl code to identify
> the source part and comment part using
> regular expression. From searching the Dejanews archive,
> I know that it is difficult to separate codes with comments.
> However, I do not need to be 100% accurate. Something close
> will be ok.
Well, have you tried this?
$line = " &sub ('foo', $i++, [1, 2, 3]); # call a subroutine";
$line =~ s/\s*(#.*)//;
$comment = $1;
The last two lines are relevant of course.
This will work as long as no '#' characters appear in strings, PODs,
heredocs, or regular expressions. Strings and regular expressions are
effectively impossible to parse; don't bother trying. PODs and heredocs
should be possible though.
I do know that the compiler stuff in 5.005 has a module called Deparse
(or is it B::Deparse? something like that); but I don't know if it
preserves comments. Give it a look.
As the old saying goes... only perl can parse Perl.
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: Thu, 21 Jan 1999 19:04:50 GMT
From: epement@jpusa.chi.il.us (Eric Pement)
Subject: Re: Help with regular expression
Message-Id: <36a77049.419707959@news.jpusa.net>
On Wed, 20 Jan 1999 19:11:45 GMT, root@coredcs.com (Network Operations)
wrote:
>I have the following regexp that I'm attempting to decipher. The
>input variable is text(a paragraph of regular words).
>
>$text =~ s/([^\012]{1,90})\s/$1\012/sg;
>
>I believe that it's trying to do something with FF characters.
\012 is to be interpreted as octal 12 (hence, a linefeed or a Unix
newline), not as a decimal 12 (formfeed).
For every maximally-longest string of 1-90 characters which are not
linefeeds, followed by a whitespace character (same as [ \t\n\r\f]),
replace the whitespace character with a linefeed (newline). The 'g'
switch means to do this globally. I don't think the 's' switch was
necessary, since 's' makes the metacharacter '.' match a newline (but no
'.' was used here), and "makes the match ignore the value of the old,
deprecated $* variable" (_Perl Cookbook_, p. 163).
Assuming that your input paragraph contained less than 90 characters
per line (and assuming that the paragraph contains newlines within it),
its effect was to put the last word of each line on a separate line, as
you note below. Though that was the effect, I wonder whether that was
the *intent* of the person writing the script. Perhaps they wanted each
word to appear on a separate line?
>However what happens is that it seems to drop the last word of the
>last sentence down a line(looks like maybe a newline or carriage
>return gets put in before the last word of the last line).
Do you mean the last word of the last sentence, the last word of the
paragraph, or the last word of each line?
From your description, it looks as if you're working in a DOS
environment, since the script only "drop[s] the last word down" instead
of placing it on a separate line. In MS-DOS, a single linefeed will drop
the last word down
(like this), while a single carriage return will
cause the text to start printing on column 1 of the CURRENT line, not
the next line. Under DOS, the newline is represented by two bytes, a
carriage return and a linefeed: in that order. If you're converting a
Unix script to work under DOS, you may want to replace the \012 with a
\n in the foregoing script.
>Any help you can give would be appreciated. I'm going to poke through
>Mastering Reg Exp from ora.
>
>Steve
Hope this helps. If it doesn't, holler.
Kind regards,
Eric Pement
--
Eric Pement <epement@jpusa.chi.il.us>
senior editor, Cornerstone magazine
http://www.cornerstonemag.com
939 W. Wilson Ave., Chicago, IL 60640-5706
tel: 773/561-2450, 1-(ext.)2084 fax: 773/989-2076
------------------------------
Date: 21 Jan 1999 17:41:57 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <787ot5$6e$2@client2.news.psi.net>
Phlip (address@web.page) wrote on MCMLXVIII September MCMXCIII in
<URL:news:785pe3$ajn@chronicle.concentric.net>:
{}
{} Is anyone out there running a Unix with no Perl installed?
Gazillions of systems. I wouldn't be surprised if there are more
Unix systems where Perl isn't used than Unix systems where Perl
is used.
But I have no data to prove it.
Abigail
--
sub f{sprintf$_[0],$_[1],$_[2]}print f('%c%s',74,f('%c%s',117,f('%c%s',115,f(
'%c%s',116,f('%c%s',32,f('%c%s',97,f('%c%s',0x6e,f('%c%s',111,f('%c%s',116,f(
'%c%s',104,f('%c%s',0x65,f('%c%s',114,f('%c%s',32,f('%c%s',80,f('%c%s',101,f(
'%c%s',114,f('%c%s',0x6c,f('%c%s',32,f('%c%s',0x48,f('%c%s',97,f('%c%s',99,f(
'%c%s',107,f('%c%s',101,f('%c%s',114,f('%c%s',10,)))))))))))))))))))))))))
------------------------------
Date: Thu, 21 Jan 1999 15:05:44 -0400
From: Arved Sandstrom <Arved_37@chebucto.ns.ca>
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <Pine.GSO.3.95.iB1.0.990121145821.28196A-100000@halifax.chebucto.ns.ca>
On 21 Jan 1999, Abigail wrote:
> Phlip (address@web.page) wrote on MCMLXVIII September MCMXCIII in
> <URL:news:785pe3$ajn@chronicle.concentric.net>:
> {}
> {} Is anyone out there running a Unix with no Perl installed?
>
> Gazillions of systems. I wouldn't be surprised if there are more
> Unix systems where Perl isn't used than Unix systems where Perl
> is used.
>
> But I have no data to prove it.
Not only that, but based on just the subset of Unix systems I've seen,
gov't and academia for the most part, when Perl _is_ present it's often
woefully under-maintained: it's still version 4.036 or something, or it's
version 5 right out of the box with no effort made to download extra stuff
from CPAN, or it's in a non-standard place and the sysadmin forgets about
it, etc etc etc.
Often what happens is one or three Perl aficionados work at such a place
for a few months or years, get Perl right up to speed, everyone is
impressed at what the language can do, then they leave and the
distribution languishes and dies.
So even the mere presence of Perl on the box doesn't mean much.
------------------------------
Date: 21 Jan 1999 19:14:20 GMT
From: gward@cnri.reston.va.us (Greg Ward)
Subject: Re: How long would the Unixes last without Perl?
Message-Id: <787uac$do3$1@news0-alterdial.uu.net>
Phlip <address@web.page> wrote:
> Ever since Linux got me (not the other way around), I have observed
> that
> Perl is as close to an OS component as makes no difference.
>
> Is anyone out there running a Unix with no Perl installed?
I know lots of Python hackers who would love to see the last of Perl.
They're all irrationally biased against Perl, but they probably don't
use it every day. (Although there is still one mailing list on
python.org that uses Majordomo -- they've converted all the others to
use Mailman, which of course is written in Python.)
If you're thinking of distributing software with configuration or
installation scripts written in Perl instead of shell, be *very very*
careful. Some vendors do include Perl with their commercial Unix
installations, but it might be old, very old, or creakingly ancient
(like the OS itself). And there's no guarantee that the person
administering the system -- if there *is* anyone administering it -- has
a clue what they're doing. Last time I checked, it still takes a couple
of clues to build and install Perl.
Greg
--
Greg Ward - software developer gward@cnri.reston.va.us
Corporation for National Research Initiatives
1895 Preston White Drive voice: +1-703-620-8990 x287
Reston, Virginia, USA 20191-5434 fax: +1-703-620-0913
------------------------------
Date: 21 Jan 1999 17:43:09 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: IS THIS POSSIBLE??
Message-Id: <787ovd$6e$3@client2.news.psi.net>
Administrador (ablasco@mad.servicom.es) wrote on MCMLXIX September
MCMXCIII in <URL:news:7878ec$pn5@wendy.mad.servicom.es>:
\\
\\ I need a script that runs from our server and that script should load a
\\ remote page from another site every 5 seconds. I think it is easy to
\\ program. It should have a configuration screen to start the robot, stop
\\ the robot, and a put the url of the page to load every xx seconds. This
\\ robot should work on the server, and if I cut the connection it will
\\ still log every 5 seconds until i stopit.
\\
\\ Is this possible?
Yes.
Abigail
--
perl -wleprint -eqq-@{[ -eqw\\\\- -eJust -eanother -ePerl -eHacker -e\\\\-]}-
------------------------------
Date: Thu, 21 Jan 1999 12:03:38 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: large data arrays
Message-Id: <q5q787.7qs.ln@magna.metronet.com>
Eadmund@writeme.com wrote:
: I have a web page that requires a lot of data (an address book) to be
: passed from the web server to the client page and back again. Sending it from
: the server is easy enough, but does anyone know a good way to pass it back?
: Think about this please before answering 'A Form' etc. We are talking a lot
: of data (up to 100 addresses). I can preprocess any data via a java script.
Do you have a Perl question?
--
Tad McClellan SGML Consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 21 Jan 1999 19:01:06 GMT
From: dhosek@webley.com
Subject: Re: list of hashes
Message-Id: <787tha$1fr$1@nnrp1.dejanews.com>
In article <78548m$ejs$5@client2.news.psi.net>,
abigail@fnx.com wrote:
> Alex Farber (alex@kawo2.rwth-aachen.de) wrote on MCMLXVIII September
> MCMXCIII in <URL:news:36A61CBA.E95076A7@kawo2.rwth-aachen.de>:
> [] could you please explain it little bit more? Because you seem
> [] to be correct - it looked like I was always pushing the same
> [] (it printed HASH(0x80c5c9c) for all occurences) empty hash with
> [] my SybPerl-script:
> [] use strict;
> [] my $href;
> [] ...
> [] while($href = $dbh->ct_fetch(1, 1)) {
> [] push(@loh, $href);
> [] }
> RTFM. It's documented.
And the documentation is not at clear on how to handle this sort of thing.
Have YOU read the documentation, Abigail? For better or worse, Peppler rather
glosses over the syntax and returns where hashes are returned.
As for actually doing what was desired, the following has worked for me:
while ($dbh->ct_results($result_type) != CS_END_RESULTS) {
# Note that the above SETS $result_type
next unless ($dbh->fetchable($result_type))
while (%row = $dbh->ct_fetch(1)) {
if ($result_type == CS_ROW_RESULT) {
push (@account_table, {%row});
}
}
}
The ct_sql call should simplify this a bit, but I have not yet been able to
work out exactly what's being returned and deal with it appropriately.
-dh
}
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: 21 Jan 1999 18:49:21 GMT
From: irc_addict@hotmail.com (Thomas Brian Holdren)
Subject: Re: Matching Numbers from a string.
Message-Id: <787srh$plb@trakker.mcdermott.com>
In article <36A6E959.8C4EF51A@debis.com>, darko.tunukovic@debis.com says...
>How can I get only the number from this string ?
Read about regular expressions before posting something like this again.
Please.
--
tbholdren
------------------------------
Date: 21 Jan 1999 17:26:05 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Newbie string question, please help :)
Message-Id: <787nvd$6e$1@client2.news.psi.net>
Larry Rosler (lr@hpl.hp.com) wrote on MCMLXIX September MCMXCIII in
<URL:news:MPG.11106d678143f6be9899b3@nntp.hpl.hp.com>:
,, In article <7867hc$meu$3@client2.news.psi.net>, Abigail <abigail@fnx.com>
,, says...
,, + while ($string =~ /(.)/g) {
,, + no strict;
,, + &{"do_something_with_$1"} (@args) if
,, + defined &{"do_something_with_$1"};
,, + }
,,
,, That doesn't do very well if $string contains '*' or any other \W,
,, though. The names of functions have to be identifiers.
No they don't.
#!/usr/local/bin/perl -w
*{"do_something_with_*"} = sub {print "Hello\n"};
&{"do_something_with_*"} ();
__END__
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
------------------------------
Date: Thu, 21 Jan 1999 12:48:20 -0600
From: D.Nash@utexas.edu (Donald L. Nash)
Subject: Re: Perl 5.005_2 fails op/pack test 9 on DEC OSF1
Message-Id: <D.Nash-2101991248200001@bubba.ots.utexas.edu>
I received e-mail with the solution to this problem. To summarize, the
problem is due to a bug in the DEC C optimizer, and has been reported to
perlbug. If you compile the module pp.c at -O0 (all optimizations off),
then the problem does not manifest. Perl uses -O4 by default, but the bug
manifests at all optimization levels from -O1 and up. I recompiled pp.c
and relinked, and the bug vanished.
Many thanks to all who helped.
--
Donald L. Nash, <D.Nash@utexas.edu>, PGP Key ID: 0x689DA021
The University of Texas System Office of Telecommunication Services
------------------------------
Date: Thu, 21 Jan 1999 17:58:41 GMT
From: droby@copyright.com
Subject: Re: Perl Criticism
Message-Id: <787psa$tq1$1@nnrp1.dejanews.com>
In article <fl_aggie-2001991000310001@aggie.coaps.fsu.edu>,
fl_aggie@thepentagon.com (I R A Aggie) wrote:
>
> I see...topmind is here to protect us from ourselves. Before long, he'll be
> working for the government, certifying programmers and languages that they
> comply with new government regulations.
>
> James
>
Oh, my! D'ya suppose he might have had something to do with GOSIP?
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 21 Jan 1999 18:58:43 GMT
From: droby@copyright.com
Subject: Re: Perl Criticism
Message-Id: <787tcs$150$1@nnrp1.dejanews.com>
In article <786dsn$o0l$1@nnrp1.dejanews.com>,
topmind@technologist.com wrote:
> > And topmind's logic is bad enough that we don't need to resort to that.
>
> Okay, my spelling is "excessively phonetic", but
>
> Give one example of bad logic!
>
X can be used to create something bad, therefore X is bad.
Seems to me to summarize all your points succinctly.
--
Don Roby
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 21 Jan 1999 13:05:11 -0600
From: <bsh@mindspring.com@mindspring.com@mindspring.com>
Subject: PLease Help CGI configuration problem
Message-Id: <787qbi$pm7$1@camel15.mindspring.com>
Thanks for coming this far.
I am a newbe when it comes to html, I installed perl5.004 on my spark 5 with
the CGI modules. I am now getting a screen waiting with the message:
(waitinig for HTTP query from standard output)
any pointers as to what it is acutaly waiting for and/or how I can fix it.
Thanks,
Bruce
------------------------------
Date: Thu, 21 Jan 1999 18:51:33 GMT
From: kriggins@ibm.net
Subject: Problems with Socket.pm on AIX
Message-Id: <787svg$tv$1@nnrp1.dejanews.com>
Hello peoples,
Here's the situation.
Compiled perl 5.005_02 on an RS6000 host running AIX 4.2.1.
Exported the /usr/local directory structure to my other hosts.
Wrote a perl program to listen on a socket and return some text on connect.
Works great from the system I compiled perl on. Fails with the following
error message when it tries to perform the following statement.
Statement:
bind(Server, sockaddr_in($port, INADDR_ANY)) or die "bind: $!";
Error:
Use of uninitialized value at /usr/local/lib/perl5/5.00502/aix/Socket.pm line
278.
Thanks in advance,
Kevin RIggins
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Thu, 21 Jan 1999 19:49:17 GMT
From: "R. Alcazar" <alcazar@netcomp.net>
Subject: Running -T
Message-Id: <1xLp2.189$M27.418@news.flash.net>
How come I get this error when include -T such:
#!/usr/bin/local/perl -T
Too late for "-T" option at somefile.cgi line 1
illfigah
------------------------------
Date: 21 Jan 1999 18:15:16 GMT
From: abigail@fnx.com (Abigail)
Subject: Re: Running a SQL query from a Perl CGI program
Message-Id: <787qrk$nb$1@client2.news.psi.net>
Prabha Krishnan (prabha@tek-tools.com) wrote on MCMLXIX September
MCMXCIII in <URL:news:36A73416.CCE54AE8@tek-tools.com>:
@@ System setup : Apache 1.2.5
@@ Database : Oracle 8.0.5 on Red Hat Linux 5.1
@@
@@ I am a beginner to perl.
@@ I have a perl script that needs to run a query against an Oracle
@@ database. When i run this from the command line, it runs fine. But, when
@@
@@ i call this script as a CGI from the browser, I donot get any results
@@ back. I am not sure what is happening. Attached is the perl script.
So.... what error messages are you getting?
@@ #!/usr/bin/perl
Where's the -w?
Where's the -T?
Where's the 'use strict;'?
@@ open(SHELLFILE, ">/tmp/$$.sh");
What's the return value of open()?
@@ system("chmod +x /tmp/$$.sh");
@@ system("/tmp/$$.sh");
What's the result of the systems?
@@ system("rm -f /tmp/$$.sh");
@@ system("rm -f /tmp/$$.log");
What's wrong with unlink?
If you do your utter best to have Perl not check any status codes, nor
have it generate any error or warning messages, don't be surprised it
silently fails!
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: 21 Jan 1999 18:15:26 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Status of Threaded Perl
Message-Id: <787qru$kr6$1@pegasus.csx.cam.ac.uk>
In article <787gon$fig@meow.invalid>, Fluffy <meowing@banet.net> wrote:
>Daniel Grisinger <dgris@moiraine.dimensional.com> wrote:
>> No, it's completely unreliable. use Thread; is a surefire
>> way to turn your perl interpreter into an Insta-Matic Core
>> File Generator (it slices, it dices, it makes thousands of
>> julienne silicon wafers :-).
>
>Then I'll have to tell the nntp daemon I'm reading this article through
>that it shouldn't have been running for over 2 days. It's worth noting
>that if your underlying thread library is unstable (and quite a few
>are), perl's not going to be very happy. (I've had individual threads
>in the process die, but those are problems in the INN library that I
>can reproduce in plain single-threaded C.)
There are other problems with threaded Perl which will intermittently
mangle your results without giving a core dump, if a thread switch
occurs at an inopportune time. In particular, all the regex special
variables ($1 and co) are at risk in current versions.
So Daniel is basically right. Be afraid. Be very afraid.
Mike Guy
"Testing can prove the presence of bugs, never their absence."
------------------------------
Date: Thu, 21 Jan 1999 10:49:25 -0700
From: Todd LaWall <toddl@SiTera.com>
Subject: Re: Sys::Syslog equivalent for Win32
Message-Id: <36A768A5.595735A7@SiTera.com>
You might want to look into Win32::Event.pm
HTH
Todd
"Victor A. Cuya" wrote:
>
> After going thru the documentation, it seems that this extension is
> Unix specific. Is there an equivalent for the Windows NT platform? If
> not, any ideas on a workaround to accomplish the same?
>
> Any ideas would be greatly appreciated.
>
> Victor A. Cuya
------------------------------
Date: Thu, 21 Jan 1999 13:23:52 -0500
From: "John T. Jarrett" <jjarrett@ecpi.com>
Subject: Re: test
Message-Id: <36A770B8.EA5F3FC0@ecpi.com>
Boo!
------------------------------
Date: Thu, 21 Jan 1999 10:01:12 -0800
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Y2K?
Message-Id: <MPG.11110b41d0a95f8e9899b6@nntp.hpl.hp.com>
[Posted and a courtesy copy mailed.]
In article <Un3NuHgI1diW-pn2-YtK140duKMbY@atte.dyn.icon.fi> on Thu, 21
Jan 1999 16:47:24 GMT, Tuomas Angervuori <tumppi@icon.fi> says...
> I have a script which compares two dates.
> -Clip-
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
> localtime(time);
A little neater is to save only the fields you want:
my ($mday, $mon, $year) = (localtime)[3 .. 5];
Now, assuming the data in your files are four-digit years and standard
months:
$year += 1900;
$mon++;
> #if current date is newer than the one mared in data files, update...
> if (($year == $year_data) and ($mon >= $mon_data)) {
> if ($mday > $mday_data) {
> &update;
> }
> }
> if ($year > $year_data) {
> &update;
> }
> -Clip-
That logic is faulty. If $year == $year_data and $mon > $mon_data. you
want to update even if $mday <= $mday_data.
if ($year > $year_data || $year == $year_data &&
($mon > $mon_data ||
$mon == $mon_data && $mday > $mday_data)) {
&update;
}
> $year_data, etc, are found from the data files.
>
> As you might have noticed, this isn't year 2000 compatible. The
> question is, how can I make year 2000 compatible date comparisition?
See above.
> I'm sure there is a much better way to do this but this was all I
> managed to do with my current programming skills.
The logic is much simpler if you convert the data from the data files
into seconds since the Unix Epoch. Then you can do a trivial comparison
with the result of time().
You can do that calculation in a few lines of Perl, or you can use a
function such as timelocal to do it. I can't say more, because I've not
tried any of those functions.
Here are my 'few lines of Perl', if anyone wants to see how to do it
explicitly:
my ($year, $mon, $day, $hour, $min, $sec) = (1970, 1, 1, 0, 0,0);
print
# Adapted from Astronomical Computing, Sky & Telescope, May, 1984.
24 * 60 * 60 * (367 * $year - 678972 - 40587 + int(275 * $mon / 9) +
$day - int((int(int($year + ($mon < 9 ? -1 : +1) *
int(abs($mon - 9) / 7)) / 100) + 1) * 3 / 4) -
int(7 * (int(($mon + 9) / 12) + $year) / 4)) +
60 * 60 * $hour + 60 * $min + $sec
__END__
Please don't ask me to explain it in detail! I just transliterated it
from some Fortran that I found on the web, and adjusted it from Modified
Julian Days to Unix Epoch seconds. It works, and it is fast and
lightweight.
--
(Just Another Larry) Rosler
Hewlett-Packard Company
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 12 Dec 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 Dec 98)
Message-Id: <null>
Administrivia:
Well, after 6 months, here's the answer to the quiz: what do we do about
comp.lang.perl.moderated. Answer: nothing.
]From: Russ Allbery <rra@stanford.edu>
]Date: 21 Sep 1998 19:53:43 -0700
]Subject: comp.lang.perl.moderated available via e-mail
]
]It is possible to subscribe to comp.lang.perl.moderated as a mailing list.
]To do so, send mail to majordomo@eyrie.org with "subscribe clpm" in the
]body. Majordomo will then send you instructions on how to confirm your
]subscription. This is provided as a general service for those people who
]cannot receive the newsgroup for whatever reason or who just prefer to
]receive messages via e-mail.
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 4712
**************************************