[17002] in Perl-Users-Digest
Perl-Users Digest, Issue: 4414 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Sep 23 18:06:25 2000
Date: Sat, 23 Sep 2000 15:05:09 -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: <969746709-v9-i4414@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sat, 23 Sep 2000 Volume: 9 Number: 4414
Today's topics:
Re: - For this type of use (see msg), should I favor Pe <vemba72@hotmail.com>
Re: - For this type of use (see msg), should I favor Pe (Tony L. Svanstrom)
Re: - For this type of use (see msg), should I favor Pe (Martien Verbruggen)
- Looking for the following script (user comments) <vemba72@hotmail.com>
Re: - Looking for the following script (user comments) <mtaylorlrim@my-deja.com>
Re: - Looking for the following script (user comments) <flavell@mail.cern.ch>
Re: Count of items is EXCEPTION not RULE (was Re: Littl (David Combs)
eval puzzle (Mark-Jason Dominus)
Re: eval puzzle <uri@sysarch.com>
Re: eval puzzle (Randal L. Schwartz)
Re: eval puzzle (Abigail)
Re: getting images with LWP? (Martien Verbruggen)
Re: Gunzip at Prohosting <bart.lateur@skynet.be>
Hash and Join help, please? ptomsic@my-deja.com
Re: Hash and Join help, please? <bwalton@rochester.rr.com>
Re: Help with Date dioper@kih.net
Re: HTML to Text converter (Mark-Jason Dominus)
Re: HTML to Text converter <bart.lateur@skynet.be>
Re: Local variable screws thing up? <jeffp@crusoe.net>
Re: looking for advice (Mark-Jason Dominus)
Re: LWP and proxy (Mark-Jason Dominus)
matching a date <bachelart.pierre@skynet.be>
Re: matching a date <godzilla@stomp.stomp.tokyo>
Re: MSXML.dll <idbugm@idbugm.com>
multiple ties to a single DB_file (Tony L. Svanstrom)
Newbie needs help with search and replace <neilw@SPAMidirect.com>
Re: Newbie needs help with search and replace (Maurice E. Jarrell)
Re: Perl, Unix and printers <godzilla@stomp.stomp.tokyo>
Re: Pure perl encrypt/decryption? <bart.lateur@skynet.be>
Re: Pure perl encrypt/decryption? (Abigail)
Re: The XY problem (was Re: CGI.pm: controlling Back & (David Combs)
Re: The XY problem (was Re: CGI.pm: controlling Back & (Randal L. Schwartz)
Re: use vs. @ISA <bart.lateur@skynet.be>
Re: variable -> constant? (Mark-Jason Dominus)
Re: variable -> constant? (Mark-Jason Dominus)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 23 Sep 2000 12:56:49 -0400
From: "Jon" <vemba72@hotmail.com>
Subject: Re: - For this type of use (see msg), should I favor Perl or PHP3?
Message-Id: <%_7z5.5887$C7.140321@wagner.videotron.net>
Tony L. Svanstrom <tony@svanstrom.com> wrote in message
news:1ehf3oo.1nqe36k1wupcbgN%tony@svanstrom.com...
> Clay Irving <clay@panix.com> wrote:
>
> > On Fri, 22 Sep 2000 23:25:30 -0400, Jon <vemba72@hotmail.com> wrote:
>
> > >PS: The server admin told me he had to shut down several sites earlier
> > >this year because of Perl scripts... too many hits, and every hit ran
the
> > >template-grabbing CGI. He said sites that get less hits but use Perl
tax
> > >the server more than sites that get more hits but use PHP... somehow,
PHP
> > >opens and closes fewer files (that's how it was explained to me) so
he's
> > >strongly pushing for PHP. Is this all just BS?
> >
> > Sounds like BS.
>
> Not really, with CGI you start a new process with each script, that
> doesn't happen with PHP.
But is this more a concern for me as the webmaster, or more the sys admin?
In other words, will users see a difference? That's all I'm concerned
about.
Jon
------------------------------
Date: Sat, 23 Sep 2000 22:53:01 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: Re: - For this type of use (see msg), should I favor Perl or PHP3?
Message-Id: <1ehfos1.17udwjt1yhr6u2N%tony@svanstrom.com>
Jon <vemba72@hotmail.com> wrote:
> Tony L. Svanstrom <tony@svanstrom.com> wrote in message
> news:1ehf3oo.1nqe36k1wupcbgN%tony@svanstrom.com...
> > Clay Irving <clay@panix.com> wrote:
> >
> > > On Fri, 22 Sep 2000 23:25:30 -0400, Jon <vemba72@hotmail.com> wrote:
> >
> > > >PS: The server admin told me he had to shut down several sites earlier
> > > >this year because of Perl scripts... too many hits, and every hit ran
> the
> > > >template-grabbing CGI. He said sites that get less hits but use Perl
> tax
> > > >the server more than sites that get more hits but use PHP... somehow,
> PHP
> > > >opens and closes fewer files (that's how it was explained to me) so
> he's
> > > >strongly pushing for PHP. Is this all just BS?
> > >
> > > Sounds like BS.
> >
> > Not really, with CGI you start a new process with each script, that
> > doesn't happen with PHP.
>
> But is this more a concern for me as the webmaster, or more the sys admin?
> In other words, will users see a difference? That's all I'm concerned
> about.
The user won't notice unless the admin set up too many accounts, so that
the server can't keep up; but sooner or later those servers end up not
even being able to send out plain text-files quick enough. Just read the
fineprint when it comes to CPU-usage when you sign up and you'll be ok.
/Tony
--
/\___/\ Who would you like to read your messages today? /\___/\
\_@ @_/ Protect your privacy: <http://www.pgpi.com/> \_@ @_/
--oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
on the verge of frenzy - i think my mask of sanity is about to slip
---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
\O/ \O/ ©99-00 <http://www.svanstrom.com/?ref=news> \O/ \O/
------------------------------
Date: Sun, 24 Sep 2000 07:41:44 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: - For this type of use (see msg), should I favor Perl or PHP3?
Message-Id: <slrn8sq5c8.jr6.mgjv@martien.heliotrope.home>
On Sat, 23 Sep 2000 15:16:29 +0200,
Tony L. Svanstrom <tony@svanstrom.com> wrote:
> Clay Irving <clay@panix.com> wrote:
>
> > On Fri, 22 Sep 2000 23:25:30 -0400, Jon <vemba72@hotmail.com> wrote:
>
> > >PS: The server admin told me he had to shut down several sites earlier
> > >this year because of Perl scripts... too many hits, and every hit ran the
> > >template-grabbing CGI. He said sites that get less hits but use Perl tax
> > >the server more than sites that get more hits but use PHP... somehow, PHP
> > >opens and closes fewer files (that's how it was explained to me) so he's
> > >strongly pushing for PHP. Is this all just BS?
> >
> > Sounds like BS.
>
> Not really, with CGI you start a new process with each script, that
> doesn't happen with PHP. [*]
Starting new processes is almost a trivial cost on modern OS's. And
there is nothing inherent in Perl that forces an OS to spawn a new
proecess. CGI, yes. But not Perl. Don't perpetuate falsities that are
stated in the original question, which was garbled and got many issues
confused.
There are many ways to run Perl programs for web servers, not all of
them are CGI. Even the ones that are can be made to behave better.
That part of the discussion certainly doesn't belong on this group.
Martien
--
Martien Verbruggen |
Interactive Media Division | You can't have everything, where
Commercial Dynamics Pty. Ltd. | would you put it?
NSW, Australia |
------------------------------
Date: Sat, 23 Sep 2000 16:04:21 -0400
From: "Jon" <vemba72@hotmail.com>
Subject: - Looking for the following script (user comments)
Message-Id: <U18z5.5896$C7.140878@wagner.videotron.net>
I'm looking for a user-comment script similar to
http://www.aintitcool.com/display.cgi?id=6905
At the root of it is the traditional guest book concept, but with one thread
per item. Like a different guest book for every posted article.
Where can I find such a thing? All the websites have them now.
Jon
------------------------------
Date: Sat, 23 Sep 2000 21:13:08 GMT
From: Mark <mtaylorlrim@my-deja.com>
Subject: Re: - Looking for the following script (user comments)
Message-Id: <8qj6co$mus$1@nnrp1.deja.com>
Try Matt's Script Archive. His Guestbook is easily modifiable.
Mark
In article <U18z5.5896$C7.140878@wagner.videotron.net>,
"Jon" <vemba72@hotmail.com> wrote:
> I'm looking for a user-comment script similar to
> http://www.aintitcool.com/display.cgi?id=6905
>
> At the root of it is the traditional guest book concept, but with one
thread
> per item. Like a different guest book for every posted article.
>
> Where can I find such a thing? All the websites have them now.
>
> Jon
>
>
--
Please reply to this newsgroup as my Deja mail
is used as a spam catcher only!
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 23 Sep 2000 23:31:53 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: - Looking for the following script (user comments)
Message-Id: <Pine.GHP.4.21.0009232322160.7697-100000@hpplus03.cern.ch>
On Sat, 23 Sep 2000, Mark up-ended usenet, gave it a shake,
and this piece of cargo fell clattering to the ground:
> Try Matt's Script Archive. His Guestbook is easily modifiable.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Hmmm, that might be truer than you meant. Last time I looked,
there were obvious weaknesses.
I've found the faqOmatic a pretty robust package. Despite its name,
it's fine for implementing discussion forums, bulletin boards etc. and
indeed guestbooks. Now at http://faqomatic.sourceforge.net/
Thank heavens one doesn't have to take the author's choice of colour
scheme! ;-)
------------------------------
Date: 23 Sep 2000 19:35:42 GMT
From: dkcombs@netcom.com (David Combs)
Subject: Re: Count of items is EXCEPTION not RULE (was Re: Little perl annoyance #371: glob)
Message-Id: <8qj0me$oep$7@slb7.atl.mindspring.net>
In article <8pgp35$3v9$1@panix3.panix.com>, kj0 <kj0@mailcity.com> wrote:
<SNIP>
>
>Come to think of it, maybe the 3rd edition of PP clarifies the
>array/list distinction... The thought of plowing through yet a third
>edition of PP (I've done it twice already) is an unpleasant one at my
>age, though...
>
INDEED! (and "plow through" is the correct phrase(? "set of
words"?).) Especially when it is 700 pages BIGGER than 2nd ed!
But, it IS a work of art, in that they have crammed
seemingly EVERYTHING into it, one way or another.
But, like an advanced math book, you have to pretend
with EACH sentence comes the prefix:
(The following sentence is of course obvious
to the careful reader, so we won't explain it
in any further detail than that.)
David
------------------------------
Date: Sat, 23 Sep 2000 18:22:32 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: eval puzzle
Message-Id: <39ccf4e8.2a1$237@news.op.net>
Keywords: Asia, Corp, connector, drain
Why do beginners always want to write
eval "\$val = EXPRESSION"
It seems to me that they do this much more often than the alternative:
$val = eval "EXPRESSION"
which I would have thought was more obvious and straightforward.
This is a serious question, not a complaint or anything like that.
I am really puzzled.
------------------------------
Date: Sat, 23 Sep 2000 19:12:01 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: eval puzzle
Message-Id: <x7u2b6c48y.fsf@home.sysarch.com>
>>>>> "MD" == Mark-Jason Dominus <mjd@plover.com> writes:
MD> Why do beginners always want to write
MD> eval "\$val = EXPRESSION"
MD> It seems to me that they do this much more often than the alternative:
MD> $val = eval "EXPRESSION"
MD> which I would have thought was more obvious and straightforward.
maybe because they don't realize that eval returns the result of it
evaluation. they seem to think it is just a compiler operator which
needs the assignment inside the string to make that happen. if you were
to eval a series of assignments (for some ugly reason) you would need to
to that, so they do that for one line thinking that is the way to do it.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: 23 Sep 2000 12:30:16 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: eval puzzle
Message-Id: <m1bsxeq52v.fsf@halfdome.holdit.com>
>>>>> "Mark-Jason" == Mark-Jason Dominus <mjd@plover.com> writes:
Mark-Jason> Why do beginners always want to write
Mark-Jason> eval "\$val = EXPRESSION"
Mark-Jason> It seems to me that they do this much more often than the
Mark-Jason> alternative:
Mark-Jason> $val = eval "EXPRESSION"
Mark-Jason> which I would have thought was more obvious and
Mark-Jason> straightforward.
Perhaps because that second form doesn't make sense in shell?
--
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: 23 Sep 2000 19:46:13 GMT
From: abigail@foad.org (Abigail)
Subject: Re: eval puzzle
Message-Id: <slrn8sq21q.lo9.abigail@alexandra.foad.org>
Randal L. Schwartz (merlyn@stonehenge.com) wrote on MMDLXXX September
MCMXCIII in <URL:news:m1bsxeq52v.fsf@halfdome.holdit.com>:
// >>>>> "Mark-Jason" == Mark-Jason Dominus <mjd@plover.com> writes:
//
// Mark-Jason> Why do beginners always want to write
//
// Mark-Jason> eval "\$val = EXPRESSION"
//
// Mark-Jason> It seems to me that they do this much more often than the
// Mark-Jason> alternative:
//
// Mark-Jason> $val = eval "EXPRESSION"
//
// Mark-Jason> which I would have thought was more obvious and
// Mark-Jason> straightforward.
//
// Perhaps because that second form doesn't make sense in shell?
But it does.
You won't see it that often in the shell because usually you are more
interested in the output of an expression than its exit status, but
in the sell
eval "VAL=EXPRESSION"
and
VAL=eval EXPRESSION
are both valid.
(And besides, how many newbies here are experienced shell programmers?)
Abigail
--
perl -wle 'eval {die [[qq [Just another Perl Hacker]]]};; print
${${${@}}[$#{@{${@}}}]}[$#{${@{${@}}}[$#{@{${@}}}]}]'
------------------------------
Date: Sun, 24 Sep 2000 07:47:36 +1100
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: getting images with LWP?
Message-Id: <slrn8sq5n8.jr6.mgjv@martien.heliotrope.home>
On Sat, 23 Sep 2000 12:21:38 -0400,
Bruce Bowden <bbowden@mitre.org> wrote:
>
> Great idea! I was getting zero bytes transferred. After a little testing
> I found my (rather embarrasing) problem:
>
> get('$var') vs get("$var")
Why not
get($var);
?
Unless you know why get("$var") and get($var) are potentially different,
you shouldn't quote your variables.
#!/usr/local/bin/perl -w
use strict;
my $foo = 'barbar';
get("$foo");
print "$foo\n";
get($foo);
print "$foo\n";
sub get
{
$_[0] =~ s/bar/baz/;
}
Martien
--
Martien Verbruggen |
Interactive Media Division | +++ Out of Cheese Error +++
Commercial Dynamics Pty. Ltd. | Reinstall Universe and Reboot +++
NSW, Australia |
------------------------------
Date: Sat, 23 Sep 2000 18:31:06 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Gunzip at Prohosting
Message-Id: <5mtpssksv6sarfe02r1i6q05ve18ekeh4e@4ax.com>
BUCK NAKED1 wrote:
>Do I have the perl paths for prohosting correct? #!/usr/bin/perl works
>there for all of my other scripts.
>
>Here's my coding:
>
>#!/usr/bin/perl
>$file = usr/home1/discosco/html/lwp.tar.gz;
There are no quotes around that string. But, even if this is a mistype
when typing in this post, there also isn't a leading slash in the path.
--
Bart.
------------------------------
Date: Sat, 23 Sep 2000 19:15:21 GMT
From: ptomsic@my-deja.com
Subject: Hash and Join help, please?
Message-Id: <8qivft$fi3$1@nnrp1.deja.com>
I'm extracting HREF tags from a document, and trying to return them
from a subroutine as a hash. Once I've got them back from the sub as a
hash, I
want to concatenate them into a single string seperated by a comma.
something like the following is what I"m looking for:
this.html => this, /that/theother.html => here, three.html => three
I'm getting the HREFs extracted b/c I can print them out as I'm getting
them (denoted by output above the ===== line below), but when I try to
iterate thru the hash, and concat them seperated by a comma, I'm
loosing them all but one (output below the ====== line below)
Any help greatly appreciated.
Thanks
-----CODE-----
#!/usr/local/bin/perl
## hash test
use HTML::TokeParser;
$file = $ARGV[0];
open(INFILE, "$file");
@file =<INFILE>;
close(INFILE);
$wholeFile = join("", @file);
%h = &getHyperlinks($wholeFile);
foreach $key (sort keys %h) {
$fullString = join(",","$key => $h{$key}\n");
}
print "\n==============\n$fullString\n";
sub getHyperlinks {
## object constructor
my $path = shift;
my (%href);
$parser=HTML::TokeParser->new(\$path);
while (my $token = $parser->get_tag("a")) {
my $linkURL = $token->[1]{href} || "-";
my $linkText = $parser->get_trimmed_text("/a");
if ($linkText=~/<image/i) {$linkText="image"}
$href{$linkURL} = $linkText;
print "$linkURL => $linkText\n";
}
return %href;
}
----------------
-----SAMPLE PAGE-------
This test<a href="this.html">one</a> is fun.
<a href="here/this/that.html">two</a> ....
<a href="that/this/theother.html">Here's three</a> and here comes <a
href="/four
.html">fourth link</a>
----------------
------OUTPUT I GET------
this.html => one
here/this/that.html => two
that/this/theother.html => Here's three
/four.html => fourth link
==============
this.html => one
------------------------
Thanks for any assistance.
Paul
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 23 Sep 2000 20:26:02 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Hash and Join help, please?
Message-Id: <39CD11EE.B7749AC4@rochester.rr.com>
ptomsic@my-deja.com wrote:
>
> I'm extracting HREF tags from a document, and trying to return them
> from a subroutine as a hash. Once I've got them back from the sub as a
> hash, I
> want to concatenate them into a single string seperated by a comma.
> something like the following is what I"m looking for:
>
> this.html => this, /that/theother.html => here, three.html => three
>
> I'm getting the HREFs extracted b/c I can print them out as I'm getting
> them (denoted by output above the ===== line below), but when I try to
> iterate thru the hash, and concat them seperated by a comma, I'm
> loosing them all but one (output below the ====== line below)
>
> Any help greatly appreciated.
>
> Thanks
>
> -----CODE-----
> #!/usr/local/bin/perl
>
> ## hash test
> use HTML::TokeParser;
> $file = $ARGV[0];
> open(INFILE, "$file");
> @file =<INFILE>;
> close(INFILE);
> $wholeFile = join("", @file);
> %h = &getHyperlinks($wholeFile);
> foreach $key (sort keys %h) {
> $fullString = join(",","$key => $h{$key}\n");
You need to read up on join:
perldoc -f join
It doesn't do what you seem to be thinking it does. It strings together
the elements of a list (its second argument) with its first argument
in-between. You are calling join with just a scalar for the second
argument, which means it will return just that scalar, since the scalar
will be interpreted as a one-element list. You, its seems, would like
to concatenate the strings made up of each of the keys of your hash (in
sorted order) with " => ", the value, and a newline together with a
comma as a separator. You could do that whole smash using join without
the foreach:
$fullString=join ',',map {"$_ => $h{$_}\n"} sort keys %h;
I'll leave it you as to whether that is exactly what you want or not
(the combo of newlines and commas seems a bit weird to me). To get your
example output you show above, you should drop the \n and add a space
after the comma in the first argument to join.
> }
>
> print "\n==============\n$fullString\n";
<rest of code and example output deleted>
> Paul
...
--
Bob Walton
------------------------------
Date: Sat, 23 Sep 2000 14:14:58 -0400
From: dioper@kih.net
Subject: Re: Help with Date
Message-Id: <39CCF322.E87955F9@kih.net>
you need to add 1900 to the year get the date to be correct.
$year = $year + 1900;
print "$year\n";
it should display 2000.
The above will keep the correct year for a very long time.
Keat wrote:
> I am having problems with links.pl. I am trying to get it to display the
> correct date, but no matter what I try it still thinks this year is year
> 19100, Does anyone have any Ideas. Below is the section I believe controls
> the date.
>
> if ($line =~ /<!--time-->/) {
> @months = ('January','February','March','April','May','June',
> 'July','August','September','October','November','December');
>
> @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday',
> 'Friday','Saturday');
>
> ($sec,$min,$hour,$mday,$mon,$year,$wday) =
> (localtime(time))[0,1,2,3,4,5,6];
> if ($sec < 10) { $sec = "0$sec"; }
> if ($min < 10) { $min = "0$min"; }
> if ($hour < 10) { $hour = "0$hour"; }
> if ($mday < 10) { $mday = "0$mday"; }
> $date = "on $days[$wday], $months[$mon] $mday, 19$year at
> $hour:$min:$sec";
> print FILE "<!--time--><b>Last use was added $date</b><hr>\n";
>
> Ive tried adding $year = -100; but this just displays 19100-100, Ive also
> tried adding a line
> if ($year< 99) { $year= "20$year"; -100}, but this doesnt work either.
>
> As accomplished perl scripters will have noticed, I know nothing about Perl,
> any info would be greatly appreciated.
>
> Keaton Roebuck
> please reply via email
>
> Keat@beal.org.uk
------------------------------
Date: Sat, 23 Sep 2000 18:45:22 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: HTML to Text converter
Message-Id: <39ccfa41.43c$128@news.op.net>
Keywords: Passaic, exhaust, sclerosis, steward
In article <VA.00000088.01e113e2@xor.cc>, Tom Geldner <tom@xor.cc> wrote:
>I'm looking for something in Perl that will convert HTML to
>straight Text (ASCII).
It may not suit you, but I like to use 'lynx -dump'.
------------------------------
Date: Sat, 23 Sep 2000 18:49:58 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: HTML to Text converter
Message-Id: <tfupss8jo794o7rav958chtum7ahlbqjfi@4ax.com>
Tom Geldner wrote:
>I'm looking for something in Perl that will convert HTML to
>straight Text (ASCII). Basically, I want to use it to strip HTML
>out of incoming e-mails on my server. I've searched most of the
>Perl archives I know about without success. I found one module
>listed but the ftp link was dead.
Do yo know of CPAN? <www.cpan.org>, or <search.cpan.org>.
Go there, and look up HTML::Filter, part of the HTML::Parser package; if
you don't have it already.
--
Bart.
------------------------------
Date: Sat, 23 Sep 2000 17:53:52 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: Local variable screws thing up?
Message-Id: <Pine.GSO.4.21.0009231751270.18425-100000@crusoe.crusoe.net>
[posted & mailed]
On Sep 23, hiroshiishii@my-deja.com said:
>print "Which directory? \n";
>$start_dir = <STDIN>;
You should probably remove the \n from the $start_dir variable (with
chomp(), is how I suggest).
> local $dir = @_;
> opendir(DIR, $dir);
Do you do any debugging at all? To see what $dir holds? To see if you
CAN open the directory? Hint: @_ in scalar context returns the number of
elements in it. You're accessing @_ in scalar context.
Maybe you should try
local $dir = $_[0];
# or
local $dir = shift;
# or
local($dir) = @_;
In fact, those 'local's should really be 'my's. There no need to use
local() here at all.
--
Jeff "japhy" Pinyan japhy@pobox.com http://www.pobox.com/~japhy/
PerlMonth - An Online Perl Magazine http://www.perlmonth.com/
The Perl Archive - Articles, Forums, etc. http://www.perlarchive.com/
CPAN - #1 Perl Resource (my id: PINYAN) http://search.cpan.org/
------------------------------
Date: Sat, 23 Sep 2000 15:38:27 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: looking for advice
Message-Id: <39ccf3b0.275$201@news.op.net>
In article <39ccdf64$1@cs.rit.edu>, Aaron Baff <arbaff@hotmail.com> wrote:
>what you would use to compile it in a win98 environment(or
>unix, I have access to sun workstations).
OK, my advice is that you look to see if it is installed on RIT's
workstations already, because it probably is, and that will save you a
lot of trouble.
------------------------------
Date: Sat, 23 Sep 2000 15:48:38 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: LWP and proxy
Message-Id: <39ccf613.306$c8@news.op.net>
Keywords: Ito, Muscovy, lad, orthodox
In article <8qim30$52t$1@nnrp1.deja.com>, <tauras6097@my-deja.com> wrote:
>How do I do this with the proxy?
>I read all the UserAgent examples and still can't figure it out.
I haven't done this, but the LWP::UserAgent manual seems pretty clear:
$ua->proxy(...)
Set/retrieve proxy URL for a scheme:
$ua->proxy(['http', 'ftp'], 'http://proxy.sn.no:8001/');
... the URL is to be used
for proxying of access methods listed in the list in
the first method argument, i.e. 'http' and 'ftp'.
If you don't undersdtand this, could you say in more detail what you
don't understand? If you tried it and it didn't work, could you show
what you tried, and explain what it did that was different from what
you wanted?
------------------------------
Date: Sat, 23 Sep 2000 20:47:25 +0200
From: "tuple" <bachelart.pierre@skynet.be>
Subject: matching a date
Message-Id: <8qitqr$drj$1@news0.skynet.be>
Hello,
How can i match a date given in something like this:
Exchange 2000-09-23 19:37:25 EST
/\b20[0-9]{2}-[0-1][0-9]-[0-3][0-9]\b/ would work
but would match 2000-19-39 too.
I' ve search comp.lang.perl.* with the pattern "date" in a
power search but it returns nothing !! Very strange.
Pierre Bachelart
------------------------------
Date: Sat, 23 Sep 2000 13:16:04 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: matching a date
Message-Id: <39CD0F84.8F43F913@stomp.stomp.tokyo>
tuple wrote:
> How can i match a date given in something like this:
> Exchange 2000-09-23 19:37:25 EST
> /\b20[0-9]{2}-[0-1][0-9]-[0-3][0-9]\b/ would work
> but would match 2000-19-39 too.
(snippage)
Godzilla!
--
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class
TEST SCRIPT:
____________
#!/usr/local/bin/perl
print "Content-Type: text/plain\n\n";
$key_term = "2000-09-23";
$input = " Exchange 2000-19-23 19:37:25 EST
Exchange 2000-09-23 19:37:25 EST
Exchange 2000-29-23 19:37:25 EST";
print "Boss, Your Search Term Is: $key_term.\n\n";
print "Boss, Your Input To Search Is:\n\n$input\n\n\n";
print "This Is A Generic Match Method.\n\n";
if ($input =~ /$key_term/)
{ print "Boss, Match Found Somewhere, I Dunno Where."; }
print "\n\n\nThis Is A Regex Method.\n\n";
@Array = split (/\n/, $input);
$counter = 1;
foreach $line (@Array)
{
$line =~ s/([a-z ]+)([\d-]+).*/$2/i;
if ($key_term eq $line)
{ print "Boss, Match Found At Line $counter: $line\n"; }
$counter++;
}
print "\n\nThis Is A Substring Method.\n\n";
@Array = split (/\n/, $input);
$counter = 1;
foreach $line (@Array)
{
$line = substr ($line, 15, 10);
if ($key_term eq $line)
{ print "Boss, Match Found At Line $counter: $line\n"; }
$counter++;
}
print "\n\n\nBoss, Anything Else You Want Done?";
exit;
PRINTED RESULTS:
________________
Boss, Your Search Term Is: 2000-09-23.
Boss, Your Input To Search Is:
Exchange 2000-19-23 19:37:25 EST
Exchange 2000-09-23 19:37:25 EST
Exchange 2000-29-23 19:37:25 EST
This Is A Generic Match Method.
Boss, Match Found Somewhere, I Dunno Where.
This Is A Regex Method.
Boss, Match Found At Line 2: 2000-09-23
This Is A Substring Method.
Boss, Match Found At Line 2: 2000-09-23
Boss, Anything Else You Want Done?
------------------------------
Date: Sat, 23 Sep 2000 18:25:38 GMT
From: IDBugM <idbugm@idbugm.com>
Subject: Re: MSXML.dll
Message-Id: <8qisig$cce$1@nnrp1.deja.com>
That may work for what I'm wanting to do, but would you know how to use
Microsoft's dll within the Perl? I'll try the other method in the
meantime but I think Microsoft has a much better library. Just a
thought.
Thanks
In article <8qhsqa$433$0@206.230.71.30>,
"Josiah" <jdb@wcoil.com> wrote:
> I couldnt find Net-SSLeay on ActiveState either. However, one thing I
did
> find might be helpful. From the PPD:
>
> OpenSSL and SSLeay glue that provides LWP https support Joshua
Chamas
> <joshua@chamas.com
>
> To install, from command line type
>
> > ppm install Crypt-SSLeay
>
> and that will download and install to all the correct places.
>
> hth,
>
> --
> Josiah <jdb@wcoil.com>
>
> eval' use" :perl hacks by Josiah "';
> $@=$@=$@=reverse $@=$@=reverse $@=$@;
> print map{substr($@,hex,1)}qw/3b 3c 3d 3e 3f 40 2c 06 01 07 03 06 04
02 0a
> 03 40 07 08 06 2d 07 08 14 06 40 04 34 35 07 08/;
>
> IDBugM <idbugm@idbugm.com> wrote in message
> news:8qh4au$h3r$1@nnrp1.deja.com...
> > I've looked all over the place for Net::SSLeay for a Win32 system
but
> > all I've found is the Unix one that needs to be compiled. I've
pulled
> > my hair out trying to get it to work on a Win32 system. Where would
I
> > begin looking? I didn't find it on activestate.com
> >
> >
> > In article <8qh2l6$58j$1@slb6.atl.mindspring.net>,
> > ebohlman@netcom.com (Eric Bohlman) wrote:
> > > IDBugM (idbugm@idbugm.com) wrote:
> > > : I'm in a bit of a bind. I'm trying to use Perl to post an XML
> > string to
> > > : a secure server. Since I'm running this script on a Win32
system
> > using
> > > : Net::SSLeay would be very difficult to use.
> > >
> > > Are you aware that Net::SSLeay has been compiled for Win32 and is
> > > available from ActiveState?
> > >
> > > : I've used the MSXML.DLL for ASP but I've never tried accessing
the
> > DLL's
> > > : from Perl. I've tried looking into all these groups for an
answer
> > but
> > > : maybe I'm making it more difficult than it really is. Here is
the
> > basic
> > > : code I use in VB that I'm trying to convert into Perl.
> > > :
> > > : dim anXMLhttpObject, strResult
> > > : Set anXMLhttpObject = Server.CreateObject("microsoft.XMLHttp")
> > > : anXMLhttpObject.open "POST",TransactionURL,false
> > > : anXMLhttpObject.setRequestHeader "Content-type", "text/xml"
> > > : anXMLhttpObject.send RequestXMLstring
> > > : strResult = anXMLhttpObject.responseText
> > > :
> > > : Anyone know how to convert this using the Win32::API module for
> > Active
> > > : State? Please help if you know how to do this. Thanks
> > >
> > > Since MSXML has a COM interface, you probably want to use
Win32::OLE
> > to
> > > access it.
> > >
> > >
> >
> >
> > Sent via Deja.com http://www.deja.com/
> > Before you buy.
>
>
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sat, 23 Sep 2000 21:07:59 +0200
From: tony@svanstrom.com (Tony L. Svanstrom)
Subject: multiple ties to a single DB_file
Message-Id: <1ehfjdb.ijmkyt1vm6h8iN%tony@svanstrom.com>
Ok, I've been exploring lots of fun (NOT) memory-related problems with
tie:ing and MacPerl today... and before I spend yet another day trying
something, that this time won't work, I thought I'd ask if it even is
possible to tie more than one hash to a single DB_File-file.
Out of habit I've mostly used plain text-files in the past, and since I
haven't tried anything like this in the past I don't know where the
limitation might be... and since not even MacsBug can save me from a
restart when MacPerl goes down I don't feel like testing every single
combination I can think of.
So... Anyone here that can give me an answer to this simple question?
/Tony
--
/\___/\ Who would you like to read your messages today? /\___/\
\_@ @_/ Protect your privacy: <http://www.pgpi.com/> \_@ @_/
--oOO-(_)-OOo---------------------------------------------oOO-(_)-OOo--
on the verge of frenzy - i think my mask of sanity is about to slip
---ôôô---ôôô-----------------------------------------------ôôô---ôôô---
\O/ \O/ ©99-00 <http://www.svanstrom.com/?ref=news> \O/ \O/
------------------------------
Date: Sat, 23 Sep 2000 18:08:12 GMT
From: "Neil Watson" <neilw@SPAMidirect.com>
Subject: Newbie needs help with search and replace
Message-Id: <gk6z5.32495$M%3.223945@quark.idirect.com>
I'm trying to write a script that will search and html file and replace
numbers like -250, 250, 500, 750 with -1, 1, 2, 3. Here is my script:
#!/usr/bin/perl -w
x=-5;
y=-1500;
while (x<5) {
s/x/y/g ;
x=x+1
y=y+250
}
I know there are some problems with the variables. Mainly will perl read
the numbers in the html file as numbers or strings? If strings do I change
variables to $x and $y? If so, then will $x=$x+1 work?
Or, am I nowhere close to the right idea?
Thanks
------------------------------
Date: Sat, 23 Sep 2000 18:58:16 GMT
From: mejarrell@worldnet.att.net (Maurice E. Jarrell)
Subject: Re: Newbie needs help with search and replace
Message-Id: <m3bsxf9rux.fsf@localhost.localdomain>
"Neil Watson" <neilw@SPAMidirect.com> writes:
> I'm trying to write a script that will search and html file and replace
> numbers like -250, 250, 500, 750 with -1, 1, 2, 3. Here is my script:
>
> #!/usr/bin/perl -w
I'm not an expert here, but...
Using -w is good. adding:
use strict;
would be even better
use diagnostics;
would give you much more info.
>
> x=-5;
> y=-1500;
_All_ scalar variables (AFAIK) in Perl should be prefaced with a $,
not just string variables. There is a lot of documentation that would
help you. Typing 'perldoc perldata' would tell you a little about
scalar variables. Better yet, try 'perldoc perl' and go through a few
of the topics in the list. The FAQ for this group. ( Posted here
every other week and searchable at any news archive) would provide
more resources. There are Perl FAQ's with the online docs. ( 'perldoc
perlfaq' )
>
> while (x<5) {
> s/x/y/g ;
>
> x=x+1 y=y+250 > }
Have you tried to run this? 'perldoc perlop' would tell you about the
s operator.
>
> I know there are some problems with the variables. Mainly will perl read
> the numbers in the html file as numbers or strings? If strings do I change
> variables to $x and $y? If so, then will $x=$x+1 work?
>
> Or, am I nowhere close to the right idea?
Read (documentation). Read(FAQ's). Read(archives of this group). Then ask.
>
> Thanks
Your welcome.
Mo.
------------------------------
Date: Sat, 23 Sep 2000 11:07:48 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Re: Perl, Unix and printers
Message-Id: <39CCF174.CB751246@stomp.stomp.tokyo>
vivekvp wrote:
> I want to write a script that would disable printer
> queues then reenable them with a perl script.
> The print queues are setup in a unix environment.
> Let say printers pr1 pr3 and pr3
$comments =~ s/that/which/;
You forgot your apostrophe for "let's say..."
which seems a commoner expression lately.
Do you want to clear printer queues or
disable printers? You cannot disable
then enable a printer queue. You can
disable and enable a printer.
> I would like to do a:
> disable pr1
> disable pr2
> disable pr3
> then be able to do an:
> enable pr1
> enable pr2
> enable pr3
Why? Tell me why you would disable printers
then turn right around and enable them? This
is like arriving at a stop sign in your car,
turning off your car engine in compliance
with this stop sign, then starting your engine
when it is an appropriate time to go.
> problem is - I have about 300 printers to do.
Main circuit breaker within your main circuit
breaker box will take care of this, in a flash.
> I guess I could load a printer list (print.txt) and
> put it in a loop with perl - and uses a system
> call to disable and enable:
Why don't you simply clear your printer queues?
Godzilla!
--
Dr. Kiralynne Schilitubi ¦ Cooling Fan Specialist
UofD: University of Duh! ¦ ENIAC Hard Wiring Pro
BumScrew, South of Egypt ¦ HTML Programming Class
------------------------------
Date: Sat, 23 Sep 2000 18:21:11 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Pure perl encrypt/decryption?
Message-Id: <jqspss0nq03fj5gb0sq6mu199b3tiicgg1@4ax.com>
Abigail wrote:
>|| You still have to SUID that binary.
>
>Not a problem if `su' is available.
Hmm? How can you pass it a password, when invoked from within a Perl
script? I've tried a few things, but I can't make it work. "man su"
doesn't seem to mention alternative ways to entering passwords, either.
--
Bart.
------------------------------
Date: 23 Sep 2000 18:32:38 GMT
From: abigail@foad.org (Abigail)
Subject: Re: Pure perl encrypt/decryption?
Message-Id: <slrn8sptns.lo9.abigail@alexandra.foad.org>
Bart Lateur (bart.lateur@skynet.be) wrote on MMDLXXX September MCMXCIII
in <URL:news:jqspss0nq03fj5gb0sq6mu199b3tiicgg1@4ax.com>:
\\ Abigail wrote:
\\
\\ >|| You still have to SUID that binary.
\\ >
\\ >Not a problem if `su' is available.
\\
\\ Hmm? How can you pass it a password, when invoked from within a Perl
\\ script? I've tried a few things, but I can't make it work. "man su"
\\ doesn't seem to mention alternative ways to entering passwords, either.
Use a pty.
Abigail
--
sub _ {$_ = shift and y/b-yB-Y/a-yB-Y/ xor !@ _?
exit print :
print and push @_ => shift and goto &{(caller (0)) [3]}}
split // => "KsvQtbuf fbsodpmu\ni flsI " xor & _
------------------------------
Date: 23 Sep 2000 19:10:00 GMT
From: dkcombs@netcom.com (David Combs)
Subject: Re: The XY problem (was Re: CGI.pm: controlling Back & Reload)
Message-Id: <8qiv68$oep$6@slb7.atl.mindspring.net>
In article <m18zt5muq9.fsf_-_@halfdome.holdit.com>,
Randal L. Schwartz <merlyn@stonehenge.com> wrote:
<SNIP>
>Often, my spider sense will tingle,
Now, THAT is one neat expression. Mind if we all steal it?
David
------------------------------
Date: 23 Sep 2000 12:33:17 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: The XY problem (was Re: CGI.pm: controlling Back & Reload)
Message-Id: <m14s36q4xu.fsf@halfdome.holdit.com>
>>>>> "David" == David Combs <dkcombs@netcom.com> writes:
>> Often, my spider sense will tingle,
David> Now, THAT is one neat expression. Mind if we all steal it?
I actually saw it here on CLPM a year or two back, and have been using
it for a while now. And yes, it's a call-back to the days when I
watched Spiderman on saturday mornings. That'd be 1967 to 1970, if
the IMDB is right.
"Spiderman, spiderman, does whatever a spider can; is he good, listen
bud, he's got radioactive blood... hey there, there goes the
spiderman!"
--
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: Sat, 23 Sep 2000 18:38:47 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: use vs. @ISA
Message-Id: <2ptpssc1t0td1jk1ri2fisg14pt7o7bik1@4ax.com>
bdesany@my-deja.com wrote:
>What's the difference? Is it that subroutines in packages that are
>being "used" are not accessible as object methods, and those in
>packages in @ISA are?
Wrong comparison. even wit hOO modules, you still need to "use" the
module (or require it) that you reference in @ISA. "use base MODULE"
will do both.
What is remarkable about "use", is that it imports the exported
functions from the used module into the namescpace where you call it
from. For example:
package Foo;
use Cwd;
The function cwd() exported from Cwd, will be imported into package Foo
and thus is available as Foo::cwd.
OO modules usually do not depend on this import mechanism. The class
name or object reference from which the method is called, will tell perl
were to search for it. And here another difference between OO and
procedural modules chimes in: the @ISA hash tells perl where to search
for any methods that you call, but that it didn't find in the class
(module) you explicitely called. That would never work in procedural
function calls.
--
Bart.
------------------------------
Date: Sat, 23 Sep 2000 18:15:43 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: variable -> constant?
Message-Id: <39ccf34f.263$28c@news.op.net>
In article <39CCCEE7.7040700@klamath.dyndns.org>,
Neil Conway <nconway@klamath.dyndns.org> wrote:
>eval {
>$val = $_[0];
>};
I think if you use
$val = eval "$_[0]";
it will work.
But I would recommend doing this instead:
sub test {
my $subr = shift;
no strict 'refs';
return &$subr;
}
------------------------------
Date: Sat, 23 Sep 2000 18:20:10 GMT
From: mjd@plover.com (Mark-Jason Dominus)
Subject: Re: variable -> constant?
Message-Id: <39ccf459.28e$19d@news.op.net>
In article <39ccf34f.263$28c@news.op.net>,
Mark-Jason Dominus <mjd@plover.com> wrote:
>I think if you use
>...
>But I would recommend doing this instead:
>...
I should add that it is really unclear what you are actually trying to
accomplish here, and that makes it hard to understand what advice to
give you.
Someone else in the thread already suggested that you evaluate the
constant and pass the value of the constant to the subroutine, rather
than the name. That is a much more normal thing to do, and if it
suits your purpose, that is what I would recommend. I was supposing
that you reallt did want to write a funciton that receives the name of
a constant and evaluates it to produce a value.
I was tempted to speculate about what you were trying to do but I
think I'd better not.
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V9 Issue 4414
**************************************