[13696] in Perl-Users-Digest
Perl-Users Digest, Issue: 1106 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Oct 18 08:05:36 1999
Date: Mon, 18 Oct 1999 05: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: <940248310-v9-i1106@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Mon, 18 Oct 1999 Volume: 9 Number: 1106
Today's topics:
'use FileHandle' fails if indirectly referenced from a <andrew.mclaren@swx.ch>
.htaccess <jjyooi@dcs.qmw.ac.uk>
Re: file xfer via modem (Arved Sandstrom)
fork (????) <lzu99dk@rdg.ac.uk>
ftp via proxy? <eedjoes@eed.ericsson.se>
Re: FTP: The fastest most efficient way to do this? <ralawrence@my-deja.com>
Re: Makefile.pl modification question <owen@vvl.co.uk>
Re: Need help with seek/sysseek <greynite@mindspring.com>
Net::Irc? <diablo@cryptic.org>
Re: newbie - counting data lines <eedjoes@eed.ericsson.se>
Re: newbie - counting data lines <rhomberg@ife.ee.ethz.ch>
Re: Newbie Question <chuckwilliams1@netscape.net>
Oh god! Not another Net::ftp question! <ralawrence@my-deja.com>
Re: Oh god! Not another Net::ftp question! <gellyfish@gellyfish.com>
One bug with local and one bug with perlbug (Eric Brunet)
Re: PDFlib size settings <csaba.raduly@sophos.com>
Porting Mind.Forth to Perl <mentifex@my-deja.com>
regexp-problem <andreas@vierengel.de>
Re: regexp-problem <jeffp@crusoe.net>
Re: regexp-problem <eedjoes@eed.ericsson.se>
send mail in perl <dannyho@mail.com>
Re: send mail in perl <gellyfish@gellyfish.com>
Re: tmtowtdt? Getting the date <NukeEmUp@ThePentagon.com>
Re: using Tie::IxHash with nested hash tables (Matt Dale)
Re: Why does this match take so long? <rhomberg@ife.ee.ethz.ch>
re: { local $x } pos($x) bug <jeffp@crusoe.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 18 Oct 1999 11:19:49 GMT
From: aml <andrew.mclaren@swx.ch>
Subject: 'use FileHandle' fails if indirectly referenced from a setuid script
Message-Id: <7uevog$bv2$1@nnrp1.deja.com>
I’ll give the background to the overall scenario. Maybe there is a
totally different way of tackling this that will avoid the problem
altogether.
We have a 3rd party application that we use heavily in-house. Access to
the product is based strictly on the account with which you access the
product (and access via a personal account is a pre-requisite of the
product and the way it works). Initial connection to the product
involves a cross network database attachment, and is an expensive
operation. Once a connection is open, operations are relatively cheap,
but reopening a connection for each operation is not viable. We have
built our own XS extension to embed the application access and
functionality into Perl. This interface is used substantially in our
own tools and utilities.
We are currently investigating providing access to some of the
applications functionality via our in-house web. While we have most of
the pieces in place to do this, the major difficulty is in managing the
user and connection context that the above model requires.
The current model we are investigating is to access this via a root
Perl CGI script with setuid rights, which can then assume the identity
of any user (and, yes, there are a heap of authentication issues that
we are still working through here!). To retain the connection context,
we are using a local daemon package that already exists in-house. This
transparently provides a background process running in the initiators
context, together with the communication channels between this daemon
and its clients. The client can disappear and reappear, while the
daemon retains the static application connections (typically with some
inactivity timeout). A mock-up of this is running without the setuid
rights.
Now the specific problems, and some questions;
1) Many of our internal packages are accessed via the PERL5LIB
environment variable. It appears that as soon as a Perl script has
setuid rights, PERL5LIB is no longer loaded into @INC on activation.
While I can find nothing specific about this, I can understand why Perl
behaves this way. Currently the PERL5LIB definitions are being loaded
manually into @INC in a BEGIN block, prior to any of the packages being
required. Is there any other way of handling this?
2) The package that provides the communication channels between the
client and local daemon uses the FileHandle module to provide its
communication primitives, which works perfectly outside setuid.
However, as soon as setuid is set on the script, the following error is
reported;
Can’t call method “import” without a package or object reference at
….FileHandle.pm line 3
Line 3 contains ‘use 5.003-11’
To make this even curlier, a ‘use FileHandle’ directly in the setuid
script works fine. However, if the setuid uses another package, and
this second package contains the ‘use FileHandle’, it then fails. This
can be demonstrated with two 1 line scripts;
Setuid script
use TEST;
TEST.pm
use FileHandle;
1;
fails, whereas;
Setuid script
use FileHandle;
succeeds?
I assume this is a simple version check (I had previously thought this
was only supported via ‘require??). What does a ‘use version’ achieve
that a ‘require’ doesn’t? Can someone explain what is happening above –
I’m lost.
Thanks for any help, explanations or suggestions you can provide.
Andrew
--
Andrew McLaren
Swiss Stock Exchange
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Oct 1999 12:32:15 +0100
From: Johnny 'Loopy' Ooi <jjyooi@dcs.qmw.ac.uk>
Subject: .htaccess
Message-Id: <380B053F.39F429A6@dcs.qmw.ac.uk>
Which module do I use to manage my .htaccess file. I'm running Win95,
not NT and most of the module I've found either require NT or are not
installed yet. Can anyone help?
--
Johnny Ooi. Aliases: Loopy, Tuxedo Mask, Quote Master.....
E-Mail : jjyooi@dcs.qmw.ac.uk or jjyooi@yahoo.com
WWW : http://www.dcs.qmw.ac.uk/~jjyooi/
ICQ No : 6155774
"Stay sane guys!"
===============================================================
------------------------------
Date: Mon, 18 Oct 1999 06:59:35 -0300
From: Arved_37@chebucto.ns.ca (Arved Sandstrom)
Subject: Re: file xfer via modem
Message-Id: <Arved_37-1810990659350001@dyip-3.chebucto.ns.ca>
In article <11f733ec.d647037a@usw-ex0106-041.remarq.com>, Aaron Lister
<alister2NOalSPAM@csc.co.nz.invalid> wrote:
> I need to be able to transfer a file via a modem. I want this to be
> automated. Does anyone know if a module exists that may allow me to do
> this. If not, any suggestions?
>
I guess the question is, what do you specifically mean by "transfer a file
via modem"? Because if you're talking about a modem which has a PPP link
established then just use Net::FTP. I don't know if your problem is this
simple, but it could be. :-)
Arved Sandstrom
------------------------------
Date: Mon, 18 Oct 1999 12:39:45 +0100
From: Dimitrios Kremmydas <lzu99dk@rdg.ac.uk>
Subject: fork (????)
Message-Id: <380B0701.237F2D49@rdg.ac.uk>
I want to do something (e.g Open an FTP Connection, open an SMTP
connection) but I WANT TO HAVE IT MANY TIMES SIMULTANEOUSLY ...
I know how to make FTP or SMTP (Net::*) through Perl, but I don't know
how to make child processes (that means ... make something
simultaneously) ...
I know it has something to do with fork and pid and etc.
But since I cannot understand them very well, can somebody send me a
simple examples, explaining what is going on on th code ? Even locations
of Internet Resources would be happily acceptable ...
cheers
------------------------------
Date: Mon, 18 Oct 1999 11:40:52 +0200
From: Joern Stein <eedjoes@eed.ericsson.se>
Subject: ftp via proxy?
Message-Id: <380AEB24.FEE30B24@eed.ericsson.se>
Hi,
can I do ftp transfers via a proxy in perl? Browsing the perldocs I've
gotten the feeling it should be possible, but I can't get it to work.
My attempt looks like:
$ua = LWP::UserAgent->new();
$ua->proxy(['http','ftp'] => 'http://www-proxy:8080');
$ua->timeout(30);
$url='ftp://user:password@ftp.blablabla.com/';
$req=HTTP::Request->new("PUT", $url);
$resp=$ua->request($req, "./file.html");
print $resp->content;
but fails with: "read timeout"
The proxy setting works for HTTP and in Netscape also for FTP. Who can
point me to the right direction?
--
Cheers
Joern Stein
------------------------------
Date: Mon, 18 Oct 1999 10:06:05 GMT
From: Richard Lawrence <ralawrence@my-deja.com>
Subject: Re: FTP: The fastest most efficient way to do this?
Message-Id: <7uere9$9g4$1@nnrp1.deja.com>
In article <MPG.1270d2f6b713586598980b@nntp1.ba.best.com>,
moseley@best.com (Bill Moseley) wrote:
> Richard Lawrence (ralawrence@my-deja.com) seems to say...
> > I need to write a little function that takes in a username,
password,
> > address and port number and return either 0 (no ftp service / no
such
> > server / bad username or password), 1 (good password, able to log
in)
> > or 2 (too many users).
> >
> > Since this function will be called I need it to be as _efficient_ as
> > possible and this is where I am stuck.
>
> That's a good start. I find making functions that I _don't_ call
> _efficient_ doesn't really seem to help much.
>
Oops, I meant to type "since this function will be called [a couple of
hundred times and the user will be sitting there waiting for the
results] I need it to be ..."
:o)
Thanks.
Rich
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Oct 1999 12:12:09 +0100
From: Owen Brydon <owen@vvl.co.uk>
Subject: Re: Makefile.pl modification question
Message-Id: <380B0089.11936B9D@vvl.co.uk>
The Crest Hotel wrote:
>
> Sorry, I'm running on a UNIX platform, btw =)
>
> In article <7uds4q$ljm$1@nnrp1.deja.com>,
> info@cresthotel.bc.ca wrote:
> > I'm trying to build and install a 3rd party Perl module but I don't
> > have rights to "make install" in the standard directories. I have my
> > own personal /lib folder that I want to install into. How do I modify
> > Makefile.pl to make this happen? Or do I modify the Makefile directly?
> > Your time is greatly appreciated.
[snip]
FAQ:
perldoc perlfaq8: How do I keep my own module/library directory?
--
Owen Brydon, Test Development Engineer
VLSI Vision Ltd
http://www.vvl.co.uk
owen@vvl.co.uk
------------------------------
Date: Mon, 18 Oct 1999 10:46:27 GMT
From: Shawn Collenburg <greynite@mindspring.com>
Subject: Re: Need help with seek/sysseek
Message-Id: <7uetq2$ase$1@nnrp1.deja.com>
In article <7ud4ue$7bq$1@nnrp1.deja.com>,
Thank you Dheera! Twas exactly the problem. My confusion stemmed
from the fact that "+>>" was implemented differently on the binary
I used to begin development / testing with :(
FWIW, I need to use "+<" if the file has already been created. The
updated program is below [you comments].
Cheers,
Shawn
Dheera <dheera@usa.net> wrote:
> In your first program - I don't believe there is any way to seek a
> handle that has been assigned to a pipe... try opening a file instead!
>
> In both of your programs, you're using the "+>>" mode to open. Use
"+>"
> instead since you're doing random access, not an append. So rewrite
> your open's like this:
> open FILE,"+>seektest2.txt";
>
> Also consider using the sysopen command instead of open, if you're
only
> using sys* commands...
>
> Hope this helps,
> Dheera
$cgi = "";
# Check to see if running as a web script
if ( exists $ENV{'LOCAL_ADDR'} ) {
print "Content-type: text/html\n\n";
print "<TITLE>seektest.pl</TITLE><HEAD><H2>seektest.pl</H2></HEAD>";
print "<BODY><HR>";
$cgi = "<P>";
}
print "PERL v. $]\n$cgi";
print "\$^X = $^X\n\n$cgi";
if ( open(FILE,"|which perl.exe") ) {
while (<FILE>) {
print "$_$cgi";
}
}
unlink "seektst1.txt";
open FILE,"+>seektst1.txt" || print "Open +>seektst1.txt failed\n$cgi";
print "Seek 1 rc=".seek(FILE, 0, 0)." $cgi";
print FILE "12345\n\n";
print "Seek 2 rc=".seek(FILE, 2, 0)."\n$cgi";
print FILE "=12";
seek FILE, 0, 0;
$line = <FILE>;
chomp $line;
close FILE;
print "Seek(3) = $line;";
if ( $line eq "12=12" ) {
print " Success!\n\n$cgi";
} else {
print " FAIL \n\n$cgi";
}
open FILE,"+<seektst1.txt" || print "Open +<seektst1.txt failed\n$cgi";
$line = <FILE>;
chomp $line;
print "Reopen +< = $line ";
print "Seek 3 rc=".seek(FILE, 1, 0)."\n$cgi";
print FILE "+1=";
seek FILE, 0, 0;
$line = <FILE>;
chomp $line;
close FILE;
print "Seek(3) = $line;";
if ( $line eq "1+1=2" ) {
print " Success!\n\n$cgi";
} else {
print " FAIL \n\n$cgi";
}
#############################################3
unlink "seektst2.txt";
open FILE,"+>seektst2.txt" || print "Open +>seektst2.txt failed\n$cgi";
print "Sysseek 1 rc=".sysseek(FILE, 0, 0)." $cgi";
syswrite FILE, "12345\n\n", 5+2*length($/), 0;
print "Sysseek 2 rc=".sysseek(FILE, 2, 0)."\n$cgi";
syswrite FILE, "=12", 3, 0;
sysseek FILE, 0, 0;
sysread FILE, $line, 6, 0;
chomp $line;
close FILE;
print "SysSeek(2) = $line;";
if ( $line eq "12=12" ) {
print " Success!\n\n$cgi";
} else {
print " FAIL \n\n$cgi";
}
open FILE,"+<seektst2.txt" || print "Open +<seektst2.txt failed\n$cgi";
sysread FILE, $line, 6, 0;
chomp $line;
print "Reopen +< = $line ";
print "Sysseek 3 rc=".sysseek(FILE, 1, 0)."\n$cgi";
syswrite FILE, "+1=", 3, 0;
sysseek FILE, 0, 0;
sysread FILE, $line, 6, 0;
chomp $line;
close FILE;
print "Sysseek(2) = $line;";
if ( $line eq "1+1=2" ) {
print " Success!\n\n$cgi";
} else {
print " FAIL \n\n$cgi";
}
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Sun, 17 Oct 1999 15:33:16 -0400
From: "Rob Williams" <diablo@cryptic.org>
Subject: Net::Irc?
Message-Id: <7ud865$7tb$1@news.auaracom.net>
I'm trying to write a routine to add into InfoBot so that it will dcc files
out on command... but for some reason, I can't seem to get the Net::Irc
module to cooperate with me here. I've read all the documentation for it,
but it's a little sketchy in the areas that I need, and the irctest script
that comes with it won't even work for me. I'm frustrated.
The error that I get when I try and get it to send is:
Couldn't open for reading: No such file or directory at
/usr/libdata/perl5/site_perl/Net/IRC/Connection.pm line 945
but it's passing the filename through, as far as I can tell.
Anyone have any ideas?
------------------------------
Date: Mon, 18 Oct 1999 11:57:03 +0200
From: Joern Stein <eedjoes@eed.ericsson.se>
Subject: Re: newbie - counting data lines
Message-Id: <380AEEEF.6F12F22@eed.ericsson.se>
Hi,
maybe something is wrong with my eyes or my understanding of perl, but
on first sight I see that you have an if-statement dealing with the
occurence of the end-of-dataset-marker but nothing to deal with the data
itself. I would suggest adding something like
} else {
do_something_really _useful(split ",")
}
to the if-part...
HTH
--
Cheers
Joern Stein
Noira Hadi wrote:
> However, when I run the script the output is 'zero' for each line.Need
> help to know what was wrong.
>
> SCRIPT:
>
> #!/usr/local/bin/perl -wl
>
> open(INF,"data") || die "no datafile" ;
>
> use strict;
> @buf;
>
> while (<INF>)
> {
> chomp;
>
> if (/MRR/)
> {
> my $length = @buf;
> print $length;
> }
> }
------------------------------
Date: Mon, 18 Oct 1999 12:16:27 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: newbie - counting data lines
Message-Id: <380AF37B.FC41EDD4@ife.ee.ethz.ch>
Noira Hadi wrote:
> However, when I run the script the output is 'zero' for each line.Need
> help to know what was wrong.
>
> SCRIPT:
>
> #!/usr/local/bin/perl -wl
>
> open(INF,"data") || die "no datafile" ;
Should include $! in the die message
> use strict;
Points for using strict and -w
> @buf;
Better use my @buf;
> while (<INF>)
> {
> chomp;
>
How about doing something with @buf? like
push @buf, $_;
> if (/MRR/)
> {
> my $length = @buf;
> print $length;
Have to clear @buf here:
@buf = ();
> }
> }
>
- Alex
PS For easier reading, here is the complete script
#!/usr/local/bin/perl -wl
use strict;
my @buf;
open(INF,"data") || die "no datafile" ;
while (<INF>)
{
chomp;
push @buf, $_;
if (/MRR/)
{
my $length = @buf;
print $length;
@buf = ();
}
}
------------------------------
Date: Mon, 18 Oct 1999 06:17:04 -0400
From: Chuck Williams <chuckwilliams1@netscape.net>
Subject: Re: Newbie Question
Message-Id: <380AF3A0.D1C3628@netscape.net>
Martin Elliott wrote:
> I have never used Perl before, so does anyone have any good URLs for
> tutorials/FAQ or know any good books etc.
>
> Also, how can you test Perl scripts without uploading the files?
See www.activestate.com or www.perl.com for putting Perl on your local PC. Then
you can test and learn off-line.
Many good Perl books at the bookstores. Que's Using Perl 5 for Web Programming
is one.
Last winter I broke some basics down as a learning exercise. See
http://www.servicesbywilliams.com/cgi-bin/10build.pl?/help/i-___350.html
or
http://www.servicesbywilliams.com/cgi-bin/10build.pl?/help/i-___352.html
Chuck Williams
chuckwilliams1@netscape.net
------------------------------
Date: Mon, 18 Oct 1999 10:50:42 GMT
From: Richard Lawrence <ralawrence@my-deja.com>
Subject: Oh god! Not another Net::ftp question!
Message-Id: <7ueu21$au9$1@nnrp1.deja.com>
Hello there,
Following a previous post I'm using net::ftp to validate a list of ftp
sites. I've got a bit of code (easily enough) but have several
questions I was wondering if anyone could help me with. I've looked at
the Net::FTP docs, the FAQ for it and search deja unsucessfully.
#!/usr/bin/perl
use Net::FTP;
$ftp = Net::FTP->new("mysite.com", Port => 21);
Q: How do I add other variables onto the end of this (such as the
timeout option)? All my efforts have been rewarded with compiler errors.
$ftp->login("anonymous","me\@here.there");
$ftp->list("path/to/file/i/want.txt);
$ftp->quit;
Q: This is great as long as I've actually found the site and been able
to log in! Without resorting to Debug => 1 is there anyway I can test
for the return of this connect, the "new" command and the "ls" command
to see whether the site existed, whether I could log on and whether the
file existed (I need to be able to distinguish between the three of
them and act accordingly)
Many thanks for any help
Rich
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 18 Oct 1999 12:33:12 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Oh god! Not another Net::ftp question!
Message-Id: <380b0578_1@newsread3.dircon.co.uk>
Richard Lawrence <ralawrence@my-deja.com> wrote:
> Hello there,
>
> Following a previous post I'm using net::ftp to validate a list of ftp
> sites. I've got a bit of code (easily enough) but have several
> questions I was wondering if anyone could help me with. I've looked at
> the Net::FTP docs, the FAQ for it and search deja unsucessfully.
>
> #!/usr/bin/perl
> use Net::FTP;
> $ftp = Net::FTP->new("mysite.com", Port => 21);
>
> Q: How do I add other variables onto the end of this (such as the
> timeout option)? All my efforts have been rewarded with compiler errors.
>
Key => Value pairs comma separated (all of the parameters after the
hostname go into a hash ).
/J\
--
"Teletext - the information super B-road" - Exclusive, Channel 5
------------------------------
Date: 18 Oct 1999 09:04:22 GMT
From: ebrunet@news.ens.fr (Eric Brunet)
Subject: One bug with local and one bug with perlbug
Message-Id: <slrn80lokl.nv6.ebrunet@clipper.ens.fr>
Hello all,
I don't usually read this group, but I have a bug to report and the
program perlbug failed me. I reproduce here the error message I received
in my mailbox a couple of minutes after using perlbug. It contains
everything: the original bug report I intended to make, and all the
information I have about the perlbug dysfunction.
Please CC me any replies, I don't think I am going to stay on this group.
Éric Brunet
--
From Mailer-Daemon@ens.fr Mon Oct 18 10:31:16 1999
Received: from nef.ens.fr (nef [129.199.96.12]) by clipper.ens.fr (8.9.2/jb-1.1)
id KAA21101 for <ebrunet@clipper.ens.fr>; Mon, 18 Oct 1999 10:31:15
+0200 (MET DST)
Return-Path: <Mailer-Daemon@ens.fr>
Received: from tmtowtdi.perl.org (tmtowtdi.perl.org [209.85.3.25])
by nef.ens.fr (8.9.3/beig-1.0) with SMTP id KAA06658
for <ebrunet@clipper.ens.fr>; Mon, 18 Oct 1999 10:31:08 +0200 (MET
DST)
Message-Id: <199910180831.KAA06658@nef.ens.fr>
Received: (qmail 6682 invoked for bounce); 18 Oct 1999 08:31:02 -0000
Date: 18 Oct 1999 08:31:02 -0000
From: MAILER-DAEMON@tmtowtdi.perl.org
To: ebrunet@clipper.ens.fr
Subject: failure notice
Hi. This is the qmail-send program at tmtowtdi.perl.org.
I'm afraid I wasn't able to deliver your message to the following addresses.
This is a permanent error; I've given up. Sorry it didn't work out.
<perlbugtron@perl.org>:
Sorry, no mailbox here by that name. (#5.1.1)
--- Below this line is a copy of the message.
Return-Path: <ebrunet@clipper.ens.fr>
Received: (qmail 6545 invoked from network); 18 Oct 1999 08:24:57 -0000
Received: from perl.com (HELO jhereg.perl.com) (root@199.45.135.9)
by tmtowtdi.perl.org with SMTP; 18 Oct 1999 08:24:57 -0000
Received: from nef.ens.fr (nef.ens.fr [129.199.96.12])
by jhereg.perl.com (8.9.0/8.9.0) with ESMTP id CAA14089
for <perlbug@perl.com>; Mon, 18 Oct 1999 02:24:02 -0600
Received: from clipper.ens.fr (clipper-gw.ens.fr [129.199.1.22])
by nef.ens.fr (8.9.3/beig-1.0) with ESMTP id KAA06093
for <perlbug@perl.com>; Mon, 18 Oct 1999 10:24:07 +0200 (MET DST)
From: ebrunet@clipper.ens.fr (Eric Brunet)
Date: Mon, 18 Oct 1999 10:24:05 +0200 (MET DST)
Received: from (ebrunet@localhost) by clipper.ens.fr (8.9.2/jb-1.1)
Message-Id: <199910180824.KAA20360@clipper.ens.fr>
To: perlbug@perl.com
Subject: Declaring `` local $x '' affects pos($x) out of scope.
Reply-To: eric.brunet@ens.fr
This is a bug report for perl from eric.brunet@ens.fr,
generated with the help of perlbug 1.26 running under perl 5.00503.
-----------------------------------------------------------------
[Please enter your report here]
The following program reproduces the bug:
#!/usr/bin/perl -w
$x = "123 56";
$x =~ / /g;
print $x, ", ",pos($x),"\n";
# This does print
# 123 56, 4
{ local $x }
# This should be a no-op.
print $x, ", ",pos($x),"\n";
# This should print the same thing as above.
# However, it actually prints:
# Use of uninitialized value at ./bug line 13.
# 123 56,
__END__
I believe that local $x should have no influence on $x outside of the
scope of the local. However, the hidden variable pos($x) is affected. I
think local $x should also declare local the ``variable'' pos($x).
This bug also appears on my i386 redhat system (this system is a mix of
redhat 5.2 and 6.0. I think the perl rpm is from 6.0 but I am not sure. I
can have a look if it is important.)
Thank you to send me some feedback on this report.
Éric Brunet
It looks like
[Please do not change anything below this line]
-----------------------------------------------------------------
---
Site configuration information for perl 5.00503:
Configured by vanderre at Mon Apr 12 23:15:48 MET DST 1999.
Summary of my perl5 (5.0 patchlevel 5 subversion 3) configuration:
Platform:
osname=solaris, osvers=2.5, archname=sun4-solaris-thread
uname='sunos corvette 5.5 generic_103093-14 sun4m sparc sunw,sparcstation-5
'
hint=recommended, useposix=true, d_sigaction=define
usethreads=define useperlio=undef d_sfio=undef
Compiler:
cc='gcc', optimize='-O', gccversion=2.8.1
cppflags='-D_REENTRANT -I/usr/local/util/include -DDEBUGGING'
ccflags ='-D_REENTRANT -I/usr/local/util/include -DDEBUGGING'
stdchar='unsigned char', d_stdstdio=define, usevfork=false
intsize=4, longsize=4, ptrsize=4, doublesize=8
d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=16
alignbytes=8, usemymalloc=y, prototype=define
Linker and Libraries:
ld='gcc', ldflags ='-L/usr/local/util/lib -R/usr/local/util/lib'
libpth=/lib /usr/lib /usr/ccs/lib /usr/local/util/lib
libs=-lsocket -lnsl -lgdbm -ldb -ldl -lm -lposix4 -lpthread -lc -lcrypt
libc=/lib/libc.so, so=so, useshrplib=false, libperl=libperl.a
Dynamic Linking:
dlsrc=dl_dlopen.xs, dlext=so, d_dlsymun=undef, ccdlflags=' '
cccdlflags='-fPIC', lddlflags='-G -L/usr/local/util/lib'
Locally applied patches:
---
@INC for perl 5.00503:
/usr/local/util/packages/perl5.005_03/lib/5.00503/sun4-solaris-thread
/usr/local/util/packages/perl5.005_03/lib/5.00503
/usr/local/util/packages/perl5.005_03/lib/site_perl/5.005/sun4-solaris-thread
/usr/local/util/packages/perl5.005_03/lib/site_perl/5.005
.
---
Environment for perl 5.00503:
HOME=/users/93/maths/ebrunet
LANG (unset)
LANGUAGE (unset)
LC_CTYPE=iso_8859_1
LD_LIBRARY_PATH (unset)
LOGDIR (unset)
PATH=/users/93/maths/ebrunet/bin/solaris:/users/93/maths/ebrunet/bin:/usr/local/
util/bin:/usr/local/bin:/usr/local/lang/bin:/usr/ucb:/usr/bin/X11:/usr/openwin/b
in:/bin:/usr/ccs/bin:/usr/sbin:/usr/local/games/bin:/usr/local/pbmplus/bin:/usr/
hosts
PERL_BADLANG (unset)
SHELL=/usr/local/util/bin/zsh
------------------------------
Date: Mon, 18 Oct 1999 10:09:58 +0100
From: Csaba Raduly <csaba.raduly@sophos.com>
Subject: Re: PDFlib size settings
Message-Id: <380AE3E6.2ABDC8A3@sophos.com>
Henry Penninkilampi wrote:
>
> In article <37FDFA26.51DFD78D@inx.de>, Daniel Krajzewicz
> <krajzewicz@inx.de> wrote:
>
[snip]
>
> > Do someone know how to encode the german DIN A4-norm ?
>
> I don't know what DIN stands for, but the dimensions for A4 are 595x842
> points, if that helps.
>
DIN = Deutsche Industrie-Normen
(German industrial standards, kind of ISO...)
Csaba
--
-----BEGIN GEEK CODE BLOCK-----
Version 3.1
GCS/>GMU d- s:- a30 C++$ UL+ P+>+++ L++ E- W+ N++ o? K? w++>$ O++$ M-
V- PS PE Y PGP- t+ 5 X++ R* tv++ b++ DI+++ D++ G- e+++ h-- r-- !y+
-----END GEEK CODE BLOCK-----
Csaba Raduly, Software Developer (OS/2), Sophos Anti-Virus
mailto:csaba.raduly@sophos.com http://www.sophos.com/
US Support +1 888 SOPHOS 9 UK Support +44 1235 559933
Life is complex, with real and imaginary parts.
------------------------------
Date: Mon, 18 Oct 1999 11:52:53 GMT
From: Mentifex <mentifex@my-deja.com>
Subject: Porting Mind.Forth to Perl
Message-Id: <7uf1mh$d3c$1@nnrp1.deja.com>
Perl Web links and a plan for re-creating Mind.Forth in Perl are at
http://www.geocities.com/Athens/Agora/7256/perl.html on the Web.
--
Forth is the lingua franca of AI, embedded NC and robotics.
For details on Mind.Forth and the public domain AI project,
see the ACM Sigplan Notices 33(12):25-31 (December 1998),
"Mind.Forth: Thoughts on Artificial Intelligence and Forth."
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Mon, 18 Oct 1999 13:12:00 +0200
From: Andreas Vierengel <andreas@vierengel.de>
Subject: regexp-problem
Message-Id: <DB8F8EED213EE361.73300A43F5599A47.13B7737303BFADB0@lp.airnews.net>
consider the string:
$string = '123a45678aa8990a98';
I want to fetch the contents between two 'a'.
that means I should get:
a45678
a8990
also I need the rest of the string which is unmatched:
123
a
a98
I searched days for a solution, but didn't manage to get a solution.
Maybe someone can help me ?
--Andi
------------------------------
Date: Mon, 18 Oct 1999 07:38:56 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: Re: regexp-problem
Message-Id: <Pine.GSO.4.10.9910180736220.14462-100000@crusoe.crusoe.net>
[posted & mailed]
On Oct 18, Andreas Vierengel blah blah blah:
> $string = '123a45678aa8990a98';
>
> a45678
> a8990
>
> 123
> a
> a98
You want a positive lookahead assertion. Explained in the perlre docs.
#!/usr/bin/perl
$str = "123a45678aa8990a98";
@parts = split(/(?=a)/, $str);
print "@parts\n";
Output:
123 a45678 a a8990 a98
--
MIDN 4/C PINYAN, USNR, NROTCURPI
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN
------------------------------
Date: Mon, 18 Oct 1999 13:43:23 +0200
From: Joern Stein <eedjoes@eed.ericsson.se>
Subject: Re: regexp-problem
Message-Id: <380B07DB.2E1FA8B@eed.ericsson.se>
Hi Andreas,
Does this help you?
$string = '123a45678aa8990a98';
while ($string=~/a(\d*?)a/g) {
$first = $` if !$first;
print $1,"\n";
$last=$';
}
print $first, " ", $last."\n";
FYI, $` contains the string in front of the matching string and $' the
string after the match.
HTH
Andreas Vierengel wrote:
>
> consider the string:
>
> $string = '123a45678aa8990a98';
>
> I want to fetch the contents between two 'a'.
>
> that means I should get:
>
> a45678
> a8990
>
> also I need the rest of the string which is unmatched:
> 123
> a
> a98
>
> I searched days for a solution, but didn't manage to get a solution.
>
> Maybe someone can help me ?
>
> --Andi
--
Cheers
Joern Stein
------------------------------
Date: Mon, 18 Oct 1999 17:55:31 +0800
From: danny ho <dannyho@mail.com>
Subject: send mail in perl
Message-Id: <380AEE92.BFC167F9@mail.com>
i would like to ask if i use perl script to send email, to be called
from a www html. i reference the mail programme path in perl
as /usr/bin/perl in unix.
will the mail-sending job be background process or real time? the
main concern of mine is that is i have a lot of send mail request
from different browser at the same time, will it a pose a larger
workload to the server?
thanks.
danny
------------------------------
Date: 18 Oct 1999 12:31:37 +0100
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: send mail in perl
Message-Id: <380b0519_1@newsread3.dircon.co.uk>
danny ho <dannyho@mail.com> wrote:
> i would like to ask if i use perl script to send email, to be called
> from a www html. i reference the mail programme path in perl
> as /usr/bin/perl in unix.
>
No you dont that's perl.
You might want to see the section on sending mail in perlfaq9.
/J\
--
"Philippa Forrester, presenter and would-be Smurf" - Howard Stableford,
Tomorrow's World
------------------------------
Date: Mon, 18 Oct 1999 10:50:42 +0100
From: David Cantrell <NukeEmUp@ThePentagon.com>
Subject: Re: tmtowtdt? Getting the date
Message-Id: <u+wKOE4X2rLj04BxZydrGk6IJsxY@4ax.com>
On Mon, 11 Oct 1999 21:07:27 GMT, schablone@my-deja.com said:
>my $Today = ((localtime)[5]+1900)."." .((localtime)[4]+1) ."."
>.(localtime)[3];
>
>print $Today."\n";
>
>Are there other ways of doing this? Preferably shorter and/or more
>cryptic)?
Is cryptic a Good Thing?
($day,$mth,$yr)=((localtime)[3..5]);
$today=join('.',$yr+1900,$mth+1,$day);
print $today."\n";
[Copying newsgroup posts to me by mail is considered rude]
--
David Cantrell, part-time Unix/perl/SQL/java techie
full-time chef/musician/homebrewer
http://www.ThePentagon.com/NukeEmUp
------------------------------
Date: Mon, 18 Oct 1999 11:39:01 GMT
From: mad@cyberscience.com (Matt Dale)
Subject: Re: using Tie::IxHash with nested hash tables
Message-Id: <7uf10o$fhj$1@linux.cybertek>
You might want to look at the MLDBM module which is designed for
tieing multiple level hashes. It is not perfect as it still has to
use the Tiehash interface which doesn't support multiple level hashes.
Matt
------------------------------
Date: Mon, 18 Oct 1999 12:36:08 +0200
From: Alex Rhomberg <rhomberg@ife.ee.ethz.ch>
Subject: Re: Why does this match take so long?
Message-Id: <380AF818.38586947@ife.ee.ethz.ch>
Andrew J Perrin wrote:
> Benchmark: timing 5 iterations of Match...
> Match: 318 wallclock secs (318.26 usr + 0.00 sys = 318.26 CPU)
>
> That's a long time to do the match, isn't it? This is running on a P166
> running NT and perl 5.005_03.
It is quite a long time. I had to increase the count a bit to get timing
results :-)
my PSI::ESP module tells me you want to find the word "children"
separated no more than 10 words from "violence". The second regexp
should do this. Yours does about the same as my third
timethese (50000,
{'Match' => 'if ($foo =~ /children(?:\b.*\b){1,10}violence/)
{ $hit1++;}',
'Match2' => 'if ($foo =~ /children\W+(?:\w+\W+){0,10}violence/)
{$hit2++;}',
'Match3' => 'if ($foo =~ /children\b.*\bviolence/)
{$hit3++;}'
}
);
Benchmark: timing 50000 iterations of Match, Match2, Match3...
Match: 6 wallclock secs ( 7.44 usr + 0.00 sys = 7.44 CPU)
Match2: 2 wallclock secs ( 1.87 usr + 0.00 sys = 1.87 CPU)
Match3: 1 wallclock secs ( 0.71 usr + 0.00 sys = 0.71 CPU)
Seems to be a tiny factor of 500_000 faster than your machine :-)
This is a 500 MHz Alpha running Linux and $] == 5.00503
- Alex
------------------------------
Date: Mon, 18 Oct 1999 07:35:41 -0400
From: Jeff Pinyan <jeffp@crusoe.net>
Subject: re: { local $x } pos($x) bug
Message-Id: <Pine.GSO.4.10.9910180721320.14462-100000@crusoe.crusoe.net>
Well, after a couple experiments, I noticed the bug reported:
#!/usr/bin/perl -w
$x = "a"; $x =~ /a/;
{ local $x }
print pos($x);
does not occur when you use my() instead of local(). I did a couple tests
to see what else occurs:
use Benchmark qw( timethis );
$x = join "", 1..500;
timethis(100, q{ for (1..500){ $x =~ /$_/ } });
study $x;
timethis(100, q{ for (1..500){ $x =~ /$_/ } });
timethis(100, q{ for (1..500){ $x =~ /$_/ } });
timethis(100, q{ for (1..500){ $x =~ /$_/ } });
{ local $x } timethis(100, q{ for (1..500){ $x =~ /$_/ } });
study($x); timethis(100, q{ for (1..500){ $x =~ /$_/ } });
{ my $x } timethis(100, q{ for (1..500){ $x =~ /$_/ } });
Output:
timethis 100: 12 wallclock secs (11.65 usr + 0.00 sys = 11.65 CPU)
timethis 100: 11 wallclock secs (11.46 usr + 0.00 sys = 11.46 CPU)
timethis 100: 12 wallclock secs (11.43 usr + 0.00 sys = 11.43 CPU)
timethis 100: 11 wallclock secs (11.42 usr + 0.00 sys = 11.42 CPU)
timethis 100: 12 wallclock secs (11.64 usr + 0.00 sys = 11.64 CPU)
timethis 100: 12 wallclock secs (11.46 usr + 0.00 sys = 11.46 CPU)
timethis 100: 11 wallclock secs (11.46 usr + 0.00 sys = 11.46 CPU)
To me, there seems to be an appreciable difference between the 4rd and 5th
timethis() routines. It appears (to me, and this is rather superficial)
that local() does not only mangle with pos(), it might also reset the
effect of study(). I came to this conclusion because timethis #1 is
before $x is studied, and the time it takes is .01 seconds more than after
we have the { local $x } block.
This is a strange and puzzling problem. Perhaps those more comfortable
with the internals of Perl might shed some light on the subject?
--
MIDN 4/C PINYAN, USNR, NROTCURPI
jeff pinyan japhy@pobox.com
perl stuff japhy+perl@pobox.com
CPAN ID: PINYAN http://www.perl.com/CPAN/authors/id/P/PI/PINYAN
------------------------------
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 1106
**************************************