[12873] in Perl-Users-Digest
Perl-Users Digest, Issue: 284 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Jul 28 13:17:32 1999
Date: Wed, 28 Jul 1999 10:10:16 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 28 Jul 1999 Volume: 9 Number: 284
Today's topics:
more than one submit button boris_bass@my-deja.com
Re: more than one submit button (Mike Bristow)
Re: Newbie Q: Replacing a string by an array (Larry Rosler)
Re: Newbie Q: Replacing a string by an array <andrewf@beausys.demon.co.uk>
Re: Newbie Q: Replacing a string by an array (Eugene van der Pijll)
Re: Pass by value or pass by reference? <c8133594@comp.polyu.edu.hk>
Re: Pass by value or pass by reference? <uri@sysarch.com>
Passing an Array into a HIDDEN FIELD <p.lam@altavista.net>
Re: Perl Anonymity Question (gulp!) <SimsiREMOVETHISBIT@hotmail.com>
Perl installation make test failed on Solaris (Benoit Beausejour)
Re: Premature end of script headers??? (I R A Darth Aggie)
Re: Problem with spam in this group (llornkcor@earthlink.net)
Re: Selecting files by permisions (Greg Bacon)
Re: Selecting files by permisions <leejk@cat.com>
Re: Selecting files by permisions <uri@sysarch.com>
Re: Trouble with sort mike_lottridge@mentorg.com
Using perl CGI under NT <georgec@webleicester.co.uk>
Re: Which group is appropriate? <lsilver@ibm.net>
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 28 Jul 1999 15:55:10 GMT
From: boris_bass@my-deja.com
Subject: more than one submit button
Message-Id: <7nn94r$2gm$1@nnrp1.deja.com>
Subject: more than one submit button
i saw pages with more than one submit button, but i am wondering how's
that accomplished. The script is specified within the <Form> tag, e.g.
<form action="myscript.cgi">
so what if i want to have "submit1" and "submit2" buttons call
"myscript1.cgi" and "myscript2.cgi" respectively? Any suggesions
appriciated.
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 28 Jul 1999 16:31:57 GMT
From: mike@fat.dotat.at (Mike Bristow)
Subject: Re: more than one submit button
Message-Id: <slrn7puc3t.4av.mike@lindt.fat.dotat.at>
On Wed, 28 Jul 1999 boris_bass@my-deja.com <boris_bass@my-deja.com> wrote:
>i saw pages with more than one submit button, but i am wondering how's
>that accomplished. The script is specified within the <Form> tag, e.g.
><form action="myscript.cgi">
This has nothing to do with perl; go ask in a group where
the HTML/CGI experts lurk:
comp.infosystems.www.authoring.html
and
comp.infosystems.www.authoring.cgi
would probably be good places.
I strongly advise you to read a chunk of the group, and
the FAQs, first.
Mike, about to killfile From:.*@my-deja.com
--
Mike Bristow, Geek-At-Large. GK/RT0038
one tequila - two tequila - three tequila - FLOOR !!!
------------------------------
Date: Wed, 28 Jul 1999 08:33:17 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Newbie Q: Replacing a string by an array
Message-Id: <MPG.1208c293f3f19f27989d5f@nntp.hpl.hp.com>
In article <pijll.933164100@ruunat.phys.uu.nl> on 28 Jul 99 12:15:00
GMT, Eugene van der Pijll <pijll@phys.uu.nl> says...
> In <kCkLqCAxIun3Ew5R@beausys.demon.co.uk> Andrew Fry
> > <andrewf@beausys.demon.co.uk> writes:
> > >However, when I find the line and do the replacement, using a
> >statement of the form s/$tag/@B/, and then print the new
> >(modified) array A, it appears that each line in array B of the
> >form xxx\n comes out as xxx\n FOLLOWED BY A SPACE.
> >Why is this, and how can I get rid of this extra space ?
>
> Try setting $" to undef. See perlvar for details.
Only if you like warnings from '-w' for no reason. Set $" to the null
string "".
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Wed, 28 Jul 1999 15:46:16 +0100
From: Andrew Fry <andrewf@beausys.demon.co.uk>
Subject: Re: Newbie Q: Replacing a string by an array
Message-Id: <yNG+JCA4exn3EwKc@beausys.demon.co.uk>
In article <MPG.1209aa7e1cc23fe7989b9a@news-server>, elephant <e-
lephant@b-igpond.com> writes
>Andrew Fry writes ..
>>However, when I find the line and do the replacement, using a
>>statement of the form s/$tag/@B/, and then print the new
>>(modified) array A, it appears that each line in array B of the
>>form xxx\n comes out as xxx\n FOLLOWED BY A SPACE.
>>Why is this, and how can I get rid of this extra space ?
>>
>> $a[$i] =~ s/fleece/@b/;
>
>a substitution string is treated like a double quoted string .. array
>variables when interpolated into a double quoted string have their
>elements joined using the value of $" .. this is space by default
>
> perldoc perldata
>
>and
>
> perldoc perlvar
>
Well, you learn something every day! Thanks, guys!
---
Andrew Fry
"Time flies like an arrow. Fruit flies like a banana". (Groucho Marx).
------------------------------
Date: 28 Jul 99 16:53:11 GMT
From: pijll@phys.uu.nl (Eugene van der Pijll)
Subject: Re: Newbie Q: Replacing a string by an array
Message-Id: <pijll.933180791@ruunat.phys.uu.nl>
In <MPG.1208c293f3f19f27989d5f@nntp.hpl.hp.com> lr@hpl.hp.com (Larry Rosler) writes:
>In article <pijll.933164100@ruunat.phys.uu.nl> on 28 Jul 99 12:15:00
>GMT, Eugene van der Pijll <pijll@phys.uu.nl> says...
>> Try setting $" to undef. See perlvar for details.
>Only if you like warnings from '-w' for no reason. Set $" to the null
>string "".
Oops... Sorry. In the future, I will test all of my code, even the
simplest and shortest, with -w. Promise.
--
\
Eugene van der Pijll : pijll@phys.uu.nl
--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--=--
------------------------------
Date: Thu, 29 Jul 1999 00:17:45 +0800
From: Carfield Yim <c8133594@comp.polyu.edu.hk>
Subject: Re: Pass by value or pass by reference?
Message-Id: <379F2D29.9CCB1423@comp.polyu.edu.hk>
I man using win32_perl, how can I do?
Abigail wrote:
> Carfield Yim (c8133594@comp.polyu.edu.hk) wrote on MMCLVII September
> MCMXCIII in <URL:news:7nlo07$2l5$1@nnrp1.deja.com>:
> ,, Thank for reply!!
> ,,
> ,, I know that perldoc is a great reference, but I don't know how to find
> ,, the information I want, e.g.: If I want to find information about
> ,, [return], How do I know perlfunc contain information of it?
> ,, The only way is asking people at web? I think there should have some
> ,, document can help me.
>
> But there is. There's 'man perltoc'. Granted, it's not as good as a
> full blown index, but you could always use 'grep'.
>
> ,, I think that the main problem is I don't know most of the perl index
> ,, definition.
>
> That's why there are 'man perl' and 'man perltoc'.
>
> Abigail
> --
> perl -MTime::JulianDay -lwe'@r=reverse(M=>(0)x99=>CM=>(0)x399=>D=>(0)x99=>CD=>(
> 0)x299=>C=>(0)x9=>XC=>(0)x39=>L=>(0)x9=>XL=>(0)x29=>X=>IX=>0=>0=>0=>V=>IV=>0=>0
> =>I=>$r=-2449231+gm_julian_day+time);do{until($r<$#r){$_.=$r[$#r];$r-=$#r}for(;
> !$r[--$#r];){}}while$r;$,="\x20";print+$_=>September=>MCMXCIII=>()'
>
> -----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
> http://www.newsfeeds.com The Largest Usenet Servers in the World!
> ------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 28 Jul 1999 12:47:49 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Pass by value or pass by reference?
Message-Id: <x7iu74soui.fsf@home.sysarch.com>
>>>>> "A" == Abigail <abigail@delanet.com> writes:
A> Uri Guttman (uri@sysarch.com) wrote on MMCLVII September MCMXCIII in
A> <URL:news:x73dy9tfdc.fsf@home.sysarch.com>:
A> ..
A> .. in any case, passing in an array and processing its elements by
A> .. reference to modify them is usually not clear code and is probably
A> .. better done by passing in a ref to the array and then modifying the
A> .. elements.
A> Why not? People do it with foreach() all the time. Why would be doing
A> that in foreach() be clear code, but not when it's a sub?
A> Besides, how else is one going to make a sub similar to chop()?
use prototypes?
<no tom!! not the axe!!!!! aaaaaaaaauuugggghhhhhh!!!>
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Thu, 29 Jul 1999 03:19:03 GMT
From: Patrick Lam <p.lam@altavista.net>
Subject: Passing an Array into a HIDDEN FIELD
Message-Id: <379FC827.8ABB17B9@altavista.net>
I am trying to store the contents of a list-box. What I tried to
experiment with was to store the elements of the array in a hidden
field.
Looking at the CGI page at http://stein.cshl.org/WWW/software/CGI/, I
tried something like:
print $cgi->hidden(-name=>'theList' -default=>@theArray),
where the array contains the elements I wish to store.
However, when I subsequently wanted to retrieve the elements using
something like:
@theElems= $cgi->param('theList');
only the fist element in the original list get restored.
How could I cure this prob??
------------------------------
Date: Wed, 28 Jul 1999 17:56:12 +0100
From: "Simmo" <SimsiREMOVETHISBIT@hotmail.com>
Subject: Re: Perl Anonymity Question (gulp!)
Message-Id: <NEGn3.38$zV1.3387@news.enterprise.net>
>You could spoof any IP
>address, but if you expect a reponse, and if you want the transactions
>to complete, you can't use spoofing.
It's for stress testing so i dont need responses back - sounds like
spoofing may be what i need but how do you achieve that?
>
>TCP/IP was designed for reliability, not for marketing.
Thats ok - its not the purpose of the project
>>
>Martien
>--
>Martien Verbruggen |
>Interactive Media Division | You can't have everything, where
would
>Commercial Dynamics Pty. Ltd. | you put it?
>NSW, Australia |
------------------------------
Date: Wed, 28 Jul 1999 15:32:04 GMT
From: bbeausej@*REMOVE*videotron.net (Benoit Beausejour)
Subject: Perl installation make test failed on Solaris
Message-Id: <379f2055.62573064@news.videotron.net>
Hi,
I am having troubles installing perl on a Sun Ultra-2
(UltraSparc) running Solaris 2.6 with Jumbo Patch.
Configure and compilation go fine (using gcc) without ld lib
(libperl.a). So make completes successfully.
GCC version is: 2.8.1
We are having problems entering the make test area. In fact, all test
script using the glob() function fails for some reason.
This includes, defins.t, glob.t, readdir.t, strict.t, warning.t,
dirhand.t, odbm etc etc.
Here is a sample of the glob() error message:
op/defins.t:.........glob failed (child exited with status 1) at
op/defins.t line 95.
Also, we tried running the TEST suite directly in the t dir but had
the same result. Even the harness test fails right away.
[%] ./perl harness
glob failed (child exited with status 1) at harness line 19.
FAILED--no tests were run for some reason.
Any ideas on workarounds or system patches for this ?
Thanks ins advance.
Ben
------------------------------
Date: 28 Jul 1999 15:37:44 GMT
From: fl_aggie@thepentagon.com (I R A Darth Aggie)
Subject: Re: Premature end of script headers???
Message-Id: <slrn7pu92d.gn3.fl_aggie@thepentagon.com>
On Wed, 28 Jul 1999 08:48:16 -0500, Nathan Schumann <nds@instrumental.com>, in
<379F0A20.24142F94@instrumental.com> wrote:
+ reason: Premature end of script headers
+ The file has the correct permissions on it: 755. I have checked my
+ script over and over as well as used syntax checking. I can also run it
+ from the UNIX prompt by typing: perl app.cgi.
You may want to add:
use CGI::Carp qw(fatalsToBrowser); # should show you what wrong
Something is causing an error condition when you run thru the CGI.
Probably a permission problem on a file.
James
------------------------------
Date: 28 Jul 1999 09:59:30 -0600
From: llornkcor@earthlink.net (llornkcor@earthlink.net)
Subject: Re: Problem with spam in this group
Message-Id: <wk7lnku5nh.fsf@earthlink.net>
SPAM is sent through the newsgroup servers, I believe. I just ignore
them.
LP
------------------------------
Date: 28 Jul 1999 15:24:55 GMT
From: gbacon@itsc.uah.edu (Greg Bacon)
Subject: Re: Selecting files by permisions
Message-Id: <7nn7c7$k2e$3@info2.uah.edu>
In article <x7g129tpl3.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> writes:
:
: >>>>> "A" == Abigail <abigail@delanet.com> writes:
:
: A> || unless ((stat($file))[2] eq 0644) {
:
: using eq instead of == and her other comments above apply as well.
DB<1> print "Yup!" if 1 eq "1"
Yup!
Greg
--
drugs may lead to nowhere, but at least it's the scenic route.
-- caesurae
------------------------------
Date: Wed, 28 Jul 1999 12:03:23 -0400
From: "Keith Lee" <leejk@cat.com>
Subject: Re: Selecting files by permisions
Message-Id: <7nn9ks$l99$1@ns1.cat.com>
Thanks, that works fine. I cannot use a chmod * because commands like cp,
rm, and such cannot handle more than 2000 or so files at a time, unless you
go in and tweak the kernel parameters a little, which is not an option for
me. Just one more question; what is the meaning of '&'. I can't find it
anywhere in my books. I see '&&', but this seems different.
Keith
> Actually, I just realize my answer was wrong. It should be:
>
> unless (((stat $file) [2] & 07777) == 00644) { ... }
>
> And leave off one 7 if you don't care about suid, gid or sticky bits.
>
>
> Abigail
------------------------------
Date: 28 Jul 1999 12:31:45 -0400
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Selecting files by permisions
Message-Id: <x7wvvkspla.fsf@home.sysarch.com>
>>>>> "GB" == Greg Bacon <gbacon@itsc.uah.edu> writes:
GB> In article <x7g129tpl3.fsf@home.sysarch.com>,
GB> Uri Guttman <uri@sysarch.com> writes:
GB> :
GB> : >>>>> "A" == Abigail <abigail@delanet.com> writes:
GB> :
GB> : A> || unless ((stat($file))[2] eq 0644) {
GB> :
GB> : using eq instead of == and her other comments above apply as well.
GB> DB<1> print "Yup!" if 1 eq "1"
GB> Yup!
l foo
-rw-r--r-- 1 uri other 0 Jul 28 12:24 foo
perl -le 'print +(stat "foo")[2]'
33188
perl -le 'printf "%o\n", +(stat "foo")[2]'
100644
perl -le 'print "nope!\n" unless (stat "foo")[2] eq 0644'
nope!
<having made several online blunders recently, it feels good to kick
someone else!>
uri
--
Uri Guttman ----------------- SYStems ARCHitecture and Software Engineering
uri@sysarch.com --------------------------- Perl, Internet, UNIX Consulting
Have Perl, Will Travel ----------------------------- http://www.sysarch.com
The Best Search Engine on the Net ------------- http://www.northernlight.com
"F**king Windows 98", said the general in South Park before shooting Bill.
------------------------------
Date: Wed, 28 Jul 1999 16:54:48 GMT
From: mike_lottridge@mentorg.com
Subject: Re: Trouble with sort
Message-Id: <7nnckk$4sf$1@nnrp1.deja.com>
My oversight - it's explained in the Date::Manip manpage:
Sorting Problems
If you use Date::Manip to sort a number of dates, you
must call Date_Init either explicitly, or by way of some
other Date::Manip routine before it is used in the sort.
For example, the following code fails:
use Date::Manip;
# &Date_Init;
sub sortDate {
my($date1, $date2);
$date1 = &ParseDate($a);
$date2 = &ParseDate($b);
return ($date1 cmp $date2);
}
@date = ("Fri 16 Aug 96",
"Mon 19 Aug 96",
"Thu 15 Aug 96");
@i=sort sortDate @dates;
but if you uncomment the Date_Init line, it works. The
reason for this is that the first time you call
Date_Init, it initializes a number of items used by
Date::Manip. Some of these have to be sorted (regular
expressions sorted by length to ensure the longest
match). It turns out that perl (5.004 and earlier) has
a bug in it which does not allow a sort within a sort.
At some point, this should be fixed, but for now, the
best thing to do is to call Date_Init explicitly.
NOTE: This is an EXTREMELY inefficient way to sort data.
Instead, you should parse the dates with ParseDate, sort
them using a normal string comparison, and then convert
them back to the format desired using UnixDate.
In article <MPG.1207f69dc907e088989d5b@nntp.hpl.hp.com>,
lr@hpl.hp.com (Larry Rosler) wrote:
> [Posted and a courtesy copy sent.]
>
> In article <7nlcsb$ric$1@nnrp1.deja.com> on Tue, 27 Jul 1999 22:46:36
> GMT, mike_lottridge@mentorg.com <mike_lottridge@mentorg.com> says...
> + I'm having trouble with sort and a custom sorting routine. It looks
> + like my sort routine is being called with the same data over and
over.
> + I assume it's some sort of reference problem. I looked through the
> FAQ,
> + I know this isn't the most efficient method, but I don't anticipate
> + needed to sort a large amount of data. I'm using ActiveState Build
> 518.
> +
> + Here's the code:
> + ------------------
> + use Date::Manip;
> +
> + sub DateSort {
> + print "DateSort:\n$a\n$b\n";
> +
> + my $date1=&ParseDate($a);
> + my $date2=&ParseDate($b);
>
> I tried replacing these with simple copy and substition, and it
worked
> fine. So the problem must be in ParseDate.
>
> + print "Comparing $date1 to $date2 \n";
> +
> + if ($date1 lt $date2) {
> + return -1; # date1 is earlier
> + }
> + elsif ($date1 gt $date2) {
> + return 1;# date2 is earlier
> + }
> + else {
> + return 0;
> + }# the two dates are identical)
>
> I also replaced the above 9 lines by this:
>
> $date1 cmp $date2
>
> + }
> +
> + $TZ="pst";
> +
> + @dates=("01/12/99", "06/12/98", "01/01/00", "04/01/90");
>
> I hope ParseDate deals properly with your Y2K problem!
>
> --
> (Just Another Larry) Rosler
> Hewlett-Packard Laboratories
> http://www.hpl.hp.com/personal/Larry_Rosler/
> lr@hpl.hp.com
>
Sent via Deja.com http://www.deja.com/
Share what you know. Learn what you don't.
------------------------------
Date: Wed, 28 Jul 1999 17:29:34 +0100
From: "George Crane" <georgec@webleicester.co.uk>
Subject: Using perl CGI under NT
Message-Id: <mbGn3.6$3T5.51@news1-hme0.mcmail.com>
Hi,
I have recently learned perl and really got into CGI on UNIX. When I try to
use my scripts under NT some really weird things happen. At the moment I
cant get sendmail to work. I am creating a filehandler like:
open (EMAIL, "| $mail $pairs{'FHP'}") || die "Your toast.";
where $mail is
$mail = "j:\sendmail\sendmail.exe";
or
$mail = '/usr/lib/sendmail';
and $pairs{'FHP'} is the emai of the recipiant.
What am I doing wrong????
George in earnest
------------------------------
Date: Wed, 28 Jul 1999 12:50:34 -0400
From: Lee Silver <lsilver@ibm.net>
Subject: Re: Which group is appropriate?
Message-Id: <379F34DA.1D51@ibm.net>
James:
> Fortran will bomb instantly and spectacularly if it can't open the
> file. This I know from experience.
That's why Fortran provides 'err=' in the open (and all other i/o)
statements. IMO, using 'open' without the 'err=' in Fortran is
equivalent to using 'open' without checking for success in Perl/C/C++.
--
// Lee Silver
// Information Concepts Inc.
WE LISTEN.
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
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 V9 Issue 284
*************************************