[19672] in Perl-Users-Digest
Perl-Users Digest, Issue: 1867 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Oct 4 03:05:31 2001
Date: Thu, 4 Oct 2001 00:05:10 -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: <1002179110-v10-i1867@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 4 Oct 2001 Volume: 10 Number: 1867
Today's topics:
decompile c++ ?? <twhardin@yahoo.com>
Re: decompile c++ ?? <Jon.Ericson@jpl.nasa.gov>
Re: Exists and Hash References <uri@sysarch.com>
Re: filehandles between functions (Mark Jason Dominus)
Re: filehandles between functions <uri@sysarch.com>
Re: filehandles between functions <uri@sysarch.com>
Re: GIF encoding (Martien Verbruggen)
Re: GIF encoding (Martien Verbruggen)
Is Perl for CGI going the way of the dodo? <thurbermingus1@netscape.net>
Re: Is Perl for CGI going the way of the dodo? <bigiain@mightymedia.com.au>
Re: Is Perl for CGI going the way of the dodo? <comdog@panix.com>
Re: Is Perl for CGI going the way of the dodo? <nobody@nowhere.com>
MAIN::PASSWD on true64 (Tony)
pattern matching between range <jzh@earthlink.net>
Re: perl cgi javascript (David Efflandt)
Re: perl cgi javascript <fabian_a_vega@YOU.SPAM.YOU.DIE.hotmail.com>
Re: perl script to summarize mail log (David Efflandt)
Re: RegExp /g shall substitute more often (Ian Boreham)
Re: Something wrong with this? <joe+usenet@sunstarsys.com>
Re: Something wrong with this? (Martien Verbruggen)
Re: Something wrong with this? <joe+usenet@sunstarsys.com>
Template-Toolkit <webmaster@thedarkcitadel.com>
Re: Urgently need help with Net::SSH::Perl / Math::Pari (BUCK NAKED1)
Re: What does POSIX-compliant mean ? <nobody@nowhere.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Thu, 04 Oct 2001 02:34:12 GMT
From: Ty Hardin <twhardin@yahoo.com>
Subject: decompile c++ ??
Message-Id: <3BBBCBEC.6387B0B2@yahoo.com>
is there any way to decompile c++ binaries if you have lost the source
code?
------------------------------
Date: 03 Oct 2001 19:20:03 +0000
From: Jon Ericson <Jon.Ericson@jpl.nasa.gov>
Subject: Re: decompile c++ ??
Message-Id: <861ykko7j0.fsf@jon_ericson.jpl.nasa.gov>
Ty Hardin <twhardin@yahoo.com> writes:
> is there any way to decompile c++ binaries if you have lost the source
> code?
This has nothing to do with perl.
Jon
------------------------------
Date: Thu, 04 Oct 2001 05:22:02 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: Exists and Hash References
Message-Id: <x7snd07zdx.fsf@home.sysarch.com>
>>>>> "MS" == Magnus Schmidt <news@27b-6.de> writes:
MS> print "test 1 exists\n" if exists $$data{'level1'}->{'level2'};
MS> # test 2 will fail
MS> print "test 2 exists\n" if exists $$data{'unknown'};
MS> print "test 3 exists\n" if exists $$data{'unknown'}->{'test'};
MS> # test 4 will succeed
MS> print "test 4 exists\n" if exists $$data{'unknown'};
MS> Output:
MS> test 1 exists
MS> test 4 exists
MS> The problem is, that test 2 fails as expected, but test 4
MS> succeeds. It seems that the exists() statement introduced a new
MS> hash element.
see my article on autovivification at:
http://tlc.perlarchive.com/articles/perl/ug0002.shtml
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 04 Oct 2001 04:34:25 GMT
From: mjd@plover.com (Mark Jason Dominus)
Subject: Re: filehandles between functions
Message-Id: <3bbbe6c4.2c8b$84@news.op.net>
In article <x71ykk9zpc.fsf@home.sysarch.com>,
Uri Guttman <uri@sysarch.com> wrote:
>a pipe inode has no size field to get.
In case you weren't tired of this yet, here's what the Unix V7 'stat' man
page has to say:
When fildes is associated with a pipe, fstat reports an
ordinary file with restricted permissions. The size is
the number of bytes queued in the pipe.
This was written in 1972, so as you can see the feature has been
around for a while.
--
@P=split//,".URRUU\c8R";@d=split//,"\nrekcah xinU / lreP rehtona tsuJ";sub p{
@p{"r$p","u$p"}=(P,P);pipe"r$p","u$p";++$p;($q*=2)+=$f=!fork;map{$P=$P[$f^ord
($p{$_})&6];$p{$_}=/ ^$P/ix?$P:close$_}keys%p}p;p;p;p;p;map{$p{$_}=~/^[P.]/&&
close$_}%p;wait until$?;map{/^r/&&<$_>}%p;$_=$d[$q];sleep rand(2)if/\S/;print
------------------------------
Date: Thu, 04 Oct 2001 05:16:31 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: filehandles between functions
Message-Id: <x7y9ms7zn4.fsf@home.sysarch.com>
>>>>> "MJD" == Mark Jason Dominus <mjd@plover.com> writes:
MJD> In article <x71ykk9zpc.fsf@home.sysarch.com>,
MJD> Uri Guttman <uri@sysarch.com> wrote:
>> a pipe inode has no size field to get.
MJD> On many Unix systems, a pipe inode's size is the number of bytes
MJD> available for reading in the pipe.
from solaris stat(2):
st_size For regular files, this is the address of the end
of the file. For block special or character spe-
cial, this is not defined. See also pipe(2).
and pipe(2) says:
NOTES
Since a pipe is bi-directional, there are two separate flows
of data. Therefore, the size (st_size) returned by a call to
fstat(2) with argument fildes[0] or fildes[1] is the number
of bytes available for reading from fildes[0] or fildes[1]
respectively. Previously, the size (st_size) returned by a
call to fstat() with argument fildes[1] (the write-end) was
the number of bytes available for reading from fildes[0]
(the read-end).
and on linux stat(2) doesn't mention pipes at all and pipe(2) never says
anything about getting the number of bytes available to read.
>> so why people thought -s will work on a pipe is a mystery to me.
MJD> Because it *does* work on a pipe. Whether this is standard behavior
MJD> or not, I don't know, but it certainly is widespread. Linux appears
MJD> to be an exception.
it does appear to be an exception. i would stick to an ioctl for
portabilty. then again, i prefer event loops and non-blocking io and
would almost never slurp a pipe.
and linux also caused me a major pain with non-blocking socket
connections when it returns the (NON!) error EINPROGRESS. solaris and
other unices return no error. the joys of porting.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 04 Oct 2001 05:18:08 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: filehandles between functions
Message-Id: <x7vghw7zkh.fsf@home.sysarch.com>
>>>>> "MJD" == Mark Jason Dominus <mjd@plover.com> writes:
MJD> In article <x71ykk9zpc.fsf@home.sysarch.com>,
MJD> Uri Guttman <uri@sysarch.com> wrote:
>> a pipe inode has no size field to get.
MJD> In case you weren't tired of this yet, here's what the Unix V7 'stat' man
MJD> page has to say:
MJD> When fildes is associated with a pipe, fstat reports an
MJD> ordinary file with restricted permissions. The size is
MJD> the number of bytes queued in the pipe.
MJD> This was written in 1972, so as you can see the feature has been
MJD> around for a while.
hmm, then linux broke another classic unix thing. see my other post on this.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture and Stem Development ------ http://www.stemsystems.com
Search or Offer Perl Jobs -------------------------- http://jobs.perl.org
------------------------------
Date: Thu, 4 Oct 2001 12:12:53 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: GIF encoding
Message-Id: <slrn9rnhd5.d6o.mgjv@martien.heliotrope.home>
[followups set, this is to offtopic for clp.misc]
On Wed, 03 Oct 2001 13:48:42 GMT,
Bart Lateur <bart.lateur@skynet.be> wrote:
> Martien Verbruggen wrote:
>
>> If YOU, the user,
>>are producing LZW compressed GIF right now, then YOU, the user, are
>>responsible for making sure that your software is covered by at least
>>one license from Unisys.
>
> Question: do you need a license to READ the GIF format?
\begin{offtopic}
Unisys has the following to say
(http://www.unisys.com/unisys/lzw/):
More and more people are becoming aware that the reading and/or
writing of GIF images requires a license to use Unisys patented Lempel
Ziv Welch (LZW) data compression and decompression technology, including
United States Patent No. 4,558,302, Japanese Patent Numbers 2,123,602
and 2,610,084, and patents in Canada, France, Germany, Italy and the
United Kingdom. Since January of 1995, Unisys has entered into almost
two thousand license agreements for use of GIF and other LZW-based
technology.
There is more information on http://burnallgifs.org, which seems to
say that, yes, LZW decompression also requires a license.
Martien
PS. The requirement for the developer to provide their own license is
not limited to applications that use free libraries or software. Many
of Microsoft's products are not licensed in such a way that a developer
may redistribute applications linked against libraries that use LZW
compression (see e.g. the above Unisys URL, and
http://www.microsoft.com/DEVONLY/Unisys.htm)
\end{offtopic}
--
Martien Verbruggen |
Interactive Media Division | Never hire a poor lawyer. Never buy
Commercial Dynamics Pty. Ltd. | from a rich salesperson.
NSW, Australia |
------------------------------
Date: Thu, 4 Oct 2001 12:19:27 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: GIF encoding
Message-Id: <slrn9rnhpf.d6o.mgjv@martien.heliotrope.home>
[followups set]
On Wed, 03 Oct 2001 20:00:57 +0200,
Philip Newton <pne-news-20011003@newton.digitalspace.net> wrote:
> On Wed, 3 Oct 2001 21:56:50 +1000, mgjv@tradingpost.com.au (Martien
> Verbruggen) wrote:
>
>> What people don't seem to realise is that _if_ they use and install that
>> older version of libgd and/or GD, that _they_ (the users) are
>> responsible for obtaining the correct license from Unisys to be able to
>> produce LZW compressed GIF.
>
> Older version of libgd do not write LZW compressed GIFs (at least, the
> medium-age ones before the thing was discontinued -- I don't know about
> the very old ones). They use a different algorithm which is,
> nevertheless, accepted by GIF readers. Don't ask me about the details.
Boutell first removed LZW compression, and in a later version removed
all GIF support.
> So I think Boutell dropped the support not because he had to, but
> because there could have been a hassle anyway.
He had many reasons to drop GIF support. :)
Martien
--
Martien Verbruggen |
Interactive Media Division | +++ Out of Cheese Error +++ Reinstall
Commercial Dynamics Pty. Ltd. | Universe and Reboot +++
NSW, Australia |
------------------------------
Date: Wed, 3 Oct 2001 22:19:15 -0600
From: "Thurber Mingus" <thurbermingus1@netscape.net>
Subject: Is Perl for CGI going the way of the dodo?
Message-Id: <9pgo09$76r$1@suaar1ab.prod.compuserve.com>
I am curious as to the opinions of informed people in this ng about the
future of Perl for CGI. JSP and ASP seem to be where its at and where its
going. TIA
------------------------------
Date: Thu, 04 Oct 2001 15:04:10 +1000
From: Iain Chalmers <bigiain@mightymedia.com.au>
Subject: Re: Is Perl for CGI going the way of the dodo?
Message-Id: <bigiain-5F6C0A.15041004102001@news.zip.com.au>
In article <9pgo09$76r$1@suaar1ab.prod.compuserve.com>, "Thurber
Mingus" <thurbermingus1@netscape.net> wrote:
> I am curious as to the opinions of informed people in this ng about the
> future of Perl for CGI. JSP and ASP seem to be where its at and where its
> going. TIA
>
What you mean is "JSP and ASP are getting _talked_ about a lot, the
people using perl are too busy actually building websites to waste time
pretending to be "where its at"...
<grin>
big (mod_perl/apache _rules_ :-)
------------------------------
Date: Thu, 04 Oct 2001 00:09:07 -0500
From: brian d foy <comdog@panix.com>
Subject: Re: Is Perl for CGI going the way of the dodo?
Message-Id: <comdog-B32712.00090704102001@news.panix.com>
In article <9pgo09$76r$1@suaar1ab.prod.compuserve.com>, "Thurber
Mingus" <thurbermingus1@netscape.net> wrote:
> I am curious as to the opinions of informed people in this ng about the
> future of Perl for CGI. JSP and ASP seem to be where its at and where its
> going.
neither of those are CGI though. ASP still requires you to use
some language, too. Perl is as good as for the web as it ever
was, although CGI has severe shortcomings.
--
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: Thu, 4 Oct 2001 15:28:08 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: Is Perl for CGI going the way of the dodo?
Message-Id: <zpSu7.48394$812.66214@newsfeeds.bigpond.com>
"Thurber Mingus" <thurbermingus1@netscape.net> wrote in message
news:9pgo09$76r$1@suaar1ab.prod.compuserve.com...
> I am curious as to the opinions of informed people in this ng about the
> future of Perl for CGI. JSP and ASP seem to be where its at and where its
> going. TIA
Well ... there are a lot more jobs ads for Java, Cold Fusion and ASP than
Perl.
I've been designing an investment site that produces stock charts, downloads
stock price information every few minutes, runs end of day statistics, etc.
Perl/mysql/Apache/Linux is my choice, 'cause it's cheap. JSP would be an
option, but there are'nt too many hosting services that provide it at the
moment. And I don't know how I would schedule my regular stock price
downloads with ASP/IIS.
I would use ASP or CF for the easy stuff. But for anything with background
processing/interprocess communication/sockets, Perl is the way to go.
gtoomey
------------------------------
Date: 3 Oct 2001 23:56:28 -0700
From: tadermann@hotmail.com (Tony)
Subject: MAIN::PASSWD on true64
Message-Id: <6db8eeaf.0110032256.3b245b21@posting.google.com>
Hi All,
I'm new to perl and trying some scripts from a book, the following
code gives me this error;
Name "main::passwd" used only once: possible typo at /scripts/whatgrp
line 28.
Platform;
Alpha - True64 4.05
Code;
my @groupNames = ();
my @groupIds = ();
# Do this until there are no more records.
***** offending line below ****
while (($groupName, $passwd, $gid, $memberList) = getgrent())
{
# We need to look for the login id in the member list.
if ($memberList =~ /$LoginId/)
{
# Add the group name ti the group name array.
push (@groupNames, $groupName);
# Add the GID to the GID array.
push (@groupIds, $gid);
}
}
Any thoughs would be appreciated, as the script completes successfully
otherwise, my guess is that Digital I mean Compaq I mean HP i thinks,
implementation of getgrent returning differently nut the man doco just
states the 4 paramaters as they are sequenced above.
Thanks,
Tony
------------------------------
Date: Thu, 04 Oct 2001 05:34:24 GMT
From: "jzh" <jzh@earthlink.net>
Subject: pattern matching between range
Message-Id: <AxSu7.864$2p1.115708@newsread2.prod.itd.earthlink.net>
I need to match between a range in a file.
File:
Hpppppppp
S01010101
D.................
Dxxxxxxxxx
Dvvvvvvvvv
Hqqqqqqqq
S33333333
Drrrrrrrrrrrrr
Dpppppppp
Hqqqqqqqq
S01010101
Dlllllllllllllllllllll
Dpppppppp
I need to match based on the pattern found in lines starting with S
then I need to return the values between H (the line before the match until
next occurance of H)
The Pattern starting with S may not be unique in the input file.
Example output:
based on matching on S01010101
Hpppppppp
S01010101
D.................
Dxxxxxxxxx
Dvvvvvvvvv
Hqqqqqqqq
S01010101
Dlllllllllllllllllllll
Dpppppppp
I used the range operator in regex to print between but it does not return
the proper values
My code:
#!/usr/bin/perl
@keys=qw/S01010101 S33333333/;
@file=<>;
sub print_records {
foreach $key (@keys) {
for (@file) {
if (/^$key/ ... /^H/) {print}
}
}
}
Thanks in advance.
Joey
------------------------------
Date: Thu, 4 Oct 2001 01:49:30 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: perl cgi javascript
Message-Id: <slrn9rng19.c3v.efflandt@typhoon.xnet.com>
On Wed, 3 Oct 2001 20:17:13 -0400, Steven Marx <smarx@i2000.com> wrote:
> i have several perl cgi generated client submit objects which i
> differentiate by value and interpret in my server side perl cgi program. i
> handle them with a single onSubmit() function which calls a javascript
> function to insure that the form is valid before submission. this all works
> well. my problem is that i need to communicate which submit object was
> actually activated for a particular call. i cannot seem to find a way to do
> this. any help would be appreciated.
> thanks in advance
> steve
Use a different name and/or value for the submit button. I usually just
check name which is easier to test for, since the value may be a longer
multiword string (for the label). For example:
if (param('preview')) {
# display formatted input and maybe form for further editing
} elsif (param('final')) {
# store or e-mail results
} else {
# default form
}
But I don't know if Javascript would interfere with this, because there
are too many versions to keep track of, and the browser may have it
disabled, so I do not use it. It is easy enough to validate data from the
CGI and spit out the form with submitted values and flagged errors for
further editing using CGI.pm
--
David Efflandt - All spam is ignored - http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: Thu, 04 Oct 2001 06:53:46 GMT
From: fabian <fabian_a_vega@YOU.SPAM.YOU.DIE.hotmail.com>
Subject: Re: perl cgi javascript
Message-Id: <3BBC06AB.5030103@YOU.SPAM.YOU.DIE.hotmail.com>
David Efflandt wrote:
> On Wed, 3 Oct 2001 20:17:13 -0400, Steven Marx <smarx@i2000.com> wrote:
>
>>i have several perl cgi generated client submit objects which i
>>differentiate by value and interpret in my server side perl cgi program. i
>>handle them with a single onSubmit() function which calls a javascript
>>function to insure that the form is valid before submission. this all works
>>well. my problem is that i need to communicate which submit object was
>>actually activated for a particular call. i cannot seem to find a way to do
>>this. any help would be appreciated.
>>thanks in advance
>>steve
>>
>
> Use a different name and/or value for the submit button. I usually just
> check name which is easier to test for, since the value may be a longer
> multiword string (for the label). For example:
>
> if (param('preview')) {
> # display formatted input and maybe form for further editing
> } elsif (param('final')) {
> # store or e-mail results
> } else {
> # default form
> }
>
> But I don't know if Javascript would interfere with this, because there
> are too many versions to keep track of, and the browser may have it
> disabled, so I do not use it. It is easy enough to validate data from the
> CGI and spit out the form with submitted values and flagged errors for
> further editing using CGI.pm
>
>
i usually do both: validate data on the client-side with javascript and
server-side in perl in case the client has the javascript disabled.
-fabian
------------------------------
Date: Thu, 4 Oct 2001 03:16:04 +0000 (UTC)
From: efflandt@xnet.com (David Efflandt)
Subject: Re: perl script to summarize mail log
Message-Id: <slrn9rnl3j.c3v.efflandt@typhoon.xnet.com>
On 3 Oct 2001 22:23:21 GMT, PM WONG <s11976@net2.hkbu.edu.hk> wrote:
> Looking for a perl script (or sh script will do if it works)
> to give a summary of
> Sender Recipient date/time status(ok or not)
>
> by scanning the /var/spool/mqueue/syslog
>
> We run sendmail 8.9.x
You just need to construct a regex to match your logs. For example the
following quick hack works for my sendmail log in Linux, although, it
needs something to match $id between 'from' and 'to' lines when things get
busy:
#!/usr/bin/perl -w
my ($date, $id, $from, $to, $stat);
my $prefix = '(\w+\s+\d+ [\d:]+) \w+ sendmail[^\s]+ (\w+):';
open(IN,"/var/log/mail") || die "Can't open maillog: $!";
while (! eof IN) {
$line = <IN>;
chomp($line);
if ($line =~ /^$prefix from=([^,]+),/) {
$date = $1;
$id = $2;
$from = $3;
} elsif ($line =~ /^$prefix to=([^,]+).+ stat=(.+)$/) {
$date = $1;
$id = $2;
$to = $3;
$stat = $4;
# add code to verify that $id matches for $from and $to
$from = 'unknown' unless $from;
print "$from\t$to\t$date\t$stat\n";
($date, $id, $from, $to, $stat) = undef;
}
}
close IN;
--
David Efflandt - All spam is ignored - http://www.de-srv.com/
http://www.autox.chicago.il.us/ http://www.berniesfloral.net/
http://cgi-help.virtualave.net/ http://hammer.prohosting.com/~cgi-wiz/
------------------------------
Date: 3 Oct 2001 23:56:43 -0700
From: ianb@ot.com.au (Ian Boreham)
Subject: Re: RegExp /g shall substitute more often
Message-Id: <f02c4576.0110032256.3dbf8492@posting.google.com>
[cross-posting to c.l.p.modules removed]
"Markus Dehmann" <markus.cl@gmx.de> wrote in message news:<9pfgbs$i2aes$1@ID-101658.news.dfncis.de>...
> But why, then, doesn't this work for my carter-bush-clinton example?
Because your regex is not appropriate.
> $string = "bla-R carter-R bush-R clinton-R dunnowman-R clinton-R bla-R";
>
> my @places;
> while( $string =~ m/(?=\w+-R \w+-R clinton-)./g ) {
> push @places, pos($string);
> }
> print "$string\n";
>
> print "@places\n";
> substr($string, $_ - 1, 1, "D") for reverse @places; # offset by 1 for .
> print "$string\n";
>
> it matches at 13 positions but should exactly match at 2 positions,
> shouldn't it? The result is
> bla-R DDDDDD-R bush-R DDDDDDD-R dunnowman-R clinton-R bla-R
Due to the non-overlapping nature of the s///g, and the fact that the
matches occur starting at the leftmost-possible position, s///g will
match from the start of each <name>-R group, consume the whole, and
continue from the end for the next match.
In your case, you are using a regex that could actually match starting
at any point in <name>, and due to the use of lookahead, each position
is tried for the next potential match. To avoid matches beginning in
the middle of <name>, you should use a word boundary (\b):
#!/usr/bin/perl -w
$string = "bla-R carter-R bush-R clinton-R dunnowman-R clinton-R
bla-R";
my @places;
while( $string =~ m/(?=\b\w+-R \w+-R clinton-)./g ) {
push @places, pos($string);
}
print "$string\n";
print "@places\n";
substr($string, $_ - 1, 1, "D") for reverse @places; # offset by 1 for
.
print "$string\n";
OUTPUT:
bla-R carter-R bush-R clinton-R dunnowman-R clinton-R bla-R
7 23
bla-R Darter-R bush-R Dlinton-R dunnowman-R clinton-R bla-R
> Why???
>
> When I look for this:
> while( $string =~ m/(?=\w+-R \w+-R clinton-)R/g ) {
> instead of this:
> while( $string =~ m/(?=\w+-R \w+-R clinton-)./g ) {
> there is no match at all!
>
> Is the positive lookahead buggy if (?=...) stands _before_ the expression to
> match?
Why do people always assume it's a bug in perl?
Incidentally, try to avoid oversimplifying the problem. You'll get a
lot of answers to what you ask for, but none for what you wanted to
know.
---
The answers you are getting are answering the question "How can I do a
replace in reverse order for patterns matched at every possible match
position?" It's not clear to me from your examples if that is actually
what you want. To me, it is undefined what it means to simultaneously
replace the same chunk (or overlapping chunks) of text with two more
pieces of text.
[I have replaced AA with XY in the following examples, for clarity.]
You can rule out overlaps, as s///g does (AAA -> XYA), you can specify
that the match positions and lengths are recorded, and substitutions
done in reverse order (AAA -> XYY), you can produce similar behaviour
(with more housekeeping) in the forward direction (it's more painful
because the positions are indexed from the start) (AAA -> XXY), but it
doesn't make any sense to me to somehow apply them simultaneously.
Regards,
Ian
------------------------------
Date: 03 Oct 2001 22:37:47 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Something wrong with this?
Message-Id: <m3r8skjfk4.fsf@mumonkan.sunstarsys.com>
BCC <a@b.c> writes:
> my $file = $query->param("upload");
>
> open(QUERY, "> $outfile") or die "Could not open file for writing!";
>
> if ($file ne '') {
^^^^^^^^^^
if ($file) { # all false values are unacceptible here
[...]
> Im not sure if this is something I did wrong with CGI.pm, or if it is an
> Apache issue. Apache has the default settings, and for CGI, I use this
> line for upload size:
Check the server settings for maximum upload size, in particular
LimitRequestBody
if it's an apache server.
--
Joe Schaefer "Language is the dress of thought."
-- Samuel Johnson
------------------------------
Date: Thu, 4 Oct 2001 13:07:52 +1000
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: Something wrong with this?
Message-Id: <slrn9rnkk8.d6o.mgjv@martien.heliotrope.home>
On 03 Oct 2001 22:37:47 -0400,
Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
> BCC <a@b.c> writes:
>>
>> if ($file ne '') {
> ^^^^^^^^^^
>
> if ($file) { # all false values are unacceptible here
Why isn't the file allowed to be called "0"?
Martien
--
Martien Verbruggen |
Interactive Media Division | Unix is user friendly. It's just
Commercial Dynamics Pty. Ltd. | selective about its friends.
NSW, Australia |
------------------------------
Date: 03 Oct 2001 23:24:49 -0400
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: Something wrong with this?
Message-Id: <m3lmisjddq.fsf@mumonkan.sunstarsys.com>
mgjv@tradingpost.com.au (Martien Verbruggen) writes:
> On 03 Oct 2001 22:37:47 -0400,
> Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
> > BCC <a@b.c> writes:
> >>
> >> if ($file ne '') {
> > ^^^^^^^^^^
> >
> > if ($file) { # all false values are unacceptible here
>
> Why isn't the file allowed to be called "0"?
It is, but that would be "$file". $file is a ref to
a filehandle object (package Fh in the CGI.pm src)
that has overloaded '""'.
FWIW, here's how upload is implemented there:
sub upload {
my($self,$param_name) = self_or_default(@_);
my $param = $self->param($param_name);
return unless $param;
return unless ref($param) && fileno($param);
return $param;
}
It's a bit safer than a bare $q->param('upload') call
since it does all these checks for you.
--
Joe Schaefer "A foolish consistency is the hobgoblin of little minds, adored
by little statesmen and philosophers and divines."
-- Ralph Waldo Emerson
------------------------------
Date: Thu, 04 Oct 2001 03:44:42 GMT
From: "Evil Overlord" <webmaster@thedarkcitadel.com>
Subject: Template-Toolkit
Message-Id: <KWQu7.51783$1c1.9794279@typhoon.kc.rr.com>
Anybody use this? Is it any good?
--
-------------------------------
Newsgroup: alt.eo
For all your Evil Overlord Needs
http://www.thedarkcitadel.com
------------------------------
Date: Thu, 4 Oct 2001 00:31:47 -0500 (CDT)
From: dennis100@webtv.net (BUCK NAKED1)
Subject: Re: Urgently need help with Net::SSH::Perl / Math::Pari / @INC and ...
Message-Id: <2270-3BBBF443-7@storefull-248.iap.bryant.webtv.net>
My apologies. I can't believe my above post posted 3 times.
Regards,
--Dennis
------------------------------
Date: Thu, 4 Oct 2001 15:36:29 +1000
From: "Gregory Toomey" <nobody@nowhere.com>
Subject: Re: What does POSIX-compliant mean ?
Message-Id: <oxSu7.48398$812.65105@newsfeeds.bigpond.com>
"Ilya Martynov" <ilya@martynov.org> wrote in message
news:87wv2ck5vz.fsf@abra.ru...
> >>>>> On Wed, 03 Oct 2001 19:04:17 +0200, Rinus Luijmes
<digirini@xs4all.nl> said:
>
> RL> Maybe offtopic but the question in the subject of this mail came up
> RL> when reading Linux and Perl documentation. Is POSIX an abbreviation
> RL> for a set of rules?
>
> From my dictionary:
>
> POSIX - Portable Operating System for unIX
>
> (POSIX) A set of IEEE standards
> designed to provide application portability between Unix
> variants. IEEE 1003.1 defines a Unix-like operating system
> interface, IEEE 1003.2 defines the shell and utilities and
> IEEE 1003.4 defines real-time extensions.
>
It was an attempt to define a set of common system calls, so that all
flavours of Unix would be compatible. Windows NT is also supposed to be
Posix compliant, so Perl should run OK there as well.
gtoomey
------------------------------
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 1867
***************************************