[9824] in Perl-Users-Digest
Perl-Users Digest, Issue: 3417 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Aug 11 12:08:02 1998
Date: Tue, 11 Aug 98 09:00:22 -0700
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Tue, 11 Aug 1998 Volume: 8 Number: 3417
Today's topics:
Re: "newgrp" in a Perl script <rootbeer@teleport.com>
Activestate's ppm.pl works behind firewall chuckk@monmouth.com
Re: calling one script from another script (Elvi Dalgaard)
Re: cgi <alan@find-it.furryferret.uk.com>
Re: cgi (Larry Rosler)
Re: Copyright question (I R A Aggie)
Re: dates in excess of 2037 (A Problem???) (Mike Stok)
Re: dates in excess of 2037 (A Problem???) <nguyend7@egr.msu.edu>
Re: easy system call <rickryan@mindspring.com>
Re: Frames <alan@find-it.furryferret.uk.com>
Re: Free Web hosting with CGI/Perl capabilities? PLEASE (Plamen Petkov)
Re: IMPORTANT: Rules for Posting to USENET (was: Re: va <jdporter@min.net>
Re: Is there a maximum recommended file size for Perl S <rootbeer@teleport.com>
Re: Perl Style (Scott Erickson)
Re: Run perl script "in-line"? <rootbeer@teleport.com>
Re: Sending mail using sendmail or Net::SMTP <simon@new-mediacom.com>
Re: Sending mail using sendmail or Net::SMTP <zenin@bawdycaste.org>
setting env variable <blegge@iafrica.com>
Re: setting env variable <nguyend7@egr.msu.edu>
Re: setting env variable <nguyend7@egr.msu.edu>
Re: taint checking and find.pm <rootbeer@teleport.com>
Re: Test Results - Asking a question (Andrew M. Langmead)
Re: Test Results - Asking a question <jdporter@min.net>
Re: Using Perl scripts in perl scripts? <tbeaulieu@mediaone.net>
Re: Using variable in TR <jdw@dev.tivoli.com>
Re: Using variable in TR (Andrew M. Langmead)
Re: What is the purpose of Perl <alan@find-it.furryferret.uk.com>
Re: What is the purpose of Perl <jdporter@min.net>
Re: What is the purpose of Perl <jdporter@min.net>
Re: what is this stuff? <jdporter@min.net>
Re: Where can I find the binary for perl at least 5.002 <merlyn@stonehenge.com>
Special: Digest Administrivia (Last modified: 12 Mar 98 (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 11 Aug 1998 15:40:36 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: "newgrp" in a Perl script
Message-Id: <Pine.GSO.4.02.9808110837580.10161-100000@user2.teleport.com>
On 11 Aug 1998, Joseph Bell wrote:
> i try (i dunno if this is supposed to work):
>
> $) = 266;
> print $)."\n";
>
> 276 276
>
> nothing changes...
It's not supposed to work. :-)
Your OS sets the rules about who can change to which groups. Of course,
/bin/newgrp is set-uid to root. Maybe you'll need to make your program
set-id? See perlsec. Hope this helps!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 11 Aug 1998 14:01:42 GMT
From: chuckk@monmouth.com
Subject: Activestate's ppm.pl works behind firewall
Message-Id: <6qpis6$4jm$1@nnrp1.dejanews.com>
All,
I recently posted that I wasn't able to get ppm.pl to
work from behind my firewall. I found a post (or was it one of the mailing
lists?)
Anyway, I set http_proxy=http://<ip address of proxy:80>/ and it worked.
(I previously omitted the trailing /)
chuck
-----== Posted via Deja News, The Leader in Internet Discussion ==-----
http://www.dejanews.com/rg_mkgrp.xp Create Your Own Free Member Forum
------------------------------
Date: Tue, 11 Aug 1998 15:49:15 GMT
From: elvi@nospam.dsuper.net (Elvi Dalgaard)
Subject: Re: calling one script from another script
Message-Id: <6qppt3$n1j$1@nr1.ottawa.istar.net>
In article <35CFF031.1F71DC06@schnibitz.hypermart.net>, webmaster@schnibitz.hypermart.net wrote:
>You are looking to pass
>information from one script to another via HTTP.
>
><href="http://www.someserver.com/cgi-bin/somescript.pl?variable=$variable">
>
>But that will work if the variable is the same all of the time, the variable
>probably has to come from a form right? Okay, I figured out this trick while
>observing Altavista.
>
><form
>action="http://www.someserver.com/cgi-bin/somescript.pl?variable=$variable">
>
>Of course "variable" is the value of "value" in HTML forms (was that confusing
>or what?). It SHOULD be just a simple HTML dealy.
>
Okay, but don't you then need some way to execute the script? A submit button
that has to be pressed, or something? I didn't think a form action would take
place without some sort of trigger.
I'm interested in this subject, because I've been trying to figure out how to
do this also. And I don't want to have to press a submit button in the middle,
I'd like the script to just call the second script without user intervention.
Thanks,
Elvi Dalgaard
------------------------------
Date: Tue, 11 Aug 1998 13:05:31 +0100
From: Alan Silver <alan@find-it.furryferret.uk.com>
Subject: Re: cgi
Message-Id: <8JU29SALOD01Ew7J@find-it.uk.com>
Other than the comments expressed by other posters, could I also point
out some (non-Perl) points in your code.
Although many browsers are reasonably tolerant of bad HTML, this is not
an excuse to write it. You will find that some browsers will display it
incorrectly, some will not display it at all. Those that display it may
take longer to parse it.
The HTML you show is not severely bad, but if you always write HTML like
this then you are asking for trouble.
Specifically,
1) you did not start the HTML with an <HTML> tag (nor end it with one).
2) you did not supply a <HEAD><?HEAD> section around the <TITLE>
3) ALL options in HTML tags (with the exception of pure numbers) should
be enclosed in quotes. Thus you should have put :
<input type="text" name="username">
etc.
None of these factors are to blame for your CGI not working (see other
posters for that), but you should still try to produce good HTML.
Sorry for commenting on a non-Perl issue, but good HTML is also very
important in CGI scripts.
Alan
--
Alan Silver
Please remove the furryferret when replying by e-mail
------------------------------
Date: Tue, 11 Aug 1998 07:44:21 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: cgi
Message-Id: <MPG.1039f8a3e13b15a99897c4@nntp.hpl.hp.com>
In article <8JU29SALOD01Ew7J@find-it.uk.com> on Tue, 11 Aug 1998 13:05:31
+0100, Alan Silver <alan@find-it.furryferret.uk.com> says...
> Other than the comments expressed by other posters, could I also point
> out some (non-Perl) points in your code.
You shouldn't.
...
> 3) ALL options in HTML tags (with the exception of pure numbers) should
> be enclosed in quotes. Thus you should have put :
> <input type="text" name="username">
Gag me. The quotes are to bind around spaces, which I don't see in that
example.
> Sorry for commenting on a non-Perl issue, but good HTML is also very
> important in CGI scripts.
This is like the arguments here about using parentheses around function
arguments, or using "<$filename" when opening for reading. (There, now
it's a Perl issue :-) What matters is the functionality; the rest is
stylistic choice.
In my case, transmission time of the HTML is a serious issue, and all
those extras (such as '</td>' for example) waste bandwidth. As does this
discussion.
--
Larry Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Tue, 11 Aug 1998 10:03:11 -0500
From: fl_aggie@thepentagon.com (I R A Aggie)
Subject: Re: Copyright question
Message-Id: <fl_aggie-1108981003110001@aggie.coaps.fsu.edu>
In article <35CFDA0C.FA3C73CC@idt.net>, jamesht <jamesht@idt.net> wrote:
+ ps- This message is copyright 1998 and may not be used in any way without
+ the express written consent of me.
Really? does "Fair Use" mean anything to you?
James
------------------------------
Date: 11 Aug 1998 14:06:09 GMT
From: mike@stok.co.uk (Mike Stok)
Subject: Re: dates in excess of 2037 (A Problem???)
Message-Id: <6qpj4h$4ak@news-central.tiac.net>
In article <35CFEA59.41AB@mlch.ml.com>,
Dominic Tootell <tootedom@mlch.ml.com> wrote:
>I have very interesting problem for you. I need to calculate the number
>of days between two dates (in perl). OK.. use the localtime function
>supplied with the perl standard library to get the number of seconds
>since
>1 January 1970 for the first date, then the number of second for the
>second date. Minus the two and then perform the calculation
>(((Remaining
>seconds/60)/60)/24). Ok fine that works, but the problem arises when
>you
>supply a date with the year 2028. The function does not work, The
>integer width cannot hold the seconds value, since 2038.
Do you care about granularity down to the second? You might want to look
into other representations of a date such as the Julian Day where you're
manipulating days rather than seconds, and that lets you represent a
bigger chunk of real time in the same number of bits.
There are several modules on CPAN (look under Date and Time) which allow
you to manipulate dates in convenient ways. You can get to CPAN by
visiting http://www.perl.com and following the CPAN links or by ftp to
ftp.funet.fi and looking under /pub/languages/perl/CPAN.
Hope this helps,
Mike
--
mike@stok.co.uk | The "`Stok' disclaimers" apply.
http://www.stok.co.uk/~mike/ | PGP fingerprint FE 56 4D 7D 42 1A 4A 9C
http://www.tiac.net/users/stok/ | 65 F3 3F 1D 27 22 B7 41
stok@colltech.com | Collective Technologies (work)
------------------------------
Date: 11 Aug 1998 15:40:09 GMT
From: Dan Nguyen <nguyend7@egr.msu.edu>
Subject: Re: dates in excess of 2037 (A Problem???)
Message-Id: <6qpokp$g2d$1@msunews.cl.msu.edu>
Okay so the designers of UNIX weren't thinking. Its nothing new look
at the Y2K problem. But the solution for it is simple. Newer
computers will be using a 64-bit long int rather than a 32-bit long
int. If your program current requirements exceed 2037 than you'll
have to think of you own work around. True that this date is only 40
years away, but I won't be suprised if 128-bit or 256-bit machines are
around by then.
--
Dan Nguyen | There is only one happiness in
nguyend7@msu.edu | life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 | -George Sand
------------------------------
Date: Tue, 11 Aug 1998 10:43:45 -0500
From: "Rick Ryan" <rickryan@mindspring.com>
Subject: Re: easy system call
Message-Id: <6qpotv$q6j$1@camel21.mindspring.com>
Try this:
$FH = `dfexe.bat lkpinfo $buffer` ;
It runs the system command, then returns the standard output back to the
variable. You can ignore it, display it, chop it apart and process it,
whatever.
Hope this helps.
Kevin & Tharesa wrote in message <35CF7AFF.3B1FC0E7@twcny.rr.com>...
>I've been using perl for unix for a couple of years now, and often do
>system calls. They're a piece of cake, and I'm wondering why they
>aren't working in my Win32 distribution.
>
>I shouldn't say NOT WORKING. I do something like:
>
>$command = "dir";
>system($command);
>
>and it works.... but I get a Invalid switch error, every single time, no
>matter what I put in system. And it is the system call... commenting it
>out corrects the error message.
>
>I'm sure this is stupid on my part, but this is the first time I've used
>perl in windows... I can't believe it's being a pain.
>
>Also, I want to supress error messages (like file not found, on a dir
>*.bat > temp or something) but perl -w name.pl doesn't seem to do it.
>Any ideas?
>
>Thanks a lot
>
>
>
------------------------------
Date: Tue, 11 Aug 1998 13:17:45 +0100
From: Alan Silver <alan@find-it.furryferret.uk.com>
Subject: Re: Frames
Message-Id: <qp8z1UApZD01Ewao@find-it.uk.com>
>Norman Bunn wrote:
>
>> When I run a perl program to generate HTML for frames, I receive:
>>
>> CGI Error
>> The specified CGI application misbehaved by not returning a complete set of
>> HTTP headers. The headers it did return are:
<snip>
The error message says it all. Your CGI script did not return a complete
set of headers. Let's be honest, you didn't return *any* headers.
The most common error with CGI scripts is not returning a header. This
should be the very 8first* thing the script outputs and as a bare
minimum, *must* include a Content-Type header so that the browser knows
what to do with the output. There must also be a blank line after the
headers.
Before you print any HTML, print a header ...
print "Content-Type: text/html\n\n";
Before you write any more CGI, please read up on the subject first. I
don't mean to be rude, but this is a very very basic mistake and is a
CGI problem, not a Perl one. Have a look at the CGI FAQ, which you can
find posted regularly in comp.infosystems.www.authoring.cgi
Alan
--
Alan Silver
Please remove the furryferret when replying by e-mail
------------------------------
Date: Tue, 11 Aug 1998 17:12:17 +0300
From: plamendp@techno-link.com (Plamen Petkov)
Subject: Re: Free Web hosting with CGI/Perl capabilities? PLEASE HELP
Message-Id: <MPG.103a5f14e6d0df73989689@news.techno-link.com>
In article <6qo1n3$cg1$1@nr1.ottawa.istar.net>
Date: Mon, 10 Aug 1998 18:00:22 -0500
Ryan Belanger wrote:
> Is there someone in here who know where I can get free Web hosting with
> CGI/Perl capabitilies in order to set up a CGI/Perl database (Selena Sol's
> database and search engine).
>
http://www.hypermart.net
--
=== PLEASE REMOVE ## FROM MY EMAIL ADDRESS! GUESS WHY :-) ===
Plamen Petkov
mailto:plamendp##@techno-link.com
http://bgbook.hypermart.net
------------------------------
Date: Tue, 11 Aug 1998 11:59:16 -0400
From: John Porter <jdporter@min.net>
Subject: Re: IMPORTANT: Rules for Posting to USENET (was: Re: variable inerpolation)
Message-Id: <35D06A54.14FE@min.net>
Tom Christiansen wrote:
>
> --tom, who just neoligismed "clonepost"
That sounds so disgusting, I am forced to assume that you
deliberately chose that over "neologized".
Between that and the fact that you misspelled your
neologism, I'm tempted to think that this post was actually
a forgery.
--
John Porter
------------------------------
Date: Tue, 11 Aug 1998 15:53:24 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Is there a maximum recommended file size for Perl Scripts
Message-Id: <Pine.GSO.4.02.9808110850320.10161-100000@user2.teleport.com>
On Tue, 11 Aug 1998, Leon Stepanian wrote:
> In general, if this same Perl script was split into about 10-15
> smaller scripts, would it function more efficiently,
Less efficiently, I'd expect. But the only way to know for certain is to
try both ways. Good luck!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 11 Aug 1998 15:04:46 GMT
From: Scott.L.Erickson@HealthPartners.com (Scott Erickson)
Subject: Re: Perl Style
Message-Id: <35d05ca3.2338554283@news.mr.net>
Previously, Daniel Grisinger wrote:
>I agree with you completely. There is a real tendency in this group
>toward omitting parens whenever possible, but this is just bad style.
>There is at least one post every week where the author has a problem
>with a construct such as-
>
> open FILE, $file || die "Oops: $!";
>
>If the poster hadn't been led into the belief that omitting parens
>whenever possible is a _good_ idea he wouldn't have had this
>problem. Saving keystrokes is good, but not when it leads to silly
>bugs.
I prefer that, for most cases, parens be omitted. However, in the
above example, the fault does not necessarily lie with the lack of
parens but with the use of || instead of 'or'. I, for one, believe
that using 'or' is much more readable than ||, plus by using it you
avoid precedence problems between commas and ||, as in the above
example.
Scott.
------------------------------
Date: Tue, 11 Aug 1998 15:58:49 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: Run perl script "in-line"?
Message-Id: <Pine.GSO.4.02.9808110857290.10161-100000@user2.teleport.com>
On Tue, 11 Aug 1998, Lee Davies wrote:
> Is there a neat way to run a perl script in-line in much the same way
> as Javascript can be embedded?
Sure there is. It may or may not have been coded up yet, though. :-)
> I have a perl script which collects some server details (hostname,
> port, OS version etc.) and want this information echoed into the
> current document. This has to happen without user intervention.
>
> Any suggestions?
Start with a perl-embedded browser. Have fun with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 11 Aug 1998 15:23:44 +0100
From: Simon Wistow <simon@new-mediacom.com>
Subject: Re: Sending mail using sendmail or Net::SMTP
Message-Id: <645CAC0140CED111AF1500805FEDDB8A844C@ns.new-mediacom.co.uk>
The first program I ever had to write for my company was an email
script. I couldn't make any assumptions about what platform they were
working on or what patches they ahd installed. Eventually I came up with
this, a huge bodge of various books and other scripts
# set up some variables
$port = 25;
$them = 'localhost' ; // change this to your mail
server
$AF_INET = 2; // these make it
all work
$SOCK_STREAM = 1; // ditto
$CRLF = "\015\012"; // this is works on
multiple platforms
$SIG{'INT'} = 'dokill';
sub dokill {kill 9,$child if $child;}
$sockaddr = 'S n a4 x8';
# set up the connection
($name,$aliases,$type,$len,$thisaddr) = gethostbyname($hostname);
($name,$aliases,$type,$len,$thataddr) = gethostbyname($them);
($name,$aliases,$proto) = getprotobyname('tcp');
($name,$aliases,$port) = getservbyname($port,'tcp')
unless $port =~ /^\d+$/;;
$this = pack($sockaddr, $AF_INET, 0, $thisaddr);
$that = pack($sockaddr, $AF_INET, $port, $thataddr);
# now actually connect to the remote port
if (!socket(S, $AF_INET, $SOCK_STREAM, $proto)) { print"socket failed :
$!\n";}
if (!bind(S, $this)) {print "bind failed : $!\n; }
if (!connect(S,$that)) { print "connect Failed : $!\n";}
select(S); $| = 1; select(STDOUT);
#start logging into the server
$a=<S>;
print S "HELO YourServer$CRLF"; $a=<S>;
print S "MAIL FROM:<$youraddress>$CRLF"; $a=<S>;
print S "RCPT TO:<$theiraddress>$CRLF"; $a=<S>;
print S "DATA $CRLF"; $a=<S>;
# print the headers
print S "From: \"$yourname\" <$youraddress> $CRLF";
print S "To: \"$theirname\" <$theiraddr> $CRLF";
print S "Subject: whatever $CRLF";
print S " $CRLF";
print S "Your Message Goes here $CRLF";
print S "And here $CRLF";
print S ".$CRLF"; $a=<S>;
print S "QUIT$CRLF"; $a=<S>;
I hope it helps.
> -----Original Message-----
> From: maurice@hevanet.com (Maurice Aubrey) [SMTP:maurice@hevanet.com]
> Posted At: Tuesday, August 11, 1998 11:07 AM
> Posted To: misc
> Conversation: Sending mail using sendmail or Net::SMTP
> Subject: Re: Sending mail using sendmail or Net::SMTP
>
> On Tue, 11 Aug 1998 08:23:11 +0200, Geert Roovers
> <etmgero@etm.ericsson.se>
> wrote:
> >Hi,
> >
> >In the ActivePerl docs, it says that you don't need an external
> >mailprogram to send e-mail from within a perlscript. You can use
> >Net::SMTP instead.
> >
> >What is better to use? I need to build a script that works on both
> >Windoze and UNIX. I am developing on Windoze NT4.0 with ActivePerl
> Perl
> >5.005 for Win32
>
> Most external mail programs are going to be much more robust, since
> they
> will queue and attempt to resend the message if there are problems.
>
> You may want to do a dejanews search for this topic; a while back,
> Zenin argued this point feverishly.
>
> --
> Maurice Aubrey <maurice@hevanet.com>
>
> ... one of the main causes of the fall of the Roman Empire was that,
> lacking zero, they had no way to indicate successful termination
> of their C programs.
> - Robert Firth
------------------------------
Date: 11 Aug 1998 15:38:54 GMT
From: Zenin <zenin@bawdycaste.org>
Subject: Re: Sending mail using sendmail or Net::SMTP
Message-Id: <902850556.608533@thrush.omix.com>
Geert Roovers <etmgero@etm.ericsson.se> wrote:
: In the ActivePerl docs, it says that you don't need an external
: mailprogram to send e-mail from within a perlscript. You can use
: Net::SMTP instead.
Yes, you can, it's just not nearly as reliable (check DejaNews
for my full comments on this). But if you're on NT, it's probably
your only "portable" method.
: What is better to use? I need to build a script that works on both
: Windoze and UNIX. I am developing on Windoze NT4.0 with ActivePerl Perl
: 5.005 for Win32
my $sendmail = '';
for ('/usr/lib/sendmail', '/usr/sbin/sendmail') {
$sendmail = $_ if -e;
}
if ($sendmail) {
send_mail_reliably ($sendmail, $message, etc...)
}
else {
hope_for_the_best_via_SMTP ($hostname, $message, etc...)
}
It all depends. Just coding to SMTP will be easier (a *little*
less code), but you'll lose a great deal of reliability on systems
(eg, Unix) that could have given it to you. Basically, please
don't choose the lowest common denominator of SMTP when it's so
easy to use it only as a fall back to better methods when they
are available.
I think what I need to do is simply make a "Mail::SendBestMethod"
that can do the above transparently, and handle sendmail
reliably (no module currently on CPAN handles sendmail (or any
mail program) robustly). By that I mean if sendmail or some
other mail program has an error condition, there is little to
no code that catches it. -Sendmail doesn't exit > 0 on all
errors (or even many errors...), and many of its error messages are
send to stdout, which can cause havoc to CGI programs from "invalid
header" server errors and such.
--
-Zenin (zenin@archive.rhps.org) From The Blue Camel we learn:
BSD: A psychoactive drug, popular in the 80s, probably developed at UC
Berkeley or thereabouts. Similar in many ways to the prescription-only
medication called "System V", but infinitely more useful. (Or, at least,
more fun.) The full chemical name is "Berkeley Standard Distribution".
------------------------------
Date: Tue, 11 Aug 1998 16:43:55 +0200
From: "Brad Legge" <blegge@iafrica.com>
Subject: setting env variable
Message-Id: <6qpku9$kbb$1@news01.iafrica.com>
Hi All
I am having problems setting an environment variable with the value of an
array. I am using perl5.003 on SunOs with Apache.
How do I go about setting an environment variable with the value of an
array. I have tried using the setenv with a system call but it doesn't seem
to accept my array as an argument.
Thanks In Advance.
Brad Legge
blegge@iafrica.com
Technical
------------------------------
Date: 11 Aug 1998 14:57:35 GMT
From: Dan Nguyen <nguyend7@egr.msu.edu>
Subject: Re: setting env variable
Message-Id: <6qpm4v$9ti$1@msunews.cl.msu.edu>
Brad Legge <blegge@iafrica.com> wrote:
: I am having problems setting an environment variable with the value of an
: array. I am using perl5.003 on SunOs with Apache.
: How do I go about setting an environment variable with the value of an
: array. I have tried using the setenv with a system call but it doesn't seem
: to accept my array as an argument.
First of all why do you want to set an array as a enviroment variable?
The reason that it doesn't work, is because you can't. Env variables
are scalar quantities only. That's why they can be stored into a
hash. If you had a list of lets say directories you want to store as
$ENV{PATH} you would do it like this
$ENV{PATH} = join(@directories, ':');
--
Dan Nguyen | There is only one happiness in
nguyend7@msu.edu | life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 | -George Sand
------------------------------
Date: 11 Aug 1998 15:08:09 GMT
From: Dan Nguyen <nguyend7@egr.msu.edu>
Subject: Re: setting env variable
Message-Id: <6qpmop$9ti$2@msunews.cl.msu.edu>
Dan Nguyen <nguyend7@egr.msu.edu> wrote:
: Brad Legge <blegge@iafrica.com> wrote:
: : I am having problems setting an environment variable with the value of an
: : array. I am using perl5.003 on SunOs with Apache.
: : How do I go about setting an environment variable with the value of an
: : array. I have tried using the setenv with a system call but it doesn't seem
: : to accept my array as an argument.
: First of all why do you want to set an array as a enviroment variable?
: The reason that it doesn't work, is because you can't. Env variables
: are scalar quantities only. That's why they can be stored into a
: hash. If you had a list of lets say directories you want to store as
: $ENV{PATH} you would do it like this
my mistake
$ENV{PATH} = join(':', @directories);
--
Dan Nguyen | There is only one happiness in
nguyend7@msu.edu | life, to love and be loved.
http://www.cse.msu.edu/~nguyend7 | -George Sand
------------------------------
Date: Tue, 11 Aug 1998 15:46:12 GMT
From: Tom Phoenix <rootbeer@teleport.com>
Subject: Re: taint checking and find.pm
Message-Id: <Pine.GSO.4.02.9808110842380.10161-100000@user2.teleport.com>
On Tue, 11 Aug 1998, Alex Krohn wrote:
> I'm having a problem with taint checking and the find module.
You're not the only one. If you can fix the module to be taint-savvy (and
not make it unsafe in the process) fame and fortune await you. Well, maybe
not fortune. And I can't be too sure about the fame.... But at least
you'll have the satisfaction of a job well done. Good luck with it!
--
Tom Phoenix Perl Training and Hacking Esperanto
Randal Schwartz Case: http://www.rahul.net/jeffrey/ovs/
------------------------------
Date: Tue, 11 Aug 1998 14:32:06 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Test Results - Asking a question
Message-Id: <ExJ4DJ.7vq@world.std.com>
rjk@coos.dartmouth.edu (Ronald J Kimball) writes:
>John Porter <jdporter@min.net> wrote:
>> I *would* gripe about giving away this secret to the unwashed
>> masses; after all, you only *claimed* to have read the docs;
>> you didn't give any evidence that you actually *had*.
>Oo, I didn't think of that. :-(
>So, how would someone give evidence that they had actually read the
>docs?
A lot of good questions do just that. If they mention something in
their posts that comes from the docs, it can be seen as proof that
they read them.
"I'm trying to remove a line from the middle of a file. I saw the
"delete" function in the perlfunc man page, but it doesn't seem to be
what I want."
A person posting a question like this implies that they are trying,
but they are just a little bit lost.
--
Andrew Langmead
------------------------------
Date: Tue, 11 Aug 1998 10:59:08 -0400
From: John Porter <jdporter@min.net>
Subject: Re: Test Results - Asking a question
Message-Id: <35D05C3C.42D7@min.net>
Craig Berry wrote:
>
> Jonathan Feinberg (jdf@pobox.com) wrote:
> : Hey, everybody! I've read the docs, but they really suck!!! I was
> : wondering, how do I...
>
> You know, the gleeful way software people leap directly onto pathological
> boundary condtions gets slightly wearing after a while... :)
Let's get our cause and effect straight.
We're software people *because* we find the boundary more interesting.
Otherwise we'd be either mechanical engineers, or artists.
:-)
--
John Porter
------------------------------
Date: Tue, 11 Aug 1998 11:09:26 -0400
From: "Todd B" <tbeaulieu@mediaone.net>
Subject: Re: Using Perl scripts in perl scripts?
Message-Id: <6qpmtp$rtb$1@wbnws01.ne.highway1.com>
i am taking a stab, but could exit be used, instead of return? i see it
being used to exit a 0 or 1 in some scripts. never tried running a script
from another script, though.
------------------------------
Date: 11 Aug 1998 07:09:24 -0500
From: "Jim Woodgate" <jdw@dev.tivoli.com>
Subject: Re: Using variable in TR
Message-Id: <obd8a7btzf.fsf@alder.dev.tivoli.com>
cselton@hkp.hk (cs - Elton Kong) writes:
> I want to use a variable's value in the tr operator. Below is my
> test code:
>
> $m = 'abc';
> $n = 'xyz';
> $o = 'a1b2c3';
> $o =~ tr/$m/$n/;
> print $o, "\n";
>
> What I would like to do is to store the source characters and
> replacement characters in 2 variables, and then do the translation
> using these 2 variables. However the above code doesn't work.
> Could anyone help?
man perlop:
"
Note that because the transliteration table is
built at compile time, neither the SEARCHLIST nor
the REPLACEMENTLIST are subjected to double quote
interpolation. That means that if you want to use
variables, you must use an eval():
eval "tr/$oldlist/$newlist/";
die $@ if $@;
eval "tr/$oldlist/$newlist/, 1" or die $@;
"
--
Jim Woodgate
Tivoli Systems
E-Mail: jdw@dev.tivoli.com
------------------------------
Date: Tue, 11 Aug 1998 15:19:57 GMT
From: aml@world.std.com (Andrew M. Langmead)
Subject: Re: Using variable in TR
Message-Id: <ExJ6L9.2p@world.std.com>
cselton@hkp.hk (cs - Elton Kong) writes:
>I want to use a variable's value in the tr operator. Below is my
>test code:
Unfortunately, tr///'s translation table is set up at compile time, so
it can't take variables.
You could use s///, which does allow variable interpolation:
%map = ( a => 'x', b => 'y', c => 'z' );
$o =~ s/([$m])/$map{$1}/go;
Or you could wrap the tr/// into a runtime eval(), maybe using an
anonumous sub so that the tr/// only get compiled once.
$tr = eval "sub { $_[0] =~ tr/$m/$n/ }";
&$tr($o);
An s/// is slower than a tr///, but both the eval() and the subroutine
call needed to use the variables will cut down on the benefits.
#!/usr/bin/perl -w
use Benchmark;
use strict;
use vars qw($m $n $orig_o %map $precompiled);
# the sample data
$orig_o = 'a1b2c3';
# the expected result
my $expected_result = 'x1y2z3';
# set the in=>out mapping
%map = ( a => 'x', b => 'y', c => 'z' );
$m = join '', sort keys %map;
$n = join '', @map{ sort { $map{$a} cmp $map{$b} } keys %map };
# create an anonymous sub that will precompile the tr///
$precompiled = eval " sub { \$_[0] =~ tr/$m/$n/ } ";
# and one that will eval into separate s/// statements for each elem
my $separate_subst = 'my $o = $orig_o;';
for my $in (keys %map) {
$separate_subst .= "\$o =~ s/$in/$map{$in}/g;"
}
$separate_subst .= '$o';
# different ways of performing the transformation.
my %testsubs = (
subst_o => q(my $o = $orig_o; $o =~ s/([$m])/$map{$1}/go; $o),
subst => q(my $o = $orig_o; $o =~ s/([$m])/$map{$1}/g; $o),
separate_subst => $separate_subst,
precompiled_tr => q(my $o = $orig_o; &$precompiled($o);$o),
uncompiled_tr => q(my $o = $orig_o; eval "\$o =~ tr/$m/$n/";$o)
);
# test each for correctness
for my $sub (keys %testsubs) {
my $result = eval $testsubs{$sub};
unless ($expected_result eq $result) {
die "sub $sub: result of $result does not match $expected_result\n";
}
}
# and now benchmark them
timethese (100_000, \%testsubs);
Benchmark: timing 100000 iterations of precompiled_tr, separate_subst, subst, s.
Useless use of private variable in void context at (eval 9) line 1.
precompiled_tr: 3 secs ( 2.38 usr 0.01 sys = 2.39 cpu)
Useless use of private variable in void context at (eval 11) line 1.
separate_subst: 4 secs ( 4.10 usr 0.00 sys = 4.10 cpu)
Useless use of private variable in void context at (eval 13) line 1.
subst: 13 secs (12.77 usr 0.02 sys = 12.79 cpu)
Useless use of private variable in void context at (eval 15) line 1.
subst_o: 11 secs (11.55 usr 0.03 sys = 11.58 cpu)
Useless use of private variable in void context at (eval 17) line 1.
uncompiled_tr: 53 secs (52.66 usr 0.08 sys = 52.74 cpu)
--
Andrew Langmead
------------------------------
Date: Tue, 11 Aug 1998 13:23:58 +0100
From: Alan Silver <alan@find-it.furryferret.uk.com>
Subject: Re: What is the purpose of Perl
Message-Id: <vZhypbAefD01EwZw@find-it.uk.com>
In article <6qlj11$aok$1@news.ycc.yale.edu>, Miguel Cruz
<mnc@diana.law.yale.edu> writes
>In article <35CE4264.2E0AEE50@slip.net>, Eric Umehara <momiji@Slip.Net> wrote:
>> I'm learning perl and am curious what is the purpose of Perl?? What can it
>> do and what has it done.
>
>Perl can bend steel bars and move mountains. Perl can tie back the hands of
>time. Perl is good for the goose and for the gander. Perl can beat up Mike
>Tyson with one hand tied behind its back. Perl can make a rock so heavy it
>can't lift it.
>
>Perl has saved the rainforests, it has been to the moon, and it has cured
>all major diseases. It has exceeded all known bounds. It has mapped the
>universe and created an exact duplicate. Perl has danced with angels and
>dined with Shakespeare.
>
>Didn't you read the manual?
>
>miguel
You forgot to mention that perl 5.5 can square the circle and divide by
zero.
Shame on you.
--
Alan Silver
Please remove the furryferret when replying by e-mail
------------------------------
Date: Tue, 11 Aug 1998 11:06:35 -0400
From: John Porter <jdporter@min.net>
Subject: Re: What is the purpose of Perl
Message-Id: <35D05DFB.72FE@min.net>
Pat Gunn wrote:
>
> No no no no. Not /dev/kmem. Silly. You do an "init s", and then
> a "dd if=/dev/mda of=/dev/mdb", and then "reboot". ...
No no, even that's too much.
Just replace your unix box with an S/390 with VM.
--
John Porter
------------------------------
Date: Tue, 11 Aug 1998 11:09:01 -0400
From: John Porter <jdporter@min.net>
Subject: Re: What is the purpose of Perl
Message-Id: <35D05E8D.61C5@min.net>
I R A Aggie wrote:
>
> (Tom Christiansen) wrote:
> + Goodness, wouldn't it be easier to just fork? No data copying. :-)
>
> Forgive my presumption here, I only have a vague notion of what forking
> does, but wouldn't this give you _parallel_ universes?
> I don't think the data space is shared...
Well, if "code space" is fundamental physical laws, and "data space"
is the matter/energy contents in toto, then I don't think you
necessarily want sharing of the data space. That would be very
weird indeed.
--
John Porter
------------------------------
Date: Tue, 11 Aug 1998 11:20:03 -0400
From: John Porter <jdporter@min.net>
Subject: Re: what is this stuff?
Message-Id: <35D06123.48F0@min.net>
Anthony Reeves wrote:
>
> here is the line that is read and displayed during a debug session:
>
> X line
>
> line = "Time\cIAmt\cIJob\cJ"
That is how the debugger is choosing to represent control
characters at that time.
Remember that one way to get control characters into a string
is to use \cX, where X is the normal, upper-case character
corresponding to the control character. For example, the "bell"
character is control-G (ascii 7), so that could be represented as
\007 (octal), or \cG. In your string, you have \cI and \cJ.
Numerically, those work out to ascii 9 and 10, respectively.
You know what those are, don't you? 9 is tab, and 10 is linefeed.
Ordinary, to put those into a string, we use \t and \n.
But for some reason, when the debugger finds a tab character in
the string, it assumes the string contains "binary" data, so it
represents all control characters in the \cX format.
So if I were you, I'd treat the string like this:
chomp $line; # get rid of trailing newline
split /\t/, $line; # split on tabs
--
John Porter
------------------------------
Date: Tue, 11 Aug 1998 14:39:41 GMT
From: Randal Schwartz <merlyn@stonehenge.com>
Subject: Re: Where can I find the binary for perl at least 5.002 (better 5.005) for Windows NT4.0 ?
Message-Id: <8c7m0fr3a5.fsf@gadget.cscaper.com>
[comp.lang.perl is dead.]
>>>>> "Alvin" == Alvin J Alexander <aja@DevDaily.com> writes:
Alvin> If you're looking for the binary for Windows, try looking here:
Alvin> http://www.activestate.com
Alvin> For other operating systems, you can usually find a binary at their
Alvin> web site.
Heh. Nope. Why not just go to the VERY source for All Things Perl:
the CPAN, at http://www.perl.com/CPAN/ (or www.cpan.org if you're in
the US, possibly further out later). Even the Activestate port is
mirrored into this archive. It's your one-stop shopping archive!
Alvin> Al A.
Alvin> Developer's Daily
Alvin> http://DevDaily.com
Alvin> "The resource for Java, Perl, and Unix developers."
Hmm. Somewhat ironic, since you didn't suggest the CPAN. :(
Maybe you should be "An incompletely informed resource..." :)
--
Name: Randal L. Schwartz / Stonehenge Consulting Services (503)777-0095
Keywords: Perl training, UNIX[tm] consulting, video production, skiing, flying
Email: <merlyn@stonehenge.com> Snail: (Call) PGP-Key: (finger merlyn@teleport.com)
Web: <A HREF="http://www.stonehenge.com/merlyn/">My Home Page!</A>
Quote: "I'm telling you, if I could have five lines in my .sig, I would!" -- me
------------------------------
Date: 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 3417
**************************************