[18656] in Perl-Users-Digest
Perl-Users Digest, Issue: 824 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed May 2 18:20:04 2001
Date: Wed, 2 May 2001 15:10:12 -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: <988841411-v10-i824@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 2 May 2001 Volume: 10 Number: 824
Today's topics:
Re: Hacker challenge. Can you break this script for me? <godzilla@stomp.stomp.tokyo>
Re: Hacker Challenge. Can you break this script for me? (Randal L. Schwartz)
Re: Hacker challenge. Can you break this script for me? <bart.lateur@skynet.be>
Re: Hacker challenge. Can you break this script for me? <jfreeman@tassie.net.au>
Re: Hacker challenge. Can you break this script for me? <bart.lateur@skynet.be>
Re: Hacker challenge. Can you break this script for me? (Randal L. Schwartz)
Re: Hacker challenge. Can you break this script for me? (Anno Siegel)
Re: Hacker challenge. Can you break this script for me? (Anno Siegel)
Re: Hacker challenge. Can you break this script for me? <godzilla@stomp.stomp.tokyo>
Re: Help: Time issue <krahnj@acm.org>
Re: HTML::LinkExtor problem <Jonathan.L.Ericson@jpl.nasa.gov>
Re: IMAP server in perl? <djberge@uswest.com>
Re: Infinate loop <goldbb2@earthlink.net>
Re: Perl and Upgrading? (Andy Dougherty)
Re: Please help! <jpratt@ssr-inc.com>
Re: Please help! <godzilla@stomp.stomp.tokyo>
Re: Prevent warning: check for open file handle? (Greg Bacon)
Re: Problem with "require" in server <djberge@uswest.com>
profiling <dnp@ams.org>
Re: Regular expression for zip code (Anno Siegel)
Removing blank lines from end of data <nospam@newsranger.com>
Re: Removing blank lines from end of data (Steven M. O'Neill)
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 02 May 2001 11:15:00 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <3AF04EA4.E95890D4@stomp.stomp.tokyo>
Jfreeman wrote:
> "Godzilla!" wrote:
> > Uri Guttman wrote:
> > > Anno Siegel wrote:
> > > > Jfreeman wrote:
(snipping and listening to my Forty-Thousand Headmen)
> > Actually, his comment stripper does fairly much everything
> > it should. However, I am not so sure his overall approach
> > is all that logical. No need to compile a script in order
> > to strip comments.
> I use the compile as a check for strip integrity. New compile routine compiles
> everyting the perl -c does, as I have found a way to capture the required
> output. New today (from the revision history):
> Rewrote compile checking routine to a much better one as Godzilla! was cross,
> and we all know what happens when Godzilla! gets cross.
* makes a Sign of the Zorro *
Oh yes! Never cross Godzilla! She will stomp you!
Spit Fire Bitch, she is alright!
I cannot fathom why you are compiling scripts simply
to strip comments. This is so illogical and certainly
an invitation for bugs to establish a Roach Motel. This
is well exemplified by my use of variable names which
FUBAR your own. Slick trick, don't you think? However,
you did indeed ask for this con job of mine by using
such commonplace variable names. I mean, who else
around here besides myself, is a true Perl hacker?
KISS
Keep It Simple Silly. Establish a set of program rules,
open a script in a filehandle style and strip comments!
This is, treat a script to be stripped as an input string
independent of your own processes.
I made mention of problems with modules. This is yet
another bug with a hotel room key to your program. Your
intent is to strip a script, not a module. There will
be those, such as myself, who will most likely strip
comments at home on a system which will not have an
extensive collection of modules on hand. Your program
crashes and burns if a module cannot be found. This
is quite illogical as well. Do you suppose there are
other problems of a similar nature?
Your ego is commanding you to spend too much time
defending your script. Put a leash on it.
Never try to con this con again. Your 'eval' con
certainly backfired in your face. As you know
from long experience, I am not easily fooled
and possess an innate ability to turn tables
with no more than a wiggle of my little finger.
MUUUUHAHAHAHAHAHAHAHAAA!!!!!
Godzilla! Queen Of Forty-Thousand Headmen.
------------------------------
Date: 02 May 2001 11:14:36 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Hacker Challenge. Can you break this script for me?
Message-Id: <m1r8y7vcs3.fsf@halfdome.holdit.com>
>>>>> "Jfreeman" == Jfreeman <jfreeman@tassie.net.au> writes:
Jfreeman> Thank you. I have responded to your problem. If you check out the new script you
Jfreeman> will find the new reliable compile checker, the optional bytecode checker,
Jfreeman> the diff comparison file and a few misc bits and pieces.
It's too bad for me that you didn't make this 5.5.3 compatible, because
then I would play along. I never installed 5.6.0 on my production
boxes, and 5.6.1 still needs a bit more shakeout before I adopt it.
However, I did take a quick scan at the code. Why do you single out /
for the dual-nature? There's about eight characters that are like
that. For example, <.
sin <$handle;#this>; die "this dies";
time <$handle;#this>; die "this doesn't die";
Back to the drawing board.
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 02 May 2001 18:38:24 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <n3l0ftce36c8qrdfge6gps27r56cjg45u5@4ax.com>
Jfreeman wrote:
>> > s#a#b#;
>> > /a//m#b#;
>> >
>> >This is valid Perl.
>> >
>> > s
>> > /a//m
>
>This does not break the script, see demo
Apparently, it doesn't. Well done.
But the point I was aiming at, is that you may not assume that only
comments got stripped, if the resulting script still compiles.
A counter example:
$_ = 'print $[';
s/.*//; # strip simply everything
eval;
print $@ || "All is well.\n";
-->
All is well.
Obviously, that isn't true.
--
Bart.
------------------------------
Date: Thu, 03 May 2001 04:52:51 +1000
From: Jfreeman <jfreeman@tassie.net.au>
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <3AF05783.8C6CA6CA@tassie.net.au>
"Godzilla!" wrote:
> Jfreeman wrote:
>
> > "Godzilla!" wrote:
> > > Uri Guttman wrote:
> > > > Anno Siegel wrote:
> > > > > Jfreeman wrote:
>
> (snipping and listening to my Forty-Thousand Headmen)
>
> > > Actually, his comment stripper does fairly much everything
> > > it should. However, I am not so sure his overall approach
> > > is all that logical. No need to compile a script in order
> > > to strip comments.
>
> > I use the compile as a check for strip integrity. New compile routine compiles
> > everyting the perl -c does, as I have found a way to capture the required
> > output. New today (from the revision history):
>
>
> > Rewrote compile checking routine to a much better one as Godzilla! was cross,
> > and we all know what happens when Godzilla! gets cross.
>
> * makes a Sign of the Zorro *
>
> Oh yes! Never cross Godzilla! She will stomp you!
> Spit Fire Bitch, she is alright!
>
> I cannot fathom why you are compiling scripts simply
> to strip comments. This is so illogical and certainly
> an invitation for bugs to establish a Roach Motel. This
> is well exemplified by my use of variable names which
> FUBAR your own. Slick trick, don't you think?
Yes, but now with the new caffeine powered, turbocharged, chrome plated, compile
checker......
C:\>type test1.pl
#!perl
# test script 1
$path = "gigo";
&Break_Code;
sub Break_Code
{
local($path) = "garbage in garbage out";
print $path;
}
C:\>perl stripcomments.pl test1.pl
Compile check .\test1.pl
Backup of original script written to .\test1.pl.bak1
Processing...
Compile check .\test1.pl
Done! Comment stripped file .\test1.pl
C:\>type test1.pl
#!perl
# Stripped by stripcomments.pl (c) Dr James Freeman jfreeman@tassie.net.au
$path = "gigo";
&Break_Code;
sub Break_Code
{
local($path) = "garbage in garbage out";
print $path;
}
C:\>type test2.pl
#!perl
# test 2
$found = "gigo";
&Break_Code;
sub Break_Code
{
local($found) = "garbage in garbage out";
print $found;
}
C:\>perl stripcomments.pl test2.pl
Compile check .\test2.pl
Backup of original script written to .\test2.pl.bak
Processing...
Compile check .\test2.pl
Done! Comment stripped file .\test2.pl
C:\>type test2.pl
#!perl
# Stripped by stripcomments.pl (c) Dr James Freeman jfreeman@tassie.net.au
$found = "gigo";
&Break_Code;
sub Break_Code
{
local($found) = "garbage in garbage out";
print $found;
}
C:\>
> However,
> you did indeed ask for this con job of mine by using
> such commonplace variable names. I mean, who else
> around here besides myself, is a true Perl hacker?
$_ ='2172656b636148206c7265502061207369206c696167696241';no warnings;
sub never{print$out}sub in_half{$wit=sub{chr(hex(@_[0]))}};while($_)
{$_.='U';chop;$me=chop;$me=chop.$me;in_half;$out.=$wit->($me);}never;
>
>
> KISS
>
> Keep It Simple Silly. Establish a set of program rules,
> open a script in a filehandle style and strip comments!
> This is, treat a script to be stripped as an input string
> independent of your own processes.
>
> I made mention of problems with modules. This is yet
> another bug with a hotel room key to your program. Your
> intent is to strip a script, not a module. There will
> be those, such as myself, who will most likely strip
> comments at home on a system which will not have an
> extensive collection of modules on hand. Your program
> crashes and burns if a module cannot be found.
I presume you mean the B modules for `perlcc -b -o pbyscript myscript`
These are part of the standard 5.6.0 distribution so should be avaiable.
It is only an option to fool around with, and I like it.
> This
> is quite illogical as well. Do you suppose there are
> other problems of a similar nature?
No it is perfectly logical. If you strip a script that is used for a 'real' purpose,
you know the jargon
"High availability, mutiply redundant, mission critical coffer machine". Anyway if
you strip such a
beast you would like to know if still works. Well Rudolf asked for it and I was all
out of red noses....
>
>
> Your ego is commanding you to spend too much time
> defending your script. Put a leash on it.
Whoops, to late
Sleep 28800;
Cheers
James
Dr. James A. D. Freeman B.Sc., M.B,B.S, etc.
>
>
> Never try to con this con again. Your 'eval' con
> certainly backfired in your face. As you know
> from long experience, I am not easily fooled
> and possess an innate ability to turn tables
> with no more than a wiggle of my little finger.
>
> MUUUUHAHAHAHAHAHAHAHAAA!!!!!
>
> Godzilla! Queen Of Forty-Thousand Headmen.
------------------------------
Date: Wed, 02 May 2001 19:57:24 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <7eo0fto4ddbkul1de4nu81hc94sms82do9@4ax.com>
Godzilla! wrote:
>I cannot fathom why you are compiling scripts simply
>to strip comments.
Seen that perl compiles a script every time it runs it, the penalty is
not that bad. But it's not sufficient as a test. If, for example, you
delete half of the statements in a 1000 line script, the result will
still compile, but as a comment stripper, it failed to do what it was
supposed to do: strip comments and nothing else.
>I made mention of problems with modules. This is yet
>another bug with a hotel room key to your program. Your
>intent is to strip a script, not a module. There will
>be those, such as myself, who will most likely strip
>comments at home on a system which will not have an
>extensive collection of modules on hand. Your program
>crashes and burns if a module cannot be found. This
>is quite illogical as well.
It's not *that* illogical. Randal has a few favourite examples, on how
loading or not loading a module changes how perl compiles a script.
A simple example:
use Fcntl;
print O_CREAT;
-->
256
without loading the module, it prints
O_CREAT
Thus: the module defines O_CREAT as a constant, i.e. a sub that expects
no parameters. Without the module, Perl conceives O_CREAT as a bareword,
thus a literal string.
In the same way,
foo bar
can mean lots of different things: a method call, a function call with
one parameter, ...
--
Bart.
------------------------------
Date: 02 May 2001 13:13:41 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <m1oftbtsp6.fsf@halfdome.holdit.com>
>>>>> "Bart" == Bart Lateur <bart.lateur@skynet.be> writes:
Bart> It's not *that* illogical. Randal has a few favourite examples, on how
Bart> loading or not loading a module changes how perl compiles a script.
You don't even need to load a module:
BEGIN {
eval (time % 2 ? 'sub zany ();' : 'sub zany (@);');
}
zany / 25 ; # / ; die "do I die or not?";
It's the halting problem (I think). You cannot determine whether or
not to strip that comment without *executing* the Perl code in the
BEGIN block. And even then, on even-numbered seconds, it'll die, but
not odd-numbered!
print "Just another Perl hacker,";
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: 2 May 2001 20:56:36 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <9cpsa4$lmj$1@mamenchi.zrz.TU-Berlin.DE>
According to Jfreeman <jfreeman@tassie.net.au>:
> Anno Siegel wrote:
>
> > According to Jfreeman <jfreeman@tassie.net.au>:
> >
> > [snipped, over-long lines reformatted]
> >
> > > Why this logically works.
> > >
> > > It is next to impossible to strip a # char and everything following it
> > > until the end of that line (EOL) without causing a compilation error
> > > unless the #....EOL is a real comment.
> >
> > This assumption is incredibly naive. This bit
> >
> > my $length = $#var;
> > $var = 456;
> >
> > will compile just fine after you cut off the "comment". It will leave
> > a nasty bug too, especially if $var happens to be a scalar ref at the
> > time. Except for the coexistence of $var with @var (yes, Uri, that's
> > bad praxis :), this code is by no means remarkable.
>
> Indeed it is not which is why the script leaves $# and $#var tokens alone.
Another hole plugged. Oh well... Will it also leave $#{ \ @var} alone?
No, I'm not checking, nor am I really interested if it does.
You see, I like a simplistic approach as well as the next programmer.
You could even base YAPP[1] on it:
a) Find a simple solution that solves most of the cases
b) Identify the cases it doesn't solve
c) Solve these, using the same or a different approach
Your problem is point b) above: You can't identify the cases where
trimming after "#" doesn't work, other than identifying one case
after the other. You wouldn't be here, asking for examples that
break the program, if you could.
What remains is a program that may silently change the semantics
of a perl script. I wouldn't touch it.
Anno
[1] Yet Another Programming Paradigm (what did you think?)
------------------------------
Date: 2 May 2001 21:19:44 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <9cptlg$lmj$2@mamenchi.zrz.TU-Berlin.DE>
According to Uri Guttman <uri@sysarch.com>:
> >>>>> "AS" == Anno Siegel <anno4000@lublin.zrz.tu-berlin.de> writes:
>
> AS> According to Jfreeman <jfreeman@tassie.net.au>:
>
> >> It is next to impossible to strip a # char and everything following it
> >> until the end of that line (EOL) without causing a compilation error
> >> unless the #....EOL is a real comment.
>
> AS> This assumption is incredibly naive. This bit
>
> AS> my $length = $#var;
> AS> $var = 456;
>
> AS> will compile just fine after you cut off the "comment". It will leave
> AS> a nasty bug too, especially if $var happens to be a scalar ref at the
> AS> time. Except for the coexistence of $var with @var (yes, Uri, that's
> AS> bad praxis :), this code is by no means remarkable.
>
> well, intentionally bad code that breaks a stupid program is good. i see
> no reason for this thing and won't lift a finger to help. a better way
> would be to run it through deparse but that is known to be broken in
> places.
Just for the record, using the same name twice is quite unnecessary.
my $length = $#foo;
$bar = 456;
works just as well.
Anno
------------------------------
Date: Wed, 02 May 2001 14:34:10 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Hacker challenge. Can you break this script for me?
Message-Id: <3AF07D52.AF365323@stomp.stomp.tokyo>
Bart Lateur wrote:
> Godzilla! wrote:
(snippage not noted by Lateur)
> >I cannot fathom why you are compiling scripts simply
> >to strip comments.
> Seen that perl compiles a script every time it runs it, the penalty is
> not that bad. But it's not sufficient as a test. If, for example, you
> delete half of the statements in a 1000 line script, the result will
> still compile, but as a comment stripper, it failed to do what it was
> supposed to do: strip comments and nothing else.
"...perl compiles a script every time it runs it...."
Hello! Perl needs to compile a comment stripper program.
It does not need to compile a script to be stripped.
Ahem...
"...strip comments and nothing else."
This seems an important comment, yes? There exists no
reason to compile a script in order to strip comments.
As I stated, a well developed set of rules will strip
comments, regardless if a script is compiled first.
Compilation performs only one task; before and after
testing. Compilation is unrelated to stripping comments.
Defined rules for stripping apply regardless if a
methodology compiles a script or not. For these
circumstances, compilation only serves to add
complexiety to a stripper and, as I demonstrated,
adds bugs to a stripper.
> >I made mention of problems with modules. This is yet
> >another bug with a hotel room key to your program. Your
> >intent is to strip a script, not a module. There will
> >be those, such as myself, who will most likely strip
> >comments at home on a system which will not have an
> >extensive collection of modules on hand. Your program
> >crashes and burns if a module cannot be found. This
> >is quite illogical as well.
> It's not *that* illogical. Randal has a few favourite examples, on how
> loading or not loading a module changes how perl compiles a script.
This compilation of a script and checking for loading of a
module is significantly illogical. You are basing your
logic on a presumption of a need to compile a script
to strip comments. This is doubly illogical; no need
to compile and, if compiled, no need for modules. Loading
of a module is absolutely unrelated to stripping comments.
Once again, as I demonstrated, reliance on loading of a
module for successful comment stripping certainly introduces
a major bug, instantly.
A script can be stripped of comments and a safe backup
copy made, without any need for compilation. What I
exemplified yesterday and today, well supports my
comments regarding this.
An excellent comment stripper program would clearly
delineate what it can do and, not do. There are no
perfect comment strippers and, adding compilation
to a comment stripper degrades its abilities as
Freeman learned by my sleight-of-hand.
* wonders why people don't simply use an editor *
Godzilla!
------------------------------
Date: Wed, 02 May 2001 19:38:56 GMT
From: John W Krahn <krahnj@acm.org>
Subject: Re: Help: Time issue
Message-Id: <3AF06262.397A8AB5@acm.org>
u518615722@spawnkill.ip-mobilphone.net wrote:
>
> I have a string extracted from <STDIN>,
> 04/26/2001 15:03:46
my $input = '04/26/2001 15:03:46';
> how can i make it assigned as
> (my $sec,my $min, my $hour, my $mday, my $mon,
> my $year)=(46,3,15,4,26,2001)?
my ( $sec, $min, $hour, $mday, $mon, $year ) = (split m!/|\s+|:!,
$input)[5,4,3,0,1,2];
> I tried
> (my $sec,my $min, my $hour, my $mday, my $mon,
> my $year, my $wday, my $yday,my $isdst)=
> timelocal(04/26/2001 15:03:46),
> but it is not working.
John
------------------------------
Date: 02 May 2001 18:04:31 +0000
From: Jon Ericson <Jonathan.L.Ericson@jpl.nasa.gov>
Subject: Re: HTML::LinkExtor problem
Message-Id: <86g0enmxu8.fsf@jon_ericson.jpl.nasa.gov>
zaki <zakaria1@hotmail.com> writes:
> i was using a program that uses HTML::Extor and it works fine in
> windows and i also tried it with redhat before with no problem. When i
> copied it to my mandrake 8.0 and try to run it, it complains about
> HTML/Tagset.pm not found in @INC...i went back to windows to look for
> this module but i didnt find it, so it was working fine without it...i
> dont understand what the problem can be? please help.
Are you using the same versions of the module and its dependencies?
Jon
------------------------------
Date: Wed, 02 May 2001 13:57:24 -0500
From: "Mr. Sunray" <djberge@uswest.com>
Subject: Re: IMAP server in perl?
Message-Id: <3AF05894.6C5B8B5B@uswest.com>
stefan kruger wrote:
> Hi all,
>
> has anyone got a perl implementation of an IMAP mailserver?
> It doesn't have to be 'production quality' or anything.
>
> It's not on CPAN. Just thought I'd ask before I start writing
> one myself.
>
> cheers, stefan
>
> --
> Dr Stefan Kruger <stefan@inty.net> http://www.inty.net
> Developer, Intelligent Network Technology, Ltd
> 1700 Park Avenue, Aztec West, Bristol BS32 4UA, UK
Not to my knowledge. Clients, yes. Servers, no.
Oofda - good luck!
Mr. Sunray
------------------------------
Date: Wed, 02 May 2001 18:40:09 GMT
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Infinate loop
Message-Id: <3AF055C8.307F34AF@earthlink.net>
Opps, I made a typo in my code:
> my (%dbm_hash, %seen, @duplicates);
>
> tie( %dbm_hash, 'NDBM_File',
> '/ncl/www/people/e.c.fowler/cgi-bin/Prot2App',
> O_CREAT|O_RDWR, 0600 ) or die "unable to open file: $!";
>
> while( my ($key, $value) = each %dbm_hash ) {
> push @duplicates{$key}, $key if ++$seen{$value};
should be:
push @duplicates, $key if $seen{$value}++;
> }
>
> delete @dbm_hash{ @duplicates };
The {$key} shouldn't've been there, and the ++ was in the wrong spot.
--
Shift to the left, shift to the right, mask in, mask out, BYTE, BYTE,
BYTE !!!
------------------------------
Date: Wed, 02 May 2001 18:34:59 -0000
From: doughera@maxwell.phys.lafayette.edu (Andy Dougherty)
Subject: Re: Perl and Upgrading?
Message-Id: <slrn9f0ksr.fp9.doughera@maxwell.phys.lafayette.edu>
In article <3AF032EC.27B0733@sequenom.com>, Bryan Coon wrote:
>The problem is simply that all my modules are no longer found in the
>path.
>In /usr/lib/perl5/ after the upgrade, there are two directories, 5.6.0,
>and 5.6.1. All my modules were of course in 5.6.0.
>What is the best way to fix this?
There is normally no need to "fix" anything. Perl "knows" about its
default directory structure and will, by default, look back in earlier
compatible versions. For example, my @INC in 5.6.1 looks like this:
/opt/perl/lib/5.6.1/sun4-solaris
/opt/perl/lib/5.6.1
/opt/perl/lib/site_perl/5.6.1/sun4-solaris
/opt/perl/lib/site_perl/5.6.1
/opt/perl/lib/site_perl/5.6.0/sun4-solaris
/opt/perl/lib/site_perl/5.6.0
/opt/perl/lib/site_perl
Note how it automatically searches in my old site_perl directory.
Note also that it does *not* automatically search in my old CORE perl
directory /opt/perl/lib/5.6.0 because that directory contains CORE
perl modules that are replaced by those shipped with 5.6.1.
In your case, I'd guess that someone installed modules that were not
part of the perl core into the /usr/lib/perl5/5.6.0 directory. That's
not the default behavior, so the default build of 5.6.1 didn't go
looking for it. When you build 5.6.1, you need to tell it to keep
looking in the old /usr/lib/perl5/5.6.0 directory (perhaps using
either the vendorlib or otherlibdirs Configure variables). See the
INSTALL file for details.
Hope this helps,
--
Andy Dougherty doughera@lafayette.edu
Dept. of Physics
Lafayette College, Easton PA 18042
------------------------------
Date: Wed, 02 May 2001 21:11:46 GMT
From: "Jason Pratt" <jpratt@ssr-inc.com>
Subject: Re: Please help!
Message-Id: <mK_H6.375$X65.161989@dfiatx1-snr1.gtei.net>
I have checked all of the repositories, what key words should I use? What
category would this type of script fall under?
Please help me out....
Thanks..
Sincerely,
Jason Pratt
"Godzilla!" <godzilla@stomp.stomp.tokyo> wrote in message
news:3AF035AB.D33073BC@stomp.stomp.tokyo...
> Jason Pratt wrote:
>
> (snipped)
>
> > ...I am looking for a cgi script/program that I can use on my site
> > that will be implemented via SSI that will let the visitors know when
> > a file (a zip or exe [archives]) has been last updated....
>
>
> There are open source scripts to do this available via our
> internet if you truly search. Invest a little time and
> effort and you will find what you need.
>
> Following my signature I have enclosed a basic barebones
> test script with which you may play, alter and perhaps
> adapt to your server side includes need. You will quickly
> notice this script is not all encompassing; much work
> is left to you, if you are willing to invest some effort.
>
>
> $directory = ".";
>
> Above line is where you can insert your directory
> path you wish to search. My use of a period causes
> this script to simply search the same directory
> where this script is installed. Remove my period
> and type in your full directory path.
>
>
> @File_Ext = qw (exe zip .pl);
>
> This line above simply sets what type of files
> to pull. Remove my .pl if you only want to
> pull exe and zip files. Other files, such as
> jpg and gif can be added by typing in the
> last three characters of a file extension.
>
>
> @Array = reverse sort (@Array);
>
> This one sorts files in descending order, this
> is, most recent modified file first. Remove
> my reverse to switch to ascending order.
>
> You may also sort by filename by simply switching
> positions of $modified and $filename appropriately
> in my test script. Research this first before making
> changes; it has to be done right.
>
> I wrote my date/timestamp section so you can change
> it at will. There are shorter methods but my style
> will allow you to change formats, for example adding
> names for weekdays and months. There are numerous
> scripts to found on our internet which employ this
> method which will show you how to use simple arrays
> to add names like, Monday, Tuesday.. June, July.
>
> A presumption is made you know enough about Perl to
> make simple modifications, add "my" declarations and
> the such. If not, have someone help you with my test
> script. It can be called directly via server side
> includes to use in an html page.
>
> Read and research. I have never known learning
> to cause a person true injury.
>
>
> Godzilla!
> --
>
> TEST SCRIPT:
> ____________
>
>
> #!perl
>
> print "Content-type: text/plain\n\n";
>
> $directory = ".";
> @File_Ext = qw (exe zip .pl);
>
> opendir (DIRECTORY, $directory);
> while (defined ($filename = readdir (DIRECTORY)))
> {
> foreach $extension (@File_Ext)
> {
> if (substr ($filename, -3, 3) eq $extension)
> {
> $modified = (stat ($filename)) [9];
> $filename = "$modified:$filename";
> push (@Array, $filename);
> }
> }
> }
>
> @Array = reverse sort (@Array);
>
> foreach $element (@Array)
> {
> ($modified, $filename) = split (/:/, $element);
>
> ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
localtime($modified);
>
> if ($sec < 10)
> { $sec = "0$sec"; }
> if ($min < 10)
> { $min = "0$min";}
> if ($hour < 10)
> { $hour = "0$hour"; }
> if ($mon < 10)
> { $mon = "0$mon"; }
> if ($mday < 10)
> { $mday = "0$mday"; }
>
> $month = ($mon + 1);
> $year = ($year + 1900);
>
> $date = "$hour\:$min\:$sec $month/$mday/$year";
>
> print "Filename: $filename\n ",
> "Last Modified: $date\n\n";
> }
>
> exit;
>
>
>
> PRINTED RESULTS:
> ________________
>
> Filename: dirsort.pl
> Last Modified: 08:48:32 5/02/2001
>
> Filename: test1.pl
> Last Modified: 14:35:52 5/01/2001
>
> Filename: test2.pl
> Last Modified: 19:18:44 3/30/2001
>
> Filename: test4.pl
> Last Modified: 18:00:56 3/11/2001
>
> Filename: test3.pl
> Last Modified: 14:23:54 3/10/2001
>
> Filename: godzil.pl
> Last Modified: 20:25:12 3/01/2001
------------------------------
Date: Wed, 02 May 2001 14:29:30 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Please help!
Message-Id: <3AF07C3A.3D4512CD@stomp.stomp.tokyo>
Jason Pratt wrote:
> I have checked all of the repositories, what key words should I use? What
> category would this type of script fall under?
> Please help me out....
Excuse me? Have malicious aliens from a parallel
universe robbed you of your gray matter?
Noting you are able to formulate, type and post
a response, my presumption is you are not totally
flat line and still capable of a measured degree
of cognitive thought. Try thinking in lieu of
filing a missing gray matter report with Frank
Zappa's Brain Police.
I provided you with decent advice and a script which
provides a basis for what you want to do. What? You
want me to now perform Pocahontas nude cartwheels
for you?
Godzilla!
------------------------------
Date: Wed, 02 May 2001 18:22:12 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: Prevent warning: check for open file handle?
Message-Id: <tf0k2kpe39dc32@corp.supernews.com>
In article <988824646.149539@irys.nyx.net>,
Avinash Chopde; <avinash@acm.org> <avinash@acm.org> wrote:
: Is there a way to check if a filehandle is valid in perl?
: print FH "xxx" if (FH is valid);
:
: It all still works, I'm only trying to stop the warning
: about print to invalid filehandle showing up in STDERR
: (am running with -w)
IO::Handle has an opened() method to check this:
% cat try
#! /usr/local/bin/perl -w
use strict;
use IO::Handle;
sub check {
my $fh = shift;
if ($fh->opened) {
print " - handle opened\n";
}
else {
print " - handle not opened.\n";
}
}
print "Before open:\n";
check \*FOO;
open FOO, "try" or die "$0: open try: $!\n";
print "After open, before close:\n";
check \*FOO;
close FOO;
print "After close:\n";
check \*FOO;
[13:19] hslinux% ./try
Before open:
- handle not opened.
After open, before close:
- handle opened
After close:
- handle not opened.
Hope this helps,
Greg
--
When going to visit the woman, do not forget the whip.
-- Nietzsche
------------------------------
Date: Wed, 02 May 2001 13:55:55 -0500
From: "Mr. Sunray" <djberge@uswest.com>
Subject: Re: Problem with "require" in server
Message-Id: <3AF0583B.796CA29@uswest.com>
Ok - figured out my own problem. As per advice from Lincoln Stein's NPWP,
I set the current working directory to '/' once the server starts. I
forgot about that. Once that happened, it was then looking in the root
directory rather than the Server's directory for the module.
Hmmm....since I can't use the 'use' pragma once the server starts. I think
I can work around this with File::Basename or something.
Mr. Sunray
------------------------------
Date: Wed, 2 May 2001 15:58:08 -0400
From: "Dan Pelton" <dnp@ams.org>
Subject: profiling
Message-Id: <9cposl$rro$1@sun06.ams.org>
Hi There,
Is there a way to get profiling to tell me how much time was
spent in each method called? I tried using "perl -d:DProf script.pl"
and various forms of dprofpp (dprofpp -a, dprofpp -t). I get time
information about some of the methods called but not all of them.
thanks,
Dan Pelton
dnp@ams.org
------------------------------
Date: 2 May 2001 20:18:28 GMT
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Regular expression for zip code
Message-Id: <9cpq2k$k81$1@mamenchi.zrz.TU-Berlin.DE>
According to Philip Newton <nospam.newton@gmx.li>:
> On Mon, 30 Apr 2001 21:24:23 GMT, Uri Guttman <uri@sysarch.com> wrote:
>
> > the regex is recompiled only if any of its interpolated variables have
> > changed since it last was compile.
>
> How would the regex engine know this? As far as I know, variables and
> regexes don't have timestamps on them.
[...]
Lots of ways. A regex could store the string it was compiled from,
for instance.
Anno
------------------------------
Date: Wed, 02 May 2001 21:25:57 GMT
From: Dan <nospam@newsranger.com>
Subject: Removing blank lines from end of data
Message-Id: <FX_H6.7530$SZ5.616955@www.newsranger.com>
I have code that will remove ALL the blank lines from data with this regular
expression:
$page =~ s/\s{2,}/\n/gs;
But I would only like to remove blank lines at the end of the data. How would I
do that?
Thanks,
Dan
------------------------------
Date: 2 May 2001 22:00:42 GMT
From: steveo@panix.com (Steven M. O'Neill)
Subject: Re: Removing blank lines from end of data
Message-Id: <9cq02a$eq$4@news.panix.com>
Dan <nospam@newsranger.com> wrote:
>I have code that will remove ALL the blank lines from data with this
>regular expression:
>
>$page =~ s/\s{2,}/\n/gs;
>
>But I would only like to remove blank lines at the end of the data.
>How would I do that?
Start from the end.
--
Steven O'Neill steveo@panix.com
www.cars-suck.org
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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.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 824
**************************************