[8428] in Perl-Users-Digest
Perl-Users Digest, Issue: 2045 Volume: 8
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Mar 7 04:07:25 1998
Date: Sat, 7 Mar 98 01:00:38 -0800
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Sat, 7 Mar 1998 Volume: 8 Number: 2045
Today's topics:
Re: Are perl $SIG{} handlers inherently unsafe? (Gurusamy Sarathy)
Re: Are perl $SIG{} handlers inherently unsafe? (Ilya Zakharevich)
Re: Can I open a filehandle on a scalar? <zenin@best.com>
Re: CGI.pm and taint checking <bcoleman@mindspring.com>
Re: Finding absolute pathname [SEEDOC] (Martin Vorlaender)
Re: Finding absolute pathname <blan0416@uidaho.edu>
Getting STDERR from a program... kirk@kaybee.org
Re: Getting STDERR from a program... <jdf@pobox.com>
Graphical menus in Perl? kirk@kaybee.org
Re: Graphical menus in Perl? (Nathan V. Patwardhan)
Re: Length of an array? <jefpin@bergen.org>
Re: Length of an array? (Craig Berry)
Open to a device (Win32) <j-adamson@tamu.edu>
Re: Open to a device (Win32) <jdf@pobox.com>
Re: Open3 for Win32 (Gurusamy Sarathy)
Re: padding a file -- Better way?? <jefpin@bergen.org>
Re: Perl on MS Personal Web Server <jefpin@bergen.org>
Re: perl <ppanov@usa.net>
Re: perl <ebohlman@netcom.com>
Re: perl <webmaster@bruin.net>
Re: perl (Craig Berry)
Pw32i302...now this is just plain frustrating! <stackhou@execpc.com>
Re: Q: obscuring Perl scripts? <jbc@west.net>
Re: sockets to webservers (James E. Lee)
Re: Sort a hash table by it's values <jefpin@bergen.org>
Re: The -w switch (was Re: better way to do this?) <khera@kciLink.com>
Re: why no Case statment? (Tony Fitzgerald)
Digest Administrivia (Last modified: 8 Mar 97) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 7 Mar 1998 02:15:56 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Are perl $SIG{} handlers inherently unsafe?
Message-Id: <6dqaks$2lr@srvr1.engin.umich.edu>
[ mailed and posted ]
In article <6dmg4n$ejh1@eccws1.dearborn.ford.com>,
Ken Fox <kfox@ford.com> wrote:
>I'd actually like Perl to generate synthetic signals for SIGCHLD.
>Maybe even for all signals. That would let Perl define intuitive
>and portable semantics which would make user code a lot cleaner.
Please try the signal support in 5.004_62 (built with -Dusethreads)
and tell us if it works for you. (Signals are handled by a separate
thread, and are intended to "work".)
>- Ken
>
>** On a *real* operating system they would be. ;) I only ran my test
> on Solaris. Do other Unix variants queue SIGCHLD? Does NT do
> this right?
<NT>
What signals?
We don't do no steenking signals!
</NT>
- Sarathy.
gsar@umich.edu
------------------------------
Date: 7 Mar 1998 05:42:43 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Are perl $SIG{} handlers inherently unsafe?
Message-Id: <6dqmoj$2no$1@mathserv.mps.ohio-state.edu>
[A complimentary Cc of this posting was sent to Ilya Zakharevich
<ilya@math.ohio-state.edu>],
who wrote in article <6dl3fl$oq3$2@mathserv.mps.ohio-state.edu>:
> [A complimentary Cc of this posting was sent to Gabor
> <gabor@vmunix.com>],
> who wrote in article <slrn6fs2ea.9vk.gabor@vnode.vmunix.com>:
> > In comp.lang.perl.misc, Tom Christiansen <tchrist@mox.perl.com> wrote :
> > # [courtesy cc of this posting sent to cited author via email]
> > #
> > # In comp.lang.perl.misc, dac@kalypso.cybercom.net (Daniel Childers) writes:
> > # :Synopsis: are perl $SIG{} handlers inherently unsafe due to the danger of
> > # :concurrent malloc() calls (and/or higher-level perl data structure mods)
> > # :in user and interrupt context?
> > #
> > # Yes.
> >
> > Is it unsafe to even just do this in a server
> >
> > $SIG{CHLD} = sub { wait; };
> >
> > ?
>
> You have seen the answer already. (Though I would think that
>
> $SIG{CHLD} = sub { wait; return; };
>
> is safe in my OS/2 binary release, which contains a voodoo patch which
> is not allowed into the main distribution.)
I rechecked, here is an update:
Newer Perls are smart enough to call a sighandler in VOID context,
so an empty `return' does not change things. Moreover, on most
architectures `wait' is malloc-safe.
Thus the only problem with the above sighandler is the
subroutine-call-frame. I think my voodoo patch fixes
subroutine-call-frame problem (at least with gcc 2.7.2 which I have
here), so your sighandler would be safe with OS/2 port (unless on DOS,
when `wait' is not malloc-safe).
Ilya
------------------------------
Date: 7 Mar 1998 02:37:40 GMT
From: Zenin <zenin@best.com>
Subject: Re: Can I open a filehandle on a scalar?
Message-Id: <889238594.597660@thrush.omix.com>
Quentin Fennessy <quentin@jihad.amd.com> wrote:
: "Luis J. Martinez" <luis@utdallas.edu> writes:
: > I want to open a filehandle on a scalar string rather than a file, so I can
: > do file operations on it. Is there a way to do this?
:
: Check out IO::File.
Huh? Please explain. IO::File has no tied handle scalar interface
that I've seen or is documented.
--
-Zenin
zenin@best.com
------------------------------
Date: Sat, 07 Mar 98 01:31:32 +0400
From: "Ben Coleman" <bcoleman@mindspring.com>
Subject: Re: CGI.pm and taint checking
Message-Id: <zcckswwgezcbgay.pminews@user-38lcb5c.dialup.mindspring.com>
On Fri, 06 Mar 1998 11:46:10 -0600, schwern@starmedia.net wrote:
> open(FOO,"echo $arg|"); # Not OK, but...
I suspect this situation is what he's talking about, with the
equivalent of $arg coming from a web form field.
I have vague recollections of encountering Unexpected Results in just
this situation, compounded by Inconsistant Results depending on
whether the script was run from the web server or from the command
line. This was on Win32.
And a quick test under my local linux box show this:
-----------------
#!/usr/bin/perl -T
use CGI;
use CGI::Carp;
my $query = new CGI;
$ENV{"PATH"} = "/bin:/usr/bin";
$arg = $query->param('testline');
print "Content-Type: text/plain\n\n";
open(FOO, "cat $arg|") or die "Can't open $arg - $!";
@file = <FOO>;
close FOO;
foreach $line (@file) {
print "$line";
}
-----------------
runs without dying from a taint error both from the command line and
from Apache(perl 5.004_01 on Slackware 3.3). Methinks he may have a
point.
Ben
--
Ben Coleman NJ8J | The attempt to legislatively
Internet: bcoleman@mindspring.com | micromanage equality results, at
http://bcoleman.home.mindspring.com/ | best, in equal misery for all.
------------------------------
Date: Sat, 07 Mar 1998 06:34:17 +0100
From: martin@RADIOGAGA.HARZ.DE (Martin Vorlaender)
Subject: Re: Finding absolute pathname [SEEDOC]
Message-Id: <3500dc59.524144494f47414741@radiogaga.harz.de>
John Goerzen (jgoerzen@southwind.net) wrote:
: When given a filename, say in $0, what is a good way to get the
: absolute path to the filename? For instance, $0 might contain
: "./test.pl" and I want to get /home/jgoerzen/test.pl out of it.
: There is a realpath(3) call in C that accomplishes this but I see no
: equivolent in Perl. Ideas?
Especially for $0:
perldoc FindBin
cu,
Martin
--
| Martin Vorlaender | VMS & WNT programmer
Ceterum censeo | work: mv@pdv-systeme.de
Redmondem delendam esse. | http://www.pdv-systeme.de/users/martinv/
| home: martin@radiogaga.harz.de
------------------------------
Date: Fri, 06 Mar 1998 17:10:29 -0800
From: Derek Blandford <blan0416@uidaho.edu>
To: John Goerzen <jgoerzen@southwind.net>
Subject: Re: Finding absolute pathname
Message-Id: <35009E85.F9B9D84D@uidaho.edu>
On my version of UNIX, 'env' at the command line gives a list of all
environmental variables. $ENV{'PWD'} gives the entire directory path leading
up to the file that is being run. Note: this only works if PWD is a variable
found when typing env and also the program must be called from the command
line (or within Unix) and not by, i.e., a web page (different environmental
variable list).
Jason
> When given a filename, say in $0, what is a good way to get the
> absolute path to the filename? For instance, $0 might contain
> "./test.pl" and I want to get /home/jgoerzen/test.pl out of it.
>
> There is a realpath(3) call in C that accomplishes this but I see no
> equivolent in Perl. Ideas?
>
> Thanks,
> John
------------------------------
Date: 7 Mar 1998 04:53:28 GMT
From: kirk@kaybee.org
Subject: Getting STDERR from a program...
Message-Id: <6dqjs8$pre@smash.gatech.edu>
I want to run a program from inside Perl and then process
the program's STDERR. Currently, I have to redirect this
STDERR to a file and then process that file...
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Kirk Bauer -- Georgia Tech -- kirk@kaybee.org <== Finger for PGP
http://www.kaybee.org/~kirk ResNet RTA Computer Engineering
GT Sport Parachuting Club! http://cyberbuzz.gatech.edu/skydive
------------------------------
Date: 07 Mar 1998 02:11:14 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Getting STDERR from a program...
Message-Id: <ra4f0yct.fsf@news.concentric.net>
kirk@kaybee.org writes:
> I want to run a program from inside Perl and then process
> the program's STDERR. Currently, I have to redirect this
> STDERR to a file and then process that file...
You're sure to dig perlfaq8, "How can I capture STDERR from an
external command?"
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 7 Mar 1998 04:52:33 GMT
From: kirk@kaybee.org
Subject: Graphical menus in Perl?
Message-Id: <6dqjqh$pre@smash.gatech.edu>
Is there a better way (without using any extra modules) to display
a nice, graphical menu besides forking the 'dialog' program??
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Kirk Bauer -- Georgia Tech -- kirk@kaybee.org <== Finger for PGP
http://www.kaybee.org/~kirk ResNet RTA Computer Engineering
GT Sport Parachuting Club! http://cyberbuzz.gatech.edu/skydive
------------------------------
Date: 7 Mar 1998 05:21:30 GMT
From: nvp@shore.net (Nathan V. Patwardhan)
Subject: Re: Graphical menus in Perl?
Message-Id: <6dqlgq$p00@fridge.shore.net>
kirk@kaybee.org wrote:
: Is there a better way (without using any extra modules) to display
: a nice, graphical menu besides forking the 'dialog' program??
Yes, get pTk. It's included with the win32 Standard version,
available on CPAN.
--
Nathan V. Patwardhan
------------------------------
Date: Fri, 6 Mar 1998 11:36:24 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: "Keith L. Miller" <miller@bigsky.net>
Subject: Re: Length of an array?
Message-Id: <Pine.SGI.3.95.980306113541.4211A-100000@vangogh.bergen.org>
$_ = "This is a test!";
@fields = split (/ /, $_);
$num_of_fields = @fields; #This forces @fields into scalar context
#which returns the number of elements
--
| I am NOT a mother!
| - Jennifer Pinyan
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
techmaster@bergen.org | techmaster@mindless.com
qw[jeff] on #perl,#javascript,#cgi on IRC
&jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}
------------------------------
Date: 7 Mar 1998 05:04:22 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Length of an array?
Message-Id: <6dqkgm$e55$1@marina.cinenet.net>
Hermann Fass (hf@aia.com) wrote:
: Keith L. Miller wrote:
:
: > how can I know what the length of the array ....
:
: @myArray = split (.....);$length=$#myArray;
That actually sets $length to one less than the length of @myArray. I
believe you mean '$length = @myArray'.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Fri, 06 Mar 1998 23:26:30 -0800
From: John Adamson <j-adamson@tamu.edu>
Subject: Open to a device (Win32)
Message-Id: <3500F6A6.15FC@tamu.edu>
In running scripts on either an NT or 95 box, all my experience in using
the open() function has been in connection with files, not devices. I'm
now interested in output to a com port, but can't find anything in any
of my perl reference books explaining the appropriate syntax. (Or at
least I don't recognize it as such! :-))
Can anyone tell me what the correct syntax would be for, say,
open(OUTPUT,">COM2:") (which, obviously, doesn't work).
Your indulgence with this trifling question will be appreciated! TIA
--
John Adamson
TX Ag. Extension Svc/Texas A&M Univ System
j-adamson@tamu.edu
------------------------------
Date: 07 Mar 1998 02:14:28 -0500
From: Jonathan Feinberg <jdf@pobox.com>
Subject: Re: Open to a device (Win32)
Message-Id: <pvjz0y7f.fsf@news.concentric.net>
John Adamson <j-adamson@tamu.edu> writes:
> Can anyone tell me what the correct syntax would be for, say,
> open(OUTPUT,">COM2:") (which, obviously, doesn't work).
Probably someone else will be able to give you sound,
platform-specific advice, which the FAQ itself does not attempt to
provide. However, take a look at the FAQ in the meantime. See
perlfaq8, "How do I read and write the serial port?"
--
Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
------------------------------
Date: 7 Mar 1998 02:43:44 GMT
From: gsar@engin.umich.edu (Gurusamy Sarathy)
Subject: Re: Open3 for Win32
Message-Id: <6dqc90$3sj@srvr1.engin.umich.edu>
[ mailed and posted ]
In article <19980306195601.OAA18927@ladder02.news.aol.com>,
RonaldWS <ronaldws@aol.com> wrote:
>I have managed to come up with some perl functions on my own that duplicate8<
>basic functionality of IPC::Open3 (i.e. create a process and redirect the t8<
>standard handles to that process through pipes to the parent process). If
>Open3 is not yet ported is anyone interested in this work?
We sure are. Send your patches to <perl5-porters@perl.org>.
Thanks,
- Sarathy.
gsar@umich.edu
------------------------------
Date: Thu, 5 Mar 1998 22:24:22 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: Douglas Cordero <dcordero@giss.nasa.gov>
Subject: Re: padding a file -- Better way??
Message-Id: <Pine.SGI.3.95.980305222304.14469D-100000@vangogh.bergen.org>
> I wrote a subroutine to space pad a variable length
>text array to 80 left justified characters.
>Does it look OK? Is there a better way?
>Is there a module or something that has this built-in?
Do you know about formats? They're useful...
man perlform to find out more, or change the man pages online somewhere.
>sub padder {
> my( @val ) = @_;
> my( @paddedval );
> @paddedval = ();
> foreach (@val) {
> @paddedval = (@paddedval, sprintf "%-80.80s", $_ );
# or: push (@paddedval, (sprintf "%-80.80s", $_));
> }
> return @paddedval;
>}
--
| The dumber people think you are, the more surprised they're going
| to be when you kill them.
| - William Clayton
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
techmaster@bergen.org | techmaster@mindless.com
qw[jeff] on #perl,#javascript,#cgi on IRC
&jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}
------------------------------
Date: Thu, 5 Mar 1998 10:18:04 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: Steven Savage <badger@infinet.com>
Subject: Re: Perl on MS Personal Web Server
Message-Id: <Pine.SGI.3.95.980305101659.27928A-100000@vangogh.bergen.org>
>I've been wrestling with getting PERL to work on an MS Personal Web
>Server to demo a PERL search engine. Does anyone know how to get this to
>work? it seems my file associations just aren't enough.
MSPWS is just evil.
Get OmniHTTPd
It's a much nicer interface, free, easy to use, and allows for a WHOLE lot
more. I can't remember the url of the top of my head.... look for it on
yahoo.com
--
| Before you think UNIX is family-oriented, note that all children
| must die.
| - Cross-Platform Perl
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
techmaster@bergen.org | techmaster@mindless.com
qw[jeff] on #perl,#javascript,#cgi on IRC
&jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}
------------------------------
Date: Fri, 06 Mar 1998 20:13:36 -0500
From: Dmitry Ivanov <ppanov@usa.net>
Subject: Re: perl
Message-Id: <35009F40.648B@usa.net>
Jonathan Feinberg wrote:
>
> Ralph Rickes <rickesr@pamco.com> writes:
>
> > Help. I have never used perl before, but I have to write a small program
> > to re-format an inventory file.
>
> > I have looked through
> > a book I have on perl, but I can't find anything to help me copy, seperate
> > it and then print it out. Thank you.
>
> You'll have to do one of two things:
>
> 1) Hire someone who knows Perl.
Like you, smart ass?
>
> 2) Do a bit more than "look through a book." I'd recommend that you
> buy and read _Learning Perl_. This newsgroup cannot teach you Perl.
>
Will you also do smth, such as stop flooding here, since your endless
wise answers and advices make this ng unusable. This is not your
property, so we would discuss here what we like in any conjunction with
perl or whatever
> --
> Jonathan Feinberg jdf@pobox.com Sunny Brooklyn, NY
D.Ivanov, Cloudy Stamford, CT
------------------------------
Date: Sat, 7 Mar 1998 05:32:34 GMT
From: Eric Bohlman <ebohlman@netcom.com>
Subject: Re: perl
Message-Id: <ebohlmanEpFoqA.LBr@netcom.com>
Ralph Rickes <rickesr@pamco.com> wrote:
: Help. I have never used perl before, but I have to write a small program
: to re-format an inventory file. The file has five fields right now. I
: have to cut it down to three fields with different spec's. The first
: second nd fourth fields are needed. Right now they are seperated by
: tabs, and the second field has some single spaces. The 1st field is the
: parts number, 2nd is description, 3rd is the price. I have looked through
: a book I have on perl, but I can't find anything to help me copy, seperate
: it and then print it out. Thank you.
You'll need to do some further research, but fortunately it will all be
on documentation that came with your installation of Perl (if not, you
can find it at www.perl.com).
First you'll want to look at perlrun (since I don't know the platform
you're on, I'm going to suggest doing this via "perldoc perlrun") to learn
about several command-line switches that will make Perl do quite a bit of
what you need without writing any code to do it. You'll particularly want
to look at what the -p, -a, -i, -e and -F (remember that case is
significant here) switches do. At that point, you may already know how to
write the script. If not, perldoc perldata to learn how to refer to
variables, and perldoc -f print to learn how to output them.
------------------------------
Date: Fri, 06 Mar 1998 22:13:17 -0800
From: Marty McKolskey <webmaster@bruin.net>
Subject: Re: perl
Message-Id: <3500E57D.D8F3A621@bruin.net>
> > > Help. I have never used perl before, but I have to write a small program
> > > to re-format an inventory file. I have looked through a book I have on perl,
> > > but I can't find anything to help me copy, seperate it and then print it out. >
> > Jonathan Feinberg wrote:
> > You'll have to do one of two things:
> > 1) Hire someone who knows Perl.
> Dmitry Ivanov wrote:
> Like you, smart ass?
> > Jonathan Feinberg wrote:
> > 2) Do a bit more than "look through a book." I'd recommend that you
> > buy and read _Learning Perl_. This newsgroup cannot teach you Perl.
> Dmitry Ivanov wrote:
> Will you also do smth, such as stop flooding here, since your endless
> wise answers and advices make this ng unusable. This is not your
> property, so we would discuss here what we like in any conjunction with
> perl or whatever
You know, after perusing the posts currently available, I noticed a few
things:
1. That "smart-ass" has made dozens of very helpful, informed
suggestions, including
this one.
2. Also note that your only post to this group currently is the above
uninformative
rant.
3. Mr. Feinberg's response was succinct, professional, polite and
honest. Yours was
personally insulting, childish, rude, and totally unnecessary.
4. According to all documentation I have so far come into contact with,
the purpose of
this newsgroup is for experienced programmers to discuss perl.
Nowhere does it
state that this is a place for unexperienced programmers to ask
others to write
programs for them. In that, I would have to agree with Mr.
Feinberg's response, and
totally disagree with yours.
My point? I wish _I_ was a smart ass.
Marty
--
my $name = 'Marty';
my $email = 'marty@marty.net';
last;
------------------------------
Date: 7 Mar 1998 07:57:58 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: perl
Message-Id: <6dqum6$pur$1@marina.cinenet.net>
Dmitry Ivanov (ppanov@usa.net) wrote:
: Jonathan Feinberg wrote:
: > Ralph Rickes <rickesr@pamco.com> writes:
: > > Help. I have never used perl before, but I have to write a small program
: > > to re-format an inventory file.
: > > I have looked through
: > > a book I have on perl, but I can't find anything to help me copy, seperate
: > > it and then print it out. Thank you.
: >
: > You'll have to do one of two things:
: >
: > 1) Hire someone who knows Perl.
:
: Like you, smart ass?
Hey, deep breath, no need to go ad hominem. What Jonathan is saying is
perfectly true; this guy has to either learn Perl (a nontrivial task for
most people) or hire someone who already has done so. Are you saying
that a working, high-quality Perl script can come into existence in some
other way?
It never ceases to amaze me that people expect programming to be easy.
: > 2) Do a bit more than "look through a book." I'd recommend that you
: > buy and read _Learning Perl_. This newsgroup cannot teach you Perl.
:
: Will you also do smth, such as stop flooding here, since your endless
: wise answers and advices make this ng unusable. This is not your
: property, so we would discuss here what we like in any conjunction with
: perl or whatever
You certainly *can*, but if it's 'whatever' rather than Perl, you're
off-topic according to the charter, and thus committing Usenet abuse.
Personally, I have no problem with trying to persuade people to RTFM
rather than begging for ill-defined help here...though I do have doubts
about the effectiveness of this strategy, sad to say.
---------------------------------------------------------------------
| Craig Berry - cberry@cinenet.net
--*-- Home Page: http://www.cinenet.net/users/cberry/home.html
| Member of The HTML Writers Guild: http://www.hwg.org/
"Every man and every woman is a star."
------------------------------
Date: Fri, 06 Mar 1998 20:52:23 -0600
From: Mark Stackhouse <stackhou@execpc.com>
Subject: Pw32i302...now this is just plain frustrating!
Message-Id: <6dqd0t$r9a@newsops.execpc.com>
HELP... I downloaded Ps32i302.exe and ran it from my
Windows95 "run". The install MS-DOS batch file
automatically launched and installed Perl. So far... no
problem! I then used "Notepad" to enter the "Hello World"
program right out of my "Learning Perl" book. HOW DO I RUN
THE SCRIPT??? If I try to run it from a DOS prompt, I'm
told that the program can't be run from DOS. If I try to
run it with Windows95 "run", it launches Notebook with my
source!!! What gives? I feel dumber than dirt!
--
Mark Stackhouse
***********************************************************************
homepage: http://www.execpc.com/~stackhou
"The best things in life aren't things."
--Art Buchwald
***********************************************************************
------------------------------
Date: Fri, 06 Mar 1998 17:48:12 -0800
From: John Callender <jbc@west.net>
Subject: Re: Q: obscuring Perl scripts?
Message-Id: <3500A75C.400515AC@west.net>
> markw@markwatson.com (Mark Watson) writes:
> > Sorry if this is a FAQ (I looked), but are there any
> > tools for (slightly) obscuring Perl scripts; something
> > simple like converting variable names to a1, a2, etc.?
The good people at Elsop have something to do this (I don't know if
they'd make it available, but you could always ask). I know this because
I purchased their Linkscan product (very happy with it, by the way), and
at one point I wanted to take a look at it to try to solve a mildly
annoying bug, and found that the Perl source looked like this:
$bgYF =
"JExzZGlyID0gIi4vIjskV3NhVXcgPSAwOyRybVRPRXYgPSAwOyRGUVp4b3kgPSAwOyZaYkV
KcXI7aWYgKCRGUVp4b3kgPT0gMSkgeyR0VVdRSyA9ICJMaW5rU3B5ZGVyIjsgfQ==";eval(&TKuB($b
gYF));
$cfQkd = "";foreach $mUDBJ (@ARGV) {$cfQkd = "$cfQkd $mUDBJ";}$cfQkd =~
s/^\s*//
;print "\n$tUWQK Version $wzSO.\n\n";
[etc.]
I asked Malcolm Hoar, the program's author, about it, and he told me
he'd looked around for something to obscure the code, but ended up just
rolling his own code-obscurer, and had found it to be not too hard a
task.
Now, I know the FAQ dogma re: security through obscurity being
essentially unreliable, but the fact is that this is a case where some
simple munging serves a highly useful purpose. I *know* any given Perl
guru, with sufficient incentive, could convert this back to human
readable perl. But why would they bother? Even powerful public-key
cryptography doesn't *guarantee* security; it simply puts the cost of
decoding a given piece of data beyond the point where it's worth doing.
Likewise with this. How much would it be worth to a given Linkscan
customer to decode this $495 software? Not much -- especially given the
existence of a suitably restrictive license agreement. The Perl FAQ's
implicit insistence that one put *all* one's faith in lawyers, though,
seems kind of naive (or disingenuous) to me, especially when perl makes
it so easy to muck up the source.
Now, from a philosophical standpoint, I can completely understand folks
like Randal and Tom and Larry finding it abhorrent that there would be
perl code floating around out there that had been intentionally
de-legiblized for any reason other than a $100 Obfuscated Perl prize.
But the fact remains, Perl is being used to create commercial products,
and sometimes the creators would just as soon use the power of the
language to make it *harder* (not impossible, just harder) for people to
rip off their intellectual property.
http://www.elsop.com/
--
John Callender
jbc@west.net
http://www.west.net/~jbc/
------------------------------
Date: 7 Mar 1998 03:16:00 GMT
From: jelee@atlas.ucdavis.edu (James E. Lee)
Subject: Re: sockets to webservers
Message-Id: <6dqe5g$20k$1@mark.ucdavis.edu>
Kaj Hejer (kaj.hejer@usit.uio.no) wrote:
[...]
> $sock->print('Hi!\n\n');
> print "after print:$!:\n";
> print $sock->getline);
-------------------------^^^
Could this be part of the problem?
james
_________________________________________________
James E. Lee jelee@ucdavis.edu
------------------------------
Date: Fri, 6 Mar 1998 22:47:43 -0500
From: "I have a life, and I can prove it!" <jefpin@bergen.org>
To: Alex Schajer <alexs@online.emap.com>
Subject: Re: Sort a hash table by it's values
Message-Id: <Pine.SGI.3.95.980306223021.10664A-100000@vangogh.bergen.org>
>$TEAM{'alex'} = 4
>$TEAM{'perl'} = 2
>$TEAM{'unix'} = 5
>I would like to rank these and get the results:
>$TEAM{'unix'} = 5
>$TEAM{'alex'} = 4
>$TEAM{'perl'} = 2
foreach (sort { $TEAM{$a} <=> $TEAM{$b} } keys %TEAM){
print "$_ -> $TEAM{$_}\n";
}
--
| Here we are now, entertain us!
| - Nirvana
Jeff Pinyan | http://users.bergen.org/~jefpin | jefpin@bergen.org
techmaster@bergen.org | techmaster@mindless.com
qw[jeff] on #perl,#javascript,#cgi on IRC
&jp('"($``','','$)EDF8```','$*52J4```','$+E1G4```','#J``@','#2__`');sub
jp{for$w(@_){$c=unpack('B48',unpack('u',$w));$c=~tr/10/# /;print "$c\n"}}
------------------------------
Date: 04 Mar 1998 15:09:16 -0500
From: Vivek Khera <khera@kciLink.com>
Subject: Re: The -w switch (was Re: better way to do this?)
Message-Id: <x7en0ib4lv.fsf@kci.kciLink.com>
>>>>> "Z" == Zenin <zenin@best.com> writes:
Z> When the p5p declare to never add another warning type or condition
Z> I'll change my stance. Until then, I'll nuke that -w from all
Z> production code that has the slightest chance of causing problems.
So tell me, why do you upgrade production servers without first
testing the changes on a crash/development machine? If the service is
*that* valuable, you most certainly should be doing this and can
afford to do it.
--
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Vivek Khera, Ph.D. Khera Communications, Inc.
Internet: khera@kciLink.com Rockville, MD +1-301-258-8292
PGP/MIME spoken here http://www.kciLink.com/home/khera/
------------------------------
Date: 6 Mar 1998 21:39:23 -0400
From: jaf@sarastro.unb.ca (Tony Fitzgerald)
Subject: Re: why no Case statment?
Message-Id: <6dq8gb$jf8@sarastro.unb.ca>
In article <34F72484.67D6@min.net>, John Porter <jdporter@min.net> wrote:
>Now, given these two ways of doing it:
> $d{$z}->();
> and
> &{ $d{$z} };
>can you tell me what the difference is, if any?
I hate to resurrect what appears to be a dead thread, however, you received
no responses to the query. Assuming the question is not rhetorical, the
difference is that $d{$z}->() passes a null argument list to the function
while &{$d{$z}} passes the argument list of the calling function to the
called. As near as I can tell, &{$d{$z}}() is equivalent to $d{$z}->(),
however, if anyone knows whether there are subtle differences between
these, I would like to know.
--
O- J. Anthony Fitzgerald, jaf@UNB.ca, http://www.unb.ca/csd/staff/jaf/ -O
------------------------------
Date: 8 Mar 97 21:33:47 GMT (Last modified)
From: Perl-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 8 Mar 97)
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 V8 Issue 2045
**************************************