[13605] in Perl-Users-Digest
Perl-Users Digest, Issue: 1015 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 7 18:05:33 1999
Date: Thu, 7 Oct 1999 15:05:15 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <939333914-v9-i1015@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 7 Oct 1999 Volume: 9 Number: 1015
Today's topics:
a newbie perl question (fwd) <ewhite@guy.ssc.wisc.edu>
Re: a newbie perl question (fwd) <makkulka@cisco.com>
Re: a newbie perl question (fwd) <emschwar@rmi.net>
Re: Backtick programs (Abigail)
Re: Backtick programs (Abigail)
Re: Backtick programs (Abigail)
Re: bug or feature? <ilya@speakeasy.org>
Re: Bug with localtime() in Perl 5.004 and 5.005 shapirojNOSPAM@logica.com
Re: Bug with localtime() in Perl 5.004 and 5.005 (Larry Rosler)
Re: Caliing method by reference with arrow operator (Damian Conway)
Re: Counter (Abigail)
Re: Das GlasPerlenspiel (Abigail)
Re: Das GlasPerlenspiel <cassell@mail.cor.epa.gov>
Re: Das GlasPerlenspiel <cassell@mail.cor.epa.gov>
Re: Delete a line in a file (Abigail)
Re: Delete a line in a file <ilya@speakeasy.org>
Does anyone know how to do ftp in perl? cheis01@yahoo.com
Re: exec() argument problem with ActiveState 520 rossz@my-deja.com
Given $fs{usr}{local}=1234, what does $fs{usr} contain? (Bill Huston)
Re: help for a perl script <cassell@mail.cor.epa.gov>
Hosts running Mason and ImageMagic <norman.bunn@mci.com>
Re: How to secure PERL-Scripts <cassell@mail.cor.epa.gov>
Re: html strip regexp error (Abigail)
Re: mkdir... and then!? emlyn_a@my-deja.com
Re: Perl & java <AgitatorsBand@yahoo.com>
Re: Perl + Java <dwoods@ucalgary.ca>
perldoc -q <bwilcox@eudoramail.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 7 Oct 1999 15:15:39 -0500
From: Eric White <ewhite@guy.ssc.wisc.edu>
Subject: a newbie perl question (fwd)
Message-Id: <Pine.OSF.3.95.991007151448.22631K-100000@guy.ssc.wisc.edu>
I'm playing around a bit with perl and I'm stumped by something (no big suprise
there...).
Anyway, I'm running through some demo cgi scripts and I've got one that looks
like this:
-------------------------------------------
#!c:\perl\bin\perl.exe
print "Content-type:text/html\n\n";
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
print "<html><head><title>Form Output</title></head><body>";
print "<h2>Results from FORM post</h2>\n";
# print "$FORM{"email"}";
foreach $key (keys(%FORM)) {
print "$key = $FORM{$key}<br>";
}
print "</body></html>";
-------------------------------------------------------
My problem comes in trying to reference specific elements in the %FORM hash.
Everything's fine running through the hash with 'foreach,' but if I just try
to reference the 'email' element it barfs. I've stared at this long enough
that I thougt it was time to ask for help.
Any pointers?
Thanks a lot,
Eric
---------------------------------------------------------------
Eric White ewhite@ssc.wisc.edu
UW Survey Center phone: 608-265-4066
University of Wisconsin - Madison http://www.wisc.edu/uwsc/
------------------------------
Date: Thu, 07 Oct 1999 13:24:39 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: a newbie perl question (fwd)
Message-Id: <37FD0187.F206DE8@cisco.com>
{ Eric White wrote:
> # print "$FORM{"email"}";
> foreach $key (keys(%FORM)) {
> print "$key = $FORM{$key}<br>";
> }
> My problem comes in trying to reference specific elements in the %FORM hash.
> Everything's fine running through the hash with 'foreach,' but if I just try
> to reference the 'email' element it barfs. I've stared at this long enough
> that I thougt it was time to ask for help.
Make sure that you see "email" as a key inside the foreach() before you ask to
do the print $FORM{"email"} ;
------------------------------
Date: 07 Oct 1999 14:53:05 -0600
From: Eric The Read <emschwar@rmi.net>
Subject: Re: a newbie perl question (fwd)
Message-Id: <xkfemf6ao5q.fsf@valdemar.col.hp.com>
Eric White <ewhite@guy.ssc.wisc.edu> writes:
> #!c:\perl\bin\perl.exe
#!c:\perl\bin\perl.exe -w
use strict;
> print "Content-type:text/html\n\n";
print header; # only works after 'use CGI' (below)
> read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
> @pairs = split(/&/, $buffer);
> foreach $pair (@pairs) {
> ($name, $value) = split(/=/, $pair);
> $value =~ tr/+/ /;
> $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
> $FORM{$name} = $value;
>
> }
This is all very bad. It doesn't handle the case of if you read less
than the CONTENT_LENGTH number of bytes correctly, it doesn't decode
URI-encoded parameters properly, and it doesn't handle variables (like
checkboxes) with multiple values.
Try this instead (right after the "use strict"):
use CGI qw(:standard);
> print "<html><head><title>Form Output</title></head><body>";
print start_html(-title => "Form Output");
> print "<h2>Results from FORM post</h2>\n";
>
> # print "$FORM{"email"}";
print param('email');
> foreach $key (keys(%FORM)) {
> print "$key = $FORM{$key}<br>";
> }
foreach $key (param()) {
print "$key = ",param($key),"<br>\n";
}
The \n is important, if anybody is going to be reading the output of
this script via "View Source". And I guarantee, someone will.
> print "</body></html>";
print end_html;
> My problem comes in trying to reference specific elements in the %FORM hash.
> Everything's fine running through the hash with 'foreach,' but if I just try
> to reference the 'email' element it barfs. I've stared at this long enough
> that I thougt it was time to ask for help.
Define "barfs". Also, if you use the -w and "use strict" bits above,
then Perl will likely tell you what's going wrong. In fact, I'd say,
conservatively, that you should use them in every program you write,
until such time as you have a darn good reason why not to. If it causes
some code that used to run to break, then the code was probably not
working completely right anyhow.
-=Eric
--
"Cutting the space budget really restores my faith in humanity. It
eliminates dreams, goals, and ideals and lets us get straight to the
business of hate, debauchery, and self-annihilation."
-- Johnny Hart
------------------------------
Date: 7 Oct 1999 15:16:46 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Backtick programs
Message-Id: <slrn7vq0fb.1fk.abigail@alexandra.delanet.com>
oliver.cookIYAPCR@ukonline.co.uk (oliver.cookIYAPCR@ukonline.co.uk) wrote
on MMCCXXVIII September MCMXCIII in <URL:news:7ting7$hed$1@apple.news.easynet.net>:
**
** I'm writing a program which needs to call several shell programs. To
** run them I use the following format:
**
** `command1`;
** `command2`;
**
** however, command2 is started as soon as command1 is.
It isn't.
** How can I make is
** to that command2 isn't started until command1 is finished?
You should use system instead of backticks if you don't want to
capture the output. But both system and backticks do a fork, exec
and a wait.
Abigail
--
perl -we '$@="\145\143\150\157\040\042\112\165\163\164\040\141\156\157\164".
"\150\145\162\040\120\145\162\154\040\110\141\143\153\145\162".
"\042\040\076\040\057\144\145\166\057\164\164\171";`$@`'
-----------== 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: 7 Oct 1999 15:18:16 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Backtick programs
Message-Id: <slrn7vq0i5.1fk.abigail@alexandra.delanet.com>
Makarand Kulkarni (makkulka@cisco.com) wrote on MMCCXXVIII September
MCMXCIII in <URL:news:37FCE798.834A26CE@cisco.com>:
,, { oliver.cookIYAPCR@ukonline.co.uk wrote:
,,
,, > I'm writing a program which needs to call several shell programs. To
,, > run them I use the following format:
,, > `command1`;
,, > `command2`;
,, > however, command2 is started as soon as command1 is. How can I make is
,, > to that command2 isn't started until command1 is finished?
,,
,, `command1` && `command2` ;
So..... if the first command doesn't output anything, the second one
shouldn't be called?
Abigail
--
perl -MNet::Dict -we '(Net::Dict -> new (server => "dict.org")
-> define ("foldoc", "perl")) [0] -> print'
-----------== 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: 7 Oct 1999 15:21:41 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Backtick programs
Message-Id: <slrn7vq0oi.1fk.abigail@alexandra.delanet.com>
Marshall Culpepper (marshalc@americasm01.nt.com) wrote on MMCCXXVIII
September MCMXCIII in <URL:news:37FCF317.DFA87A33@americasm01.nt.com>:
?? Makarand Kulkarni wrote:
??
?? { oliver.cookIYAPCR@ukonline.co.uk wrote:
??
?? > I'm writing a program which needs to call several shell programs. To
?? > run them I use the following format:
?? > `command1`;
??
?? you might want to do a system("command1"), this automatically waits on the
?? process to end for you.
??
?? from perldoc -f system:
??
?? Does exactly the same thing as "exec LIST" except that a fork is done
?? first, and the parent process waits for the child process to complete.
??
?? The only downside to this is you might want to assign some kind of value to
?? the return status of the command, but if
?? all you want is a quick exec with no return value you could just
??
?? exec("command1");
?? wait;
And the wait will never be reached. Exec will *replace* the current
process with the one being called *AND NOT RETURN*. (Unless the exec
itself fails).
Abigail
--
perl -wle\$_=\<\<EOT\;y/\\n/\ /\;print\; -eJust -eanother -ePerl -eHacker -eEOT
-----------== 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: Thu, 07 Oct 1999 22:02:08 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: bug or feature?
Message-Id: <rvq6305ad6e24@corp.supernews.com>
Uri Guttman <uri@sysarch.com> wrote:
>>>>>> "AK" == Alexander Knack <ak@dasburo.de> writes:
> AK> why does the following not work?
> AK> $x = '23.24.25';
> AK> @y = split '.', $x;
> AK> print (join " ", @y), "\n";
> newbies almost never find a real bug in perl. so please don't credit
> yourself as doing that. you have run into a very common newbie bug in
> your own code. read perlre to learn more about why that split doesn't do
> what you expect.
> AK> *shrug*
> try shouldering more documentation before shrugging your shoulders.
Can you possibly be any more helpful?
==============================================================
Paper money eventually returns to its intrinsic value -- zero.
-Voltaire
==============================================================
------------------------------
Date: Thu, 7 Oct 1999 16:55:19 -0400
From: shapirojNOSPAM@logica.com
Subject: Re: Bug with localtime() in Perl 5.004 and 5.005
Message-Id: <MPG.1266d2bf4e71e783989689@news.logica.co.uk>
In article <7ti4m9$1bk$1@pegasus.csx.cam.ac.uk>, mjtg@cus.cam.ac.uk
says...
> Larry Rosler <lr@hpl.hp.com> wrote:
> >In article <TDqK3.17199$t%3.1261029@typ11.nn.bcandid.com> on Tue, 05 Oct
> >1999 17:33:39 GMT, Alan Curry <pacman@defiant.cqc.com> says...
> >
> >> Currently it says they come from struct tm. And localtime(3) says the tm_sec
> >> field of a struct tm goes from 0 to 61. So with the present state of the
> >> docs, I'd say that there _are_ leap seconds in perl.
> >
> >No, there aren't. Or even in Perl. With the present state of the docs,
> >I'd say that there _are_ incorrect docs in C (in fact, in the C
> >Standard). Which should probably be reported elsewhere.
> And even on a UNIX system, if you get a struct tm value from some
> source other than localtime() or gmtime(), say from your friendly
> neighbourhood astronomer, then it may well have tm_sec == 60.
>
> Of course, the upper limit of 61 rather than 60 *is* an error, unless
> the writers of the C standard were planning for the time system of some
> alternative universe.
>
> Mike Guy
>
If I remember some obscure research I once did into time standards, I
recall some standard allowing the possibility of 2 leap second being
added at once. That's what the 61 is for.
Jonathan
------------------------------
Date: Thu, 7 Oct 1999 14:44:55 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Bug with localtime() in Perl 5.004 and 5.005
Message-Id: <MPG.1266b4314d84fff298a058@nntp.hpl.hp.com>
In article <MPG.1266d2bf4e71e783989689@news.logica.co.uk> on Thu, 7 Oct
1999 16:55:19 -0400, shapirojNOSPAM@logica.com
<shapirojNOSPAM@logica.com> says...
...
> If I remember some obscure research I once did into time standards, I
> recall some standard allowing the possibility of 2 leap second being
> added at once. That's what the 61 is for.
I think you are right about that, which is why the pedants put 61 into
the spec. But it is wrong nevertheless, because it is understood that
there will never be a change of more than one leap second at a time, nor
more frequently than once every six months.
I haven't found a definitive statement of this, though.
Here is one quote <http://campus.fortunecity.com/newton/98/second.htm>:
"Whenever a difference of greater than 0.9 seconds is observed between
astronomical time and the atomic clock, the NIST adds a leap-second to
their official time signal. Thus, the variance between the two is never
greater than 0.9 seconds. A leap-second has been added almost every
year since 1972. While it is theoretically possible that a second may
have to be subtracted at some point, according to the NIST this is not
likely to be necessary any time in the foreseeable future."
As anyone who cares already knows, TIA - UTC is now +32 sec.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 7 Oct 1999 20:09:59 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: Caliing method by reference with arrow operator
Message-Id: <7tiumn$s0v$1@towncrier.cc.monash.edu.au>
"Igor V. Solodovnikov" <siv@helpco.kiev.ua> writes:
>One more question: What if reference isnt stored in scalar variable?
>(Something like $self->{table}[0]) Can i use such reference without
>assigninig it to scalar?
You can:
$self->${\$self->{table}[0]}();
but don't do that, unless you want future generations of code maintainers
cursing your name. :-)
Damian
------------------------------
Date: 7 Oct 1999 16:25:14 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Counter
Message-Id: <slrn7vq4fo.1fk.abigail@alexandra.delanet.com>
Rainer Jung (rj@dungeon.inka.de) wrote on MMCCXXVIII September MCMXCIII
in <URL:news:slrn7vp2po.8n.rj@coyo.dungeon.inka.de>:
() +--[ Frank de Bot ]---[ debot@xs4all.nl ]
() | Maybe if you write your messages in English we could all understand.
()
() That's the problem, when someone posts in a german and an international
() Newsgroup, ..
And posting in English in an international group is different because
of what exactly?
Abigail
--
srand 123456;$-=rand$_--=>@[[$-,$_]=@[[$_,$-]for(reverse+1..(@[=split
//=>"IGrACVGQ\x02GJCWVhP\x02PL\x02jNMP"));print+(map{$_^q^"^}@[),"\n"
-----------== 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: 7 Oct 1999 15:56:01 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Das GlasPerlenspiel
Message-Id: <slrn7vq2ot.1fk.abigail@alexandra.delanet.com>
Anno Siegel (anno4000@lublin.zrz.tu-berlin.de) wrote on MMCCXXVIII
September MCMXCIII in <URL:news:7ti282$ebj$1@lublin.zrz.tu-berlin.de>:
**
** Yes. An earlier version of the camel put it somewhat like this: Perl
** expects you to stay out of the living room because you weren't invited,
** not because it has a shotgun.
**
** The trouble is, it doesn't even tell you where the friggin living room
** *is*. So, unless you have some experience with the oo approach, or
** modularization, or whatever, you stumble around... When you happen
** into the living room, you find out that Perl does have a shotgun.
It's worse. Far worse. The classical implementation of objects, using
blessed hashreferences means that *the same living room is shared with
all inheritees*.
Which means that Perl OO sucks. Now, I know there are a bunch of tricks
to make your data more private, but the fact that you need to resort to
such tricks means Perl OO sucks. It should to the right thing by default.
It doesn't. Perl OO is anti-Perl.
Abigail
--
perl5.004 -wMMath::BigInt -e'$^V=Math::BigInt->new(qq]$^F$^W783$[$%9889$^F47]
.qq]$|88768$^W596577669$%$^W5$^F3364$[$^W$^F$|838747$[8889739$%$|$^F673$%$^W]
.qq]98$^F76777$=56]);$^U=substr($]=>$|=>5)*(q.25..($^W=@^V))=>do{print+chr$^V
%$^U;$^V/=$^U}while$^V!=$^W'
-----------== 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: Thu, 07 Oct 1999 14:31:50 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Das GlasPerlenspiel
Message-Id: <37FD1146.E88C6CF4@mail.cor.epa.gov>
Fujitsu Australia Limited wrote:
>
> David Cassell wrote in message <37FBB4AF.57D1A7FE@mail.cor.epa.gov>...
> >Fujitsu Australia Limited wrote:
> >>
> >You want rec.arts.tv.mst3k.misc instead of this ng.
>
> Just a gag. I'm guessing you're not a Hesse fan then. It's a mistake to
> confuse Hesse with New Age crystal culture and Trekkies. He's not Tolkien.
I've read Hesse. But not for a few years. Still, I was making
a joke in return, since your intent was obvious. And you must
not know enogh about MST3K and the rec.arts.tv.mst3k.misc
newsgroup if you think Hesse would be off-topic for either.
Considering that MST3K has made refs to Melville, Pynchon, and
James Joyce [to name a few that I happen to know of], Hesse
is definitely in their purview.
> Sorry to be off topic. This group is called misc, but it appears to be
> dedicated to two main topics: Perl programming problems and newbie bashing,
> in a ratio of about 40/60.
Exactly. Except we try to keep the ratio closer to 20/80. :-)
BTW, there is a charter for this newsgroup if you want to look
it up.
> One of Perl's greatest gifts is the sense of humour in the community.
> There's humour built into the language itself.
> Would it help if I used smileys? I find they have the opposite effect to
> what's intended.
In the words of the people behind MST3K, "the right people will
get it."
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 07 Oct 1999 14:34:38 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Das GlasPerlenspiel
Message-Id: <37FD11EE.46FB2A15@mail.cor.epa.gov>
Csaba Raduly wrote:
>
> David Cassell wrote:
> >
> > Fujitsu Australia Limited wrote:
[big snip]
> > > Hermann Hesse
> > > Das Glasperlenspiel
> > > 1943
> >
> Don't tell me there was perl in 1943 (on ENIAC, perhaps) ????
No, on the Atanasoff-Berry Computer at Iowa State University.
But it had some serious memory constraints.
> Larry didn't look THAT old to me :-)
Well, just don't look at the painting up in his attic.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 7 Oct 1999 16:25:50 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Delete a line in a file
Message-Id: <slrn7vq4gr.1fk.abigail@alexandra.delanet.com>
Gaetan (gaetan@eii.fr) wrote on MMCCXXVIII September MCMXCIII in
<URL:news:37FCCA40.D338E545@eii.fr>:
\\ What can i do to delete just one line in a file.
Read the FAQ?
Abigail
--
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
${qq$\x5F$} = q 97265646f9 and s g..g;
qq e\x63\x68\x72\x20\x30\x78$&eggee;
{eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'
-----------== 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: Thu, 07 Oct 1999 21:57:07 GMT
From: Ilya <ilya@speakeasy.org>
Subject: Re: Delete a line in a file
Message-Id: <rvq5pjadd6e41@corp.supernews.com>
Tom Briles <sariq@texas.net> wrote:
> Gaetan wrote:
>>
>> What can i do to delete just one line in a file.
> You can RTFM. Specifically, perlfaq5:
> "How do I change one line in a file/delete a line in a file/insert a
> line in the middle of a file/append to the beginning of a file?"
It is a fallacy that the FAQ can satisfy the needs of everyone. That's why
newsgrops exist to complement it. FAQ are good, but sometimes users have
unique variations of the same problem that requires a less standard
response. Just because there is a FAQ entry, does not mean the question should
not be asked/answered here. So... Asking FAQ questions is not a waste of time,
personally I want to see these kinds of questions. What's a waste of time and
noise is people saying "Oh! It is in the FAQ! Go read it! Don't ask here".
As to the question, there are many many ways of doing that. Could you give a
more detailed example of what you are trying to accomplish? If you are
interfacing with the system file, I would use "grep -v". If you have your data
in an array, I would use regular expressions and pattern matching.
The one book that covers it really well is: _Perl By Example_ by Quigley. The
_Perl Cookbook_ is also excellent. I somehow have not found much use for the
Camel book.
==============================================================
Paper money eventually returns to its intrinsic value -- zero.
-Voltaire
==============================================================
------------------------------
Date: Thu, 07 Oct 1999 21:47:43 GMT
From: cheis01@yahoo.com
Subject: Does anyone know how to do ftp in perl?
Message-Id: <7tj4dq$cea$1@nnrp1.deja.com>
Does anyone know how to do ftp in perl?
You know in a shell script, you could do the following:
ftp -n -d << EOF
open SERVER
user USER\PASSWD
put FILE
bye
EOF
And then execute the script in shell, so the file is transfered.
Is there a way to do this in perl?
Thanks.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 07 Oct 1999 20:25:52 GMT
From: rossz@my-deja.com
Subject: Re: exec() argument problem with ActiveState 520
Message-Id: <7tivjv$8np$1@nnrp1.deja.com>
> C:\My Documents\Perl\junk.pl contains an
invalid path.
The error is from UltraEdit and indicates part of
the path to your document does not exist. I would
guess that the "Perl" portion of the path is
invalid.
Try it from the DOS command line, you'll get the
exact same error.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 07 Oct 1999 21:28:58 GMT
From: bhuston@matrix.eden.com (Bill Huston)
Subject: Given $fs{usr}{local}=1234, what does $fs{usr} contain?
Message-Id: <ug8L3.1173$oq.6482@newsfeed.slurp.net>
Someone help me understand this:
| $fs{usr}{local}=1234; # makes $fs{usr} a ref to anon hash
| print "$fs{usr}\n"; # yep, prints HASH(0x80ceadc)
|
| $fs{usr}=4567; # clobbers the above hashref?
| print "$fs{usr}\n"; # yep, now prints "4567"
| print "$fs{usr}{local}\n"; # prints nothing, not even "not a hash ref"
| # ... Did we re-construct the hashref?
| print "$fs{usr}\n"; # nope, still prints "4567"
Ok, makes sense so far... Now change the order a bit...
| $fs{home}=12345; # contains a scalar value
| $fs{home}{bhuston}=987; # clobbers it with a hashref???
|
| print "$fs{home}{bhuston}\n"; # prints 987...
| print "$fs{home}\n"; # HUH!? Prints 12345!
So, does $fs{home} contain a ref to a hash, or a scalar?
Seems like it can contain both, if carefully constructed.
Neither Data::Dumper nor the debugger reveal any ambiguities...
I would like to exploit this ambiguity to create a tree
structure, where a node contains a scalar value *and*
a reference to a hash containing names of child nodes.
Handy to represent the output of the unix "du" command:
| #!/usr/bin/perl
|
| open P, "/usr/bin/du -k /|" or die;
| @P=reverse <P>; # why must I reverse?
| close P;
| foreach (@P) {
| chomp;
| ($size, @path)=split '/';
| $tmp=join "\"}{\"", @path;
| eval "\$fs\{\"$tmp\"\} = $size";
| }
|
| traverse (\%fs, "/");
| sub traverse {
| my ($hashref, $prefix) = @_;
| foreach my $key (keys %$hashref) {
| printf "%-5d : %s\n", $hashref->{$key}, $prefix . $key;
| traverse (\%{$hashref->{$key}}, $prefix . $key . "/");
| }
| }
Questions:
1: What is going on here?
2: Why is the reverse needed?
3: Is this a feature that I can depend on being in future releases?
Thanks,
Bill
--
Bill Huston (bhuston@eden.com) Thu Oct 7 17:14:30 EDT 1999
Listen to my scale/mode calculator now enhanced w/MIDI files:
http://mu.clarityconnect.net/cgi-bin/scales
"Let every man make known what kind of government would command
his respect, and that will be one step toward obtaining it."
-- Thoreau, _Civil Disobedience_
------------------------------
Date: Thu, 07 Oct 1999 14:58:11 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: help for a perl script
Message-Id: <37FD1773.E25C82DF@mail.cor.epa.gov>
Wu Ye wrote:
>
> Hi all the perl expert there,
> I just start learning perl. I need some help on a simple perl script.
> I want a script taking a
> file name as input. The file contains some assembly code like following:
>
> add $1,$2,$3
> move $sp,$fp
> sub $5,$6,$7
> move $8,$9
> move $p,$k
> .....
> I need to replace all lines begun with "move", for example:
>
> move $sp,$fp ===> addu $sp,$0,$fp
> move $8,$9 ===> addu $8,$0,$9
>
> also, I need to replace all "$p" to "$testp".
It sounds like you want to use the regular expressions in
Perl. You can read up on them by typing the following at a
command prompt on a machine where Perl is installed:
perldoc perlre
Starter hint: the symbol '$' is used in regexes to mean the
end of the string. To match a literal '$' you'll want to
backwhack it, i.e. put a backslash in front of it. So,
to change all occurrences of $p to $testp in the variable
$line, you could do this:
$line =~ s/\$p/\$testp/g;
When you get some Perl code written, you may have more
questions. Feel free to ask about your code here, but
remember to post your code [trimmed to less than 30 lines,
please].
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Thu, 07 Oct 1999 20:27:37 GMT
From: "Norman Bunn" <norman.bunn@mci.com>
Subject: Hosts running Mason and ImageMagic
Message-Id: <Zm7L3.5976$Bf6.75999@pm02news>
Does anyone know of a web hosting company running Mason and/or ImageMagic?
Norman
------------------------------
Date: Thu, 07 Oct 1999 14:49:43 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: How to secure PERL-Scripts
Message-Id: <37FD1577.E5515570@mail.cor.epa.gov>
Norbert Schuldt wrote:
>
> Hi Folks,
Howdy,
> I've installed certain domains (customers) on my IIS. The homedirs are
> all
> located on one physical drive. All customers use their own cgi-bin dir.
> ActivePerl is installed.
>
> Now there might be one problem : Using the system() command in PERL one
> customer can easily get the other one's information (files) or even
> "damage" the
> server. Is there any possibility to give a cgi-bin access to the
> customers
> which is "secure" ??
You'll want to go to http://www.w3.org/security/Faq/
and get the WWW Security FAQ. It should help.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: 7 Oct 1999 15:23:55 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: html strip regexp error
Message-Id: <slrn7vq0so.1fk.abigail@alexandra.delanet.com>
ton (no@email.com) wrote on MMCCXXVIII September MCMXCIII in
<URL:news:7ti8f9$8n7$1@enterprise.cistron.net>:
%% Hi,
%%
%% Via the FAQ I got this regexp to strip HTML tags:
%%
%% $val =~ s{<(?:[^>'"]*|".*?"'.*?')+>}{}gsx;
The FAQ also tells you the above regex is a bad idea.
%% I'm using this statement to strip HTML from a string.
%% In a CGI environment.
%% Now I get servererrors:
%%
%% /<(?:[^>'"]*|".*?"'.*?')+>/: regexp *+ operand could be empty
Good. You shouldn't be using it.
%% Can any help to fix the expression, because it's a bit abracadabra to me.
Forget about using a regex on HTML. Parse it.
Abigail
--
perl -e '$a = q 94a75737420616e6f74686572205065726c204861636b65720a9 and
${qq$\x5F$} = q 97265646f9 and s g..g;
qq e\x63\x68\x72\x20\x30\x78$&eggee;
{eval if $a =~ s e..eqq qprint chr 0x$& and \x71\x20\x71\x71qeexcess}'
-----------== 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: Thu, 07 Oct 1999 20:35:00 GMT
From: emlyn_a@my-deja.com
Subject: Re: mkdir... and then!?
Message-Id: <7tj05j$8vc$1@nnrp1.deja.com>
I had already done exactly that (with quotes):
open(DATAFILE, ">/users/$NewUser/
thefile.dat") or die "Cannot create thefile.dat:
$!";
But it thinks the /users/$NewUser/thefile.dat is
the name that I want for the file itself, which is
not the case - It's taking it literally.
I'm using MacPerl, but I KNOW there's no
difference here, because I tested the same
thing on a PC using Apache, and it did the
SAME thing.
In fact, I haven't even been able to create a
directory within a directory, let alone create a
file in a directory. I've managed to create files
before, but never one that was outside of the
root.
My syntax is 100%, so this is weird...
Thanks for your help.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Thu, 07 Oct 1999 20:24:43 GMT
From: Scratchie <AgitatorsBand@yahoo.com>
Subject: Re: Perl & java
Message-Id: <fk7L3.395$Q11.75607@news.shore.net>
Surya P Kommareddy <surya@ucdavis.edu> wrote:
: Actually I would like to use Java applications which provide buttons,
: graphics etc. inside an application which is primarily a perl-cgi program.
: Any pointers... tutorials?
I assume that you can include these Java applets in a static web page by
including the appropriate HTML code, yes?
If that's the case, then you just output that same code from your CGI
program.
--Art
--
--------------------------------------------------------------------------
National Ska & Reggae Calendar
http://www.agitators.com/calendar/
--------------------------------------------------------------------------
------------------------------
Date: Thu, 07 Oct 1999 14:37:42 -0700
From: Dan Woods <dwoods@ucalgary.ca>
Subject: Re: Perl + Java
Message-Id: <7tj0h4$8aq@ds2.acs.ucalgary.ca>
xxx wrote:
> I know that I can call a C programm from a cgi written in perl and I would
> like to know if it's also possible to call a java application.
^^^^^^^^^^^^^^^^
Looks like you answered your own question. Assuming you have
Java installed on your server, use system() or backticks
to call it as "java application" :)
Thanks...Dan.
http://www.4loops.com
------------------------------
Date: Thu, 7 Oct 1999 17:42:39 -0400
From: "Bob Wilcox" <bwilcox@eudoramail.com>
Subject: perldoc -q
Message-Id: <939332782.145198@news.tir.com>
When I try something like perldoc -q perldoc -q "delete a line in a file"
that someone recently suggested, or any perldoc -q command, I get an invalid
option message. perldoc tells me the correct option is -f. Is this an old
version on our machine maybe?
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 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.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
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.
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 1015
**************************************