[11238] in Perl-Users-Digest
Perl-Users Digest, Issue: 4838 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 6 15:07:20 1999
Date: Sat, 6 Feb 99 12:00:17 -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 Sat, 6 Feb 1999 Volume: 8 Number: 4838
Today's topics:
Re: @INC usage (Bart Lateur)
Re: @INC usage <dgris@moiraine.dimensional.com>
a perl/cgi language reference? (BLUESRIFT)
Re: a perl/cgi language reference? <jeffp@crusoe.net>
Re: ActivePerl on NT- HELP! (Bbirthisel)
Re: Catching undefined symbols in subs (Jack Applin)
Re: Catching undefined symbols in subs (M.J.T. Guy)
Re: Checking links <debot@xs4all.nl>
Help me ===> How to print certain line on DB at certain <factory@factory.co.kr>
Re: How do I get local IP Address ? (M.J.T. Guy)
Re: how to query errno.h info (M.J.T. Guy)
Re: how to query errno.h info <bmb@ginger.libs.uga.edu>
Re: Performance Statistics <wiersdor@cs.byu.edu>
Re: Perl 4.0.1.7 Y2K compliancy (Bbirthisel)
Re: Perl Criticism (Eric Junkermann)
Re: Program needs compactification (Peter J. Kernan)
Re: Program needs compactification <jdf@pobox.com>
Re: Program needs compactification (M.J.T. Guy)
submit information with #exec cgi="/cgi-local/businessn <bencas@bigfoot.com>
Re: submit information with #exec cgi="/cgi-local/busin <bencas@bigfoot.com>
Re: submit information with #exec cgi="/cgi-local/busin <bencas@bigfoot.com>
Re: submit information with #exec cgi="/cgi-local/busin <flavell@mail.cern.ch>
Re: Syntax checking without "perl -c"? (M.J.T. Guy)
Re: The order of form fields that recieve by cgi progra ptimmins@netserv.unmc.edu
Re: The order of form fields that recieve by cgi progra <flavell@mail.cern.ch>
Re: What's happening with this hash? (M.J.T. Guy)
Re: What's happening with this hash? (John Moreno)
Special: Digest Administrivia (Last modified: 12 Dec 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 06 Feb 1999 14:43:12 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: @INC usage
Message-Id: <36bc528b.498334@news.skynet.be>
Jonathan Feinberg wrote:
>> I want to use Date::Calc but it is not part of our standard library.
>> How do I go about setting up my own library?
>
>This is a FAQ. perlfaq8, "How do I keep my own module/library
>directory?"
Which reminds me: soem newer Perls include a "site" directory, which IS
in @INC. I haven't seen official confirmation on this, but... isn't this
intended to be used as "your personal lib folder"? If not, what's it
for?
Bart.
------------------------------
Date: 06 Feb 1999 11:42:44 -0700
From: Daniel Grisinger <dgris@moiraine.dimensional.com>
Subject: Re: @INC usage
Message-Id: <m3r9s3xtjv.fsf@moiraine.dimensional.com>
bart.lateur@skynet.be (Bart Lateur) writes:
> Which reminds me: soem newer Perls include a "site" directory, which IS
> in @INC. I haven't seen official confirmation on this, but... isn't this
> intended to be used as "your personal lib folder"? If not, what's it
> for?
site_perl is for locally installed modules. Its use is similar to
/usr/local/ on most unix boxen.
dgris
--
Daniel Grisinger dgris@moiraine.dimensional.com
perl -Mre=eval -e'$_=shift;;@[=split//;;$,=qq;\n;;;print
m;(.{$-}(?{$-++}));,q;;while$-<=@[;;' 'Just Another Perl Hacker'
------------------------------
Date: 6 Feb 1999 18:17:41 GMT
From: bluesrift@aol.com (BLUESRIFT)
Subject: a perl/cgi language reference?
Message-Id: <19990206131741.28437.00000538@ng94.aol.com>
I am only beginning to understand the relationship between CGI and Perl. For
now I only want to fiddle with a website statistics logger/viewer script that I
have downloaded and installed from a free perl scripts site. I have every
reason to believe it is written in a version of the Perl language as the
scripts point to where Perl is located on my server and the scripts work, so
far :). I am very familiar with client side JavaScript, and can guess to a
certain degree what is going on in this perl (or is it technically a CGI?)
script. I am here to request a link which might point to a downloadable
language reference such as that which Netscape has created for each version of
JavaScript. From such a reference I believe I can solve my own little problems
without bothering anyone here. In return for your trouble, I will gladly help
anyone here who may need help with client side JavaScript.
Thank you, Rob
------------------------------
Date: Sat, 6 Feb 1999 14:21:31 -0500
From: evil Japh <jeffp@crusoe.net>
Subject: Re: a perl/cgi language reference?
Message-Id: <Pine.GSO.3.96.990206135934.20443B-100000@crusoe.crusoe.net>
> I am only beginning to understand the relationship between CGI and
> Perl.
We shall see.
> I am very familiar with client side JavaScript, and can guess to a
> certain degree what is going on in this perl (or is it technically a
> CGI?) script.
Quite truthfully, there is one CGI, as CGI stands for Common Gatewat
Interface. There is only one CGI, because the CGI is an interface, a
method. "Developing a CGI" is a phrase which I cannot stand. Be sure you
don't use it. :)
As for a reference, go to reference.perl.com
--
Jeff Pinyan (jeffp@crusoe.net)
www.crusoe.net/~jeffp
Crusoe Communications, Inc.
973-882-1022
www.crusoe.net
------------------------------
Date: 6 Feb 1999 17:57:03 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: ActivePerl on NT- HELP!
Message-Id: <19990206125703.06157.00000533@ng137.aol.com>
Hi Sugus:
>I've installed the ActiveState Perl Distribution of Perl for WinNT and
>everything was fine.
>The example.pl run.
>That was two days ago. Doing the same now, I get the alert:
>Dynamic Link Library PerlCRT.dll was not found in the path
>D:\perl\bin;.;D:\WINNT\Sytem32;.......
>(translated, as I've got a german NT-System).
>What happened? What's wrong? And most importend: how can I get
> perl running again?
Your path is not correct. Probably not a Perl problem at all.
>There is no way to install it again as installation is aborted every time.
>Neither it can be deinstalled. Or can it?
Yes, from the Control Panel.
>Sorry for my stupid asking (I'm not an NT-Expert...),
Hmm. I'm half a world away and don't have a German NT
that I could use to describe screen details.
You don't need a real NT-Expert. Just someone local who
knows basic system administration. This is all standard NT
setup stuff.
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: 6 Feb 1999 17:05:14 GMT
From: neutron@fc.hp.com (Jack Applin)
Subject: Re: Catching undefined symbols in subs
Message-Id: <79hsoa$rgq$1@fcnews.fc.hp.com>
Martien Verbruggen wrote:
> You can't at compile time, because a subroutine can be defined at run
> time. Witness:
Bill Moseley (moseley@best.com) wrote:
> So there's no way to catch typos without actually running the code?
> I write a lot of code that never gets executed unless really odd things
> are happening -- like a relational data relation that isn't what I
> expect. Whew, that's a lot of breaking and testing, just to see if I've
> made a typo in a subroutine name.
Martien is of course correct--the routine might be defined dynamically.
I share Bill's distress, though. I almost never define routines dynamically,
and I want protection against typos. Perhaps another "use strict" argument?
use strict 'vars';
require that all variables be declared explicitly
use strict 'static-subs';
require that all subs be defined at compile-time
Certainly, "static-subs" is a lousy name, but "subs" is already taken.
-Jack Applin
neutron@fc.hp.com
------------------------------
Date: 6 Feb 1999 17:17:29 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Catching undefined symbols in subs
Message-Id: <79htf9$c7b$1@pegasus.csx.cam.ac.uk>
In article <79hsoa$rgq$1@fcnews.fc.hp.com>,
Jack Applin <neutron@fc.hp.com> wrote:
>
>Martien is of course correct--the routine might be defined dynamically.
>I share Bill's distress, though. I almost never define routines dynamically,
>and I want protection against typos. Perhaps another "use strict" argument?
You *can* get that protection, provided you never put brackets round
your subroutine arguments:
% perl -w
use strict;
junk(1,2,3);
junk 1,2,3;
Bareword "junk" not allowed while "strict subs" in use at - line 3.
Unquoted string "junk" may clash with future reserved word at - line 3.
Number found where operator expected at - line 3, near "junk 1"
(Do you need to predeclare junk?)
Mike Guy
------------------------------
Date: Sat, 06 Feb 1999 19:00:34 +0100
From: Frank de Bot <debot@xs4all.nl>
Subject: Re: Checking links
Message-Id: <36BC8341.7C91CB6D@xs4all.nl>
I know a good page where you can find a script:
http://fscripts.hypermart.net/
Gala Grant wrote:
> I am trying to figure out how to use Perl to check links over the internet
> without actually going to the site. Can anyone help me out with any clues
> as to how to do this?
> Thanks,
> Gala Grant
------------------------------
Date: Sun, 7 Feb 1999 00:36:58 +0900
From: "Yeong Mo/Director Hana co." <factory@factory.co.kr>
Subject: Help me ===> How to print certain line on DB at certain html file
Message-Id: <79hn4c$gik$1@news.kornet.nm.kr>
Hi
The question is How to print the certain line on DB to certain html file.
# 1. There are saved 4 of values at data.txt file as follows,
open (FILE, ">>$data_dir/data.txt") || die "I can't open data.txt for
building new page\n";
flock (FILE, 2) or die "can't lock data file\n";
print FILE "$login&&$email&&$pagename&&$categorys&&$maintitle\n";
close(FILE);
# 2. $categorys at the above can be same according to users like bellow.
"$login&&$email&&$pagename&&$categorys&&$maintitle
----------------------------------------------------
101&&user@user1.com&&page01&&aaaa&&maintitle01 #
102&&user@user2.com&&page01&&aaaa&&maintitle01 #
103&&user@user3.com&&page02&&abcd&&maintitle02
104&&user@user4.com&&page02&&aaaa&&maintitle03 #
105&&user@user3.com&&page03&&cbcb&&maintitle04
# 3. How to print the lines "$categorys"= "aaaa" to html file ?????
# 4. The printed sort should be $maintitle, $categorys, $pagename at a html
file like bellow.
maintitle01--------aaaa----------page01
maintitle01--------aaaa----------page01
maintitle03--------aaaa----------page02
# 5. $category=aaaa means ====> a directory name which is "aaaa",
and the lines include "aaaa" on db should be printed at a index.html file
located on "aaaa" directory.
$categorys=abcd on db, the lines should be printed to abcd/index.html file.
Let me know also how to handle this??????
thank you
------------------------------
Date: 6 Feb 1999 16:23:22 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: How do I get local IP Address ?
Message-Id: <79hq9q$92j$1@pegasus.csx.cam.ac.uk>
<darylh@trendwestresorts.com> wrote:
>I have a program that uses sockets, but in order to open the socket my
>program needs to know the IP Address of the machine it is running on.
Er, why? Usually your own IP address is filled in automatically by
the lower protocol layers. You only have to provide the remote
address.
And in any case, "the IP Address of the machine it is running on" isn't
in general well defined. If a machine has multiple interfaces, the
IP address to be used may depend on the particular interface.
Mike Guy
------------------------------
Date: 6 Feb 1999 16:04:06 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: how to query errno.h info
Message-Id: <79hp5m$838$1@pegasus.csx.cam.ac.uk>
In article <Pine.A41.4.02.9902051215080.56626-100000@ginger.libs.uga.edu>,
Brad Baxter <bmb@ginger.libs.uga.edu> wrote:
>The following code snippet creates empty files named 'x1', 'x2', etc.
>
>#!/usr/local/bin/perl -w
>use strict;
>use Fcntl;
>local *BAK;
>
>for( my $serial = 0;; ) {
> last if sysopen( BAK, "x".++$serial, O_WRONLY|O_EXCL|O_CREAT );
> #die $! unless $! eq 'File exists'; ### other error
> die $! unless $! == 17; ### other error
> die "Infinite loop" if $serial > 10; ### last resort
>}
>
>My question is this: how can I be sure that '17' is the correct code for
>the 'File exists' error?
use Errno;
Errno.pm comes with the standard distribution in perl5.005 and later;
if you have an older Perl, you'll need to get it from CPAN.
Mike Guy
------------------------------
Date: Sat, 6 Feb 1999 11:31:46 -0500
From: Brad Baxter <bmb@ginger.libs.uga.edu>
To: "M.J.T. Guy" <mjtg@cus.cam.ac.uk>
Subject: Re: how to query errno.h info
Message-Id: <Pine.A41.4.02.9902061128480.50306-100000@ginger.libs.uga.edu>
Still wiping egg off my face ...
Obviously I'm woefully behind the times and didn't try hard enough
searching CPAN. Many thanks!
-Brad
On 6 Feb 1999, M.J.T. Guy wrote:
> use Errno;
>
> Errno.pm comes with the standard distribution in perl5.005 and later;
> if you have an older Perl, you'll need to get it from CPAN.
------------------------------
Date: Sat, 06 Feb 1999 11:48:10 -0700
From: Scott Wiersdorf <wiersdor@cs.byu.edu>
To: Monty Scroggins <Monty.Scroggins@mci.com>
Subject: Re: Performance Statistics
Message-Id: <36BC8E6A.731CA902@cs.byu.edu>
Monty Scroggins wrote:
> Does anybody have any statistics regarding the
> performance of Perl versus shells and C ??
>
> There is a study being done here at work as to which language
> is to be used for some of our utilities, and there is a
> resistance by the group to use any scripted language.
>
> I wanted to see if I could get some statistics to
> possibly convince the group that Perl might be the
> best way to go..
Try:
http://www.cs.bell-labs.com/cm/cs/who/bwk/interps/pap.html
I found this the other day...
Scott Wiersdorf
------------------------------
Date: 6 Feb 1999 18:04:35 GMT
From: bbirthisel@aol.com (Bbirthisel)
Subject: Re: Perl 4.0.1.7 Y2K compliancy
Message-Id: <19990206130435.06157.00000535@ng137.aol.com>
Hi James:
>If you found
>out that Perl 4 wasn't y2k compliant, would >you then upgrade to Perl 5?
The frightening thing is there are still
"system administrators" out there that
would actually answer, "Yes".
-bill
Making computers work in Manufacturing for over 25 years (inquiries welcome)
------------------------------
Date: Sat, 06 Feb 1999 17:35:57 GMT
From: eric@deptj.demon.co.uk (Eric Junkermann)
Subject: Re: Perl Criticism
Message-Id: <36ba0315.5165893@news.demon.co.uk>
On Mon, 25 Jan 1999 03:36:07 GMT, topmind@technologist.com wrote:
<snip>
>But, at least you are focusing on ideas instead of
>witchhunts and background checks. Kudos to you for that.
I don't like witch hunts either but I can't see any here.
However, I think that background is important. Here is someone who gives
themselves a self-congratulatory nickname and argues with, according to the
many detractors, a noticeable lack of hard evidence. Opinions without much
evidence only carry weight if they are backed by a suitable depth of
experience. So, topmind, what relevant experience do you have?
I could ask specific questions, but I think we are already far enough off
topic.
If you want to convince people here, you need to promote your credibility -
how about it?
Regards,
Eric
--
Just Another Perl Newbie
------------------------------
Date: 6 Feb 1999 15:43:12 GMT
From: pete@tier254384.TIER2.CWRU.Edu (Peter J. Kernan)
Subject: Re: Program needs compactification
Message-Id: <79hnug$pd8$1@pale-rider.INS.CWRU.Edu>
In article <m3yambejop.fsf@joshua.panix.com>,
Jonathan Feinberg <jdf@pobox.com> writes:
> pjk6@po.cwru.edu (Peter J. Kernan) writes:
>
>> The following version preserves the original spirit and avoids the
>> most serious problem.
>
>> #!/usr/bin/perl -0anl012
>> print for sort keys%{{@F,,@F}}
>
> Unless you consider the most serious problem to be that it simply
> doesn't work for %50 of all possible inputs.
>
Such as? An example of an input for which it fails would be
appreciated. That latter version, to me, seems to work.
Also, if what you imply were true, then you should have said, it
succeeds for at least 50% of all possible inputs. If you took my
original program, and ran against a text wherein every unique word was
repeated in at least an "odd" and "even" position, then it finds 100% of
the unique words for that text. If you give it a text which already
consists of unique words (the worst case scenario), it finds 50% of the
unique words. But when you speak of all possible inputs, here you
overextend yourself, for all possible inputs includes all infinitely
long possible texts (of which there are an infinite number), and for
which it finds 100% of the unique words in the limit of approaching
that infinity (terminating of course). Therefore it succeeds for
100 - epsilon % of all possible inputs. However I do not see how the
present version suffers from the epsilon deficiency.
Pete
--
the readiness is all --Hamlet
------------------------------
Date: 06 Feb 1999 17:44:12 +0100
From: Jonathan Feinberg <jdf@pobox.com>
To: pete@theory2.phys.cwru.edu
Subject: Re: Program needs compactification
Message-Id: <m3pv7neb37.fsf@joshua.panix.com>
pete@tier254384.TIER2.CWRU.Edu (Peter J. Kernan) writes:
> Jonathan Feinberg <jdf@pobox.com> writes:
> > pjk6@po.cwru.edu (Peter J. Kernan) writes:
> >
> >> The following version preserves the original spirit and avoids the
> >> most serious problem.
> >
> >> #!/usr/bin/perl -0anl012
> >> print for sort keys%{{@F,,@F}}
> >
> > Unless you consider the most serious problem to be that it simply
> > doesn't work for %50 of all possible inputs.
> >
> Such as? An example of an input for which it fails would be
> appreciated. That latter version, to me, seems to work.
Okay:
--------begin input------------
a
b
--------end input--------------
> Also, if what you imply were true, then you should have said, it
> succeeds for at least 50% of all possible inputs.
No. If what I said were true, then it would succeed for exactly %50
of all inputs. But you're right, in that I overstated my case.
> If you took my original program, and ran against a text wherein
> every unique word was repeated in at least an "odd" and "even"
> position, then it finds 100% of the unique words for that text.
Great! That's a different problem than the one you said your program
solves, to wit:
"This program prints the unique words in a file, one per-line. "
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
http://pobox.com/~jdf
------------------------------
Date: 6 Feb 1999 16:48:20 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Program needs compactification
Message-Id: <79hrok$ajh$1@pegasus.csx.cam.ac.uk>
Peter J. Kernan <pete@theory2.phys.cwru.edu> wrote:
>In article <m3yambejop.fsf@joshua.panix.com>,
> Jonathan Feinberg <jdf@pobox.com> writes:
>> Unless you consider the most serious problem to be that it simply
>> doesn't work for %50 of all possible inputs.
>>
>Such as? An example of an input for which it fails would be
>appreciated. That latter version, to me, seems to work.
It will lose half the words if there are an even number of words present.
I suspect you don't understand that [@F,,@F] is the same as [@F,@F].
As others have requested, please test your code before posting.
Mike Guy
------------------------------
Date: Sat, 6 Feb 1999 17:12:14 -0000
From: "el_pollo_diablo" <bencas@bigfoot.com>
Subject: submit information with #exec cgi="/cgi-local/businessnewsup.pl" command?
Message-Id: <79htea$kpe$1@news8.svr.pol.co.uk>
I am using a perl script that outputs information from a database to html.
In order to print the database information I'm executing the following line
in the html file:
#exec cgi="/cgi-local/businessnewsup.pl"
However my problem is this:
The script needs to know what directory to look in in order to access the
database. I cant store the directory information in the perl script because
I'm potentially going to have hundreds of databases running from this one
script.
So in total I'm looking for a way to supply three parameters to the script.
Any help would be greatly appreciated!
Regards,
--
Peace, Empathy, Desire, Mischeif and Gladness.
Ben
------------------------------
Date: Sat, 6 Feb 1999 18:06:08 -0000
From: "el_pollo_diablo" <bencas@bigfoot.com>
Subject: Re: submit information with #exec cgi="/cgi-local/businessnewsup.pl" command?
Message-Id: <79i0cq$keb$1@news7.svr.pol.co.uk>
I need to pass in 3 variables so something like this might be used from what
I can see:
--
Peace, Empathy, Desire, Mischeif and Gladness.
Ben
el_pollo_diablo <bencas@bigfoot.com> wrote in message
news:79htea$kpe$1@news8.svr.pol.co.uk...
>I am using a perl script that outputs information from a database to html.
>
>In order to print the database information I'm executing the following line
>in the html file:
>
>#exec cgi="/cgi-local/businessnewsup.pl"
>
>However my problem is this:
>
>The script needs to know what directory to look in in order to access the
>database. I cant store the directory information in the perl script because
>I'm potentially going to have hundreds of databases running from this one
>script.
>
>So in total I'm looking for a way to supply three parameters to the script.
>
>Any help would be greatly appreciated!
>
>Regards,
>
>--
>
>Peace, Empathy, Desire, Mischeif and Gladness.
>Ben
>
>
------------------------------
Date: Sat, 6 Feb 1999 18:07:21 -0000
From: "el_pollo_diablo" <bencas@bigfoot.com>
Subject: Re: submit information with #exec cgi="/cgi-local/businessnewsup.pl" command?
Message-Id: <79i0f3$kg4$1@news7.svr.pol.co.uk>
Something like this:
#exec cgi="/cgi-local/businessnewsup.pl $county='devon' $town='plymouth"
$business='example'"
But then how do i catch these variables in my newsup script?
--
Peace, Empathy, Desire, Mischeif and Gladness.
Ben
el_pollo_diablo <bencas@bigfoot.com> wrote in message
news:79htea$kpe$1@news8.svr.pol.co.uk...
>I am using a perl script that outputs information from a database to html.
>
>In order to print the database information I'm executing the following line
>in the html file:
>
>#exec cgi="/cgi-local/businessnewsup.pl"
>
>However my problem is this:
>
>The script needs to know what directory to look in in order to access the
>database. I cant store the directory information in the perl script because
>I'm potentially going to have hundreds of databases running from this one
>script.
>
>So in total I'm looking for a way to supply three parameters to the script.
>
>Any help would be greatly appreciated!
>
>Regards,
>
>--
>
>Peace, Empathy, Desire, Mischeif and Gladness.
>Ben
>
>
------------------------------
Date: Sat, 6 Feb 1999 19:24:47 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: submit information with #exec cgi="/cgi-local/businessnewsup.pl" command?
Message-Id: <Pine.HPP.3.95a.990206191418.14937F-100000@hpplus01.cern.ch>
On Sat, 6 Feb 1999, el_pollo_diablo wrote:
> #exec cgi="/cgi-local/businessnewsup.pl"
..
> So in total I'm looking for a way to supply three parameters to the script.
Have you considered reading the instructions for the server that you
use?
For Apache, this would seem rather relevant:
http://www.apache.org/docs/mod/mod_include.html
just where it documents #exec cgi
If you're going to have your script rely critically on something that
it's going to get fed from a URI reference, then you'd be recommended to
carefully read the CGI security FAQ, with particular reference to the
possibilities for an intruder to feed it bogus paths and access various
parts of your server's file system.
I didn't see anything in your posting which was specific to the Perl
language. You might want to choose an appropriate group to pursue your
study of this issue.
------------------------------
Date: 6 Feb 1999 15:55:28 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: Syntax checking without "perl -c"?
Message-Id: <79holg$7ph$1@pegasus.csx.cam.ac.uk>
In article <ltemo4oobz.fsf@asfast.com>, Lloyd Zusman <ljz@asfast.com> wrote:
>I'm writing an application in Perl that interprets text that, among
>other things, contains embedded Perl (and no, this is *not* dynamic
>HTML, XML, or anything like that). Also, for various reasons that I
>won't go into here, I don't want to use `eperl'.
>
>Anyway, I can easily parse the text into Perl/non-Perl sections, and
>once I have a piece of Perl code, I'd like to do a syntax check to see
>if it is valid Perl ... I'd like to do the exact, same checking that
>"perl -c" does. Furthermore, I don't want to eval this code at this
>time, because it might produce unwanted side-effects. And finally, I
>know I could pipe each fragment through "perl -c", but I'm trying to
>avoid the extra process invocations that this approach would entail.
>
>So ... I'm wondering: is there any way within Perl that I could check
>pieces of Perl code for valid syntax, given the preferences and
>requirements I outlined above?
How about
eval "die 'Compiled OK\n'; $code";
if ($@ eq "Compiled OK\n") { we are happy };
That'll get caught by BEGIN or use, of course. And you may want to trap
warnings with $SIG{__WARN__}.
Or alternatively, evaluate to a subroutine. That way, you wont need
to compile again when you actually use the value:
my $sub = eval "sub { $code }";
Same caveats as above, and also it could be tricked by };{ .
Mike Guy
------------------------------
Date: Sat, 06 Feb 1999 15:59:17 GMT
From: ptimmins@netserv.unmc.edu
Subject: Re: The order of form fields that recieve by cgi program
Message-Id: <79hosh$2q6$1@nnrp1.dejanews.com>
In article <79h3rt$jsl$1@nnrp1.dejanews.com>,
fanxin@mailcity.com wrote:
> Hi,there:
> does here any experts know how to know the original order of html form
> fields in the submitted html form after these data has been splitted to
> an associated arrary in perl cgi program?
Shouldn't you know the order in which the fields appear on your own forms?
If this is important to you, then why don't you just create an array
(@field_order, for example) that stores this information?
Patrick Timmins
$monger{Omaha}[0]
-----------== Posted via Deja News, The Discussion Network ==----------
http://www.dejanews.com/ Search, Read, Discuss, or Start Your Own
------------------------------
Date: Sat, 6 Feb 1999 17:26:18 +0100
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: The order of form fields that recieve by cgi program
Message-Id: <Pine.HPP.3.95a.990206171319.14937D-100000@hpplus01.cern.ch>
On Sat, 6 Feb 1999 ptimmins@netserv.unmc.edu wrote:
> > does here any experts know how to know the original order of html form
> > fields in the submitted html form after these data has been splitted to
> > an associated arrary in perl cgi program?
I don't recall the HTML 4.0 spec offering any guarantee that "successful
controls" (as it terms them) will be submitted in the order that they
appeared in the original HTML, and there doesn't seem to be any
particular benefit in making that assumption.
Anyway, who guarantees any particular order in an "associative array"?
(nowadays usually called a "hash" for brevity). "The elements of a hash
have no particular order", it says in a book that, as a Perl programmer,
you surely have within reach.
> If this is important to you, then why don't you just create an array
> (@field_order, for example) that stores this information?
I've no argument with that suggestion, if the questioner really does
need a specific order.
------------------------------
Date: 6 Feb 1999 16:35:08 GMT
From: mjtg@cus.cam.ac.uk (M.J.T. Guy)
Subject: Re: What's happening with this hash?
Message-Id: <79hqvs$9rp$1@pegasus.csx.cam.ac.uk>
John Moreno <phenix@interpath.com> wrote:
>
>So, what I was trying to do should have been $$hash{$i}{'test'}++.
No. First, that dereferences $hash rather than $hash{$i}. You'd
want ${$hash{$i}}{'test'}++. But that's exactly the same as
$hash{$i}->{'test'}++
which can be abbreviated to
$hash{$i}{'test'}++
which is what you started with.
Your problem is elsewhere. You want $hash{$i} to be a hash reference,
but you initialise it with
$hash{$i}++
which sets it to the number 1 instead - hardly very useful.
Instead, initialise with a hash reference:
$hash{$i} = {};
Or don't bother to initialise it at all; then Perl will initialise it
automatically (autovivify) when you use it in
$hash{$i}{'test'}++;
Mike Guy
------------------------------
Date: Sat, 6 Feb 1999 13:39:04 -0500
From: phenix@interpath.com (John Moreno)
Subject: Re: What's happening with this hash?
Message-Id: <1dmt3d0.136r8xi13p09hkN@roxboro0-053.dyn.interpath.net>
M.J.T. Guy <mjtg@cus.cam.ac.uk> wrote:
> John Moreno <phenix@interpath.com> wrote:
> >
> >So, what I was trying to do should have been $$hash{$i}{'test'}++.
>
> No. First, that dereferences $hash rather than $hash{$i}. You'd
> want ${$hash{$i}}{'test'}++. But that's exactly the same as
>
> $hash{$i}->{'test'}++
>
> which can be abbreviated to
>
> $hash{$i}{'test'}++
>
> which is what you started with.
What can I say, I tested it and it works. So either you've made a
mistake or someone has finally added a true DWIM module to perl.
> Your problem is elsewhere. You want $hash{$i} to be a hash reference,
> but you initialise it with
No, I want $hash{$i} to be a counter for something, and I want
$$hash{$i}{'test'} to be a counter for something that happens to it.
Like so:
$fruit{'apples'}++;
$$fruit{'apples'}{'bad'}++;
$fruit{'oranges'}++;
$$fruit{'oranges'}{'bad'}++;
I'm not *quite sure why this works, but it does (and I suspect that it's
not the most memory friendly way of doing it, but I have a very small
data set so I don't particularly care about that).
*I think it's giving me a hash with the name of the key, which is what I
thought I was doing in the first place.
--
John Moreno
------------------------------
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 4838
**************************************