[22586] in Perl-Users-Digest
Perl-Users Digest, Issue: 4807 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Apr 2 21:06:19 2003
Date: Wed, 2 Apr 2003 18:05:07 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Wed, 2 Apr 2003 Volume: 10 Number: 4807
Today's topics:
Re: -M switch cannot be used the #! line <goldbb2@earthlink.net>
.htaccess / $ENV{remote_user} -- How to get the passwor <GPatnude@adelphia.net>
Re: .htaccess / $ENV{remote_user} -- How to get the pas <mbudash@sonic.net>
alternation & grouping in regexp <mike@luusac.co.uk>
Re: alternation & grouping in regexp <goldbb2@earthlink.net>
Re: alternation & grouping in regexp <laocoon@fastmail.fm>
Re: alternation & grouping in regexp <mike@luusac.co.uk>
Anyone else have cperl-mode problems? (Sara)
Re: Anyone else have cperl-mode problems? <rgarciasuarez@free.fr>
Can Perl mimic the awk '/start/,/end/' syntax (Demetrius)
Re: creating virtual directories with urls (Alberto Ortiz)
Re: Dialup using Perl <kalinabears@hdc.com.au>
Re: gdtextutils ppm for activestate 5.8 <kalinabears@hdc.com.au>
Re: gdtextutils ppm for activestate 5.8 <mike_solomon@lineone.net>
Re: Help me with a Perl Script (Helen)
Re: How to use newlines in DOS command options <goldbb2@earthlink.net>
Re: How to use newlines in DOS command options (Malcolm Dew-Jones)
Re: How to use newlines in DOS command options <goldbb2@earthlink.net>
Re: Memory leak in Perl Interpreter <goldbb2@earthlink.net>
Re: Memory leak in Perl Interpreter <rgarciasuarez@free.fr>
need help with perl -pi -e (Rene)
Re: need help with perl -pi -e <bwalton@rochester.rr.com>
Re: need help with perl -pi -e <grazz@nyc.rr.com>
needs tips installing ImageMagick/PerlMagick on MacOSX <mbudash@sonic.net>
Newbie question about copying directories tribeguy_15@hotmail.com
Re: Newbie question about copying directories <GPatnude@adelphia.net>
Re: Odd UTF-8 error with Switch.pm <rgarciasuarez@free.fr>
Re: Odd UTF-8 error with Switch.pm <goldbb2@earthlink.net>
Re: Test / Performance benchmarking position available <dha@panix.com>
Text::ParseWords <Use-Author-Supplied-Address-Header@[127.1]>
Re: Text::ParseWords <bwalton@rochester.rr.com>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 02 Apr 2003 15:13:51 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: -M switch cannot be used the #! line
Message-Id: <3E8B447F.C25961BA@earthlink.net>
Tony Skelding wrote:
>
> Helgi Briem wrote:
>> Tony Skelding wrote:
>>
>>> I want to use the -M switch on the #! line of a script. The Camel
>>> says this cannot be done and there should be no need to do it - you
>>> can always put a use in the file instead. For my purpose, putting a
>>> use in the script is not an option - I can explain why if anyone is
>>> interested.
>>
>> I would be. Pretty bizarre limitation if you ask me.
>
> The reason I'd like to use -MMyModule on the #! line...
>
> I am working on a big system containing lots of legacy scripts (Korn,
> Bourne, Perl - you name it). Some of theses scripts are run via cron,
> some via rsh, some from applications, some directly from the command
> line and some from other scripts. A lot of scripts are probably
> obsolete. There are certainly a fair few that nobody seems to know
> about.
>
> I want to add some auditing code to all these scripts and and one easy
> way is to auto generate a line of code at the top of each script
> like...
>
> #!/usr/bin/perl -MAudit='#!xxxxx'
>
> where #!xxx is the original shebang line.
>
> This effectively turns them all into Perl scripts.
>
> The original idea was that the Audit::import() method would receive
> the '#!xxxx' as an argument. Once it has done it's necessary auditing
> it would then interpret the original shebang line and pass the script
> onto the appropriate interpreter (complete with any original switches)
> using exec.
>
> The trouble is it doesn't work. I get the 'Too late for "-MAudit"
> option' error. If I don't try to pass the original shebang line it
> works but then I cannot do quite what I want. Obviously, if I try to
> autogenerate a 'use Audit' as the second line of each script the
> target interpreter will then blow up.
So what's wrong with inserting *two* lines?
#!/usr/bin/perl
use Audit q(#!xxxxx);
Or perhaps:
#!/usr/bin/perl -S Audit.pl
#!xxxxx
This will start up perl, run it with Audit.pl, and the contents of @ARGV
would contain the filename of the script. Open the script, read and
discard the first line (the #!...perl line) and read the next line to
get the #!xxxxx.
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: Wed, 02 Apr 2003 23:05:01 GMT
From: "codeWarrior" <GPatnude@adelphia.net>
Subject: .htaccess / $ENV{remote_user} -- How to get the password submitted at authentication....
Message-Id: <x0Kia.26935$TW2.4873582@news1.news.adelphia.net>
Anyone know how to grab the password that a user authenticated with via
CGI.pm ???
I can find $ENV{REMOTE_USER} which gives up the users "login name" but cant
locate the password the user used to authenticate...
$login = $Q->remote_user();
I need to get the specific password submitted to do some secondary
authentication on subdirectories within the htaccess protected directory...
------------------------------
Date: Wed, 02 Apr 2003 23:51:52 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: Re: .htaccess / $ENV{remote_user} -- How to get the password submitted at authentication....
Message-Id: <mbudash-23A636.15515102042003@typhoon.sonic.net>
In article <x0Kia.26935$TW2.4873582@news1.news.adelphia.net>,
"codeWarrior" <GPatnude@adelphia.net> wrote:
> Anyone know how to grab the password that a user authenticated with via
> CGI.pm ???
>
> I can find $ENV{REMOTE_USER} which gives up the users "login name" but cant
> locate the password the user used to authenticate...
>
> $login = $Q->remote_user();
>
> I need to get the specific password submitted to do some secondary
> authentication on subdirectories within the htaccess protected directory...
>
>
you can't (for obvious reasons)... why not do the "secondary
authentication on subdirectories within the htaccess protected
directory" based on the $ENV{REMOTE_USER}?
--
Michael Budash
------------------------------
Date: Wed, 2 Apr 2003 21:58:09 +0100
From: "Mike" <mike@luusac.co.uk>
Subject: alternation & grouping in regexp
Message-Id: <C9Iia.1582$0i4.10669@newsfep4-glfd.server.ntli.net>
Hi,
I am having a problem with a regexp:
/^<ident> Identity:\n(^[A-Z\d].*)\n(^[A-Z\d].*)\n\n</end>/
What I am trying to do is put alternation between group 1 & 2, so that the
following will both match:
<ident> Identity:\nBlah blah\nblah\n\n</end> and
<ident> Identity:\nBlah blah blah\n\n</end>
note that string one has a line break between the 2nd & 3rd blahs but that
string two does not.
I know that | is used for alternation, but cannot seem to get it to work.
Any thoughts ?
thanks
Mike
------------------------------
Date: Wed, 02 Apr 2003 16:56:46 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: alternation & grouping in regexp
Message-Id: <3E8B5C9E.2B866432@earthlink.net>
Mike wrote:
>
> Hi,
>
> I am having a problem with a regexp:
>
> /^<ident> Identity:\n(^[A-Z\d].*)\n(^[A-Z\d].*)\n\n</end>/
Without a /m flag, the ^ mark will only match at the beginning of the
string -- thus, your regex will never match.
> What I am trying to do is put alternation between group 1 & 2, so that
> the following will both match:
>
> <ident> Identity:\nBlah blah\nblah\n\n</end> and
> <ident> Identity:\nBlah blah blah\n\n</end>
>
> note that string one has a line break between the 2nd & 3rd blahs but
> that string two does not.
What happens with:
/^<ident> Identity:\n([A-Z\d].*?)\n\n</end>/s
?
> I know that | is used for alternation, but cannot seem to get it to
> work.
What have you tried?
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: Wed, 2 Apr 2003 23:41:49 +0200
From: Lao Coon <laocoon@fastmail.fm>
Subject: Re: alternation & grouping in regexp
Message-Id: <Xns9351F12DECCBlaocoon@62.153.159.134>
"Mike" <mike@luusac.co.uk> wrote in
news:C9Iia.1582$0i4.10669@newsfep4-glfd.server.ntli.net:
> What I am trying to do is put alternation between group 1 & 2, so that
> the following will both match:
>
> <ident> Identity:\nBlah blah\nblah\n\n</end> and
> <ident> Identity:\nBlah blah blah\n\n</end>
>
> note that string one has a line break between the 2nd & 3rd blahs but
> that string two does not.
>
> I know that | is used for alternation, but cannot seem to get it to
> work. Any thoughts ?
yes, read perldoc perlre
what you want is the quantifier ?
/^<ident> Identity:\n[\w\s]*\n?[\w\s]*\n\n<\/end>/
> thanks
> Mike
------------------------------
Date: Thu, 3 Apr 2003 02:33:36 +0100
From: "Mike" <mike@luusac.co.uk>
Subject: Re: alternation & grouping in regexp
Message-Id: <RbMia.1744$0i4.11497@newsfep4-glfd.server.ntli.net>
Hi,
here is what I have tried:
#!/usr/local/bin/perl
$_ = "<ident> Identity:\nblah\nblah\n\n</end>";
if ( /^<ident> Identity:\n([A-Z\d].*?)\n\n<\/end>/smi ) {
print "got <$1>";
print "got <$2>";
}
which finds a match in:
blah\nblah and in blah blah, but in the former it retains the \n (which I
don't want), so for the former I get:
got <blah
blah>
and for the latter
got <blah blah>
With
/^<desc> Description:\n([\w\s]*)\n?([\w\s]*)\n\n<\/top>/smi
I get
got <blah
blah>
and
got <blah blah>
So how can I ensure that the \n between blah\nblah is not included in the
match ?
thanks for your help (both of you !)
Mike
"Mike" <mike@luusac.co.uk> wrote in message
news:C9Iia.1582$0i4.10669@newsfep4-glfd.server.ntli.net...
> Hi,
>
> I am having a problem with a regexp:
>
> /^<ident> Identity:\n(^[A-Z\d].*)\n(^[A-Z\d].*)\n\n</end>/
>
> What I am trying to do is put alternation between group 1 & 2, so that the
> following will both match:
>
> <ident> Identity:\nBlah blah\nblah\n\n</end> and
> <ident> Identity:\nBlah blah blah\n\n</end>
>
> note that string one has a line break between the 2nd & 3rd blahs but that
> string two does not.
>
> I know that | is used for alternation, but cannot seem to get it to work.
> Any thoughts ?
> thanks
> Mike
>
>
>
------------------------------
Date: 2 Apr 2003 12:15:55 -0800
From: genericax@hotmail.com (Sara)
Subject: Anyone else have cperl-mode problems?
Message-Id: <776e0325.0304021215.18383cf7@posting.google.com>
I have syntax highlighting on, and the entire file is highlighted, but
any text I add goes in ALL BLACK. If I want the added text to be
highlighted, I have to use
C-x cperl-mode
and botta-bing everything is highlighted again. In an average session
I type this 30-50 times or more.
On OTHER systems it works fine- pretty much highights as I type.
I understand this may be an emacs question rather than perl, but in
this case I'd like an actual answer. They're hard to come by in the
emnacs/unix groups.
This is gun-emacs 20.7.1 (sun-sparc-solaris2.8, x toolkit) running on
Solaris, perl 5.6.1
Thanks..
Gx
------------------------------
Date: 02 Apr 2003 20:22:23 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: Anyone else have cperl-mode problems?
Message-Id: <slrnb8mhpm.k84.rgarciasuarez@dat.local>
Sara wrote in comp.lang.perl.misc :
...
> I understand this may be an emacs question rather than perl, but in
> this case I'd like an actual answer. They're hard to come by in the
> emnacs/unix groups.
Yeah, I've got cperl-mode problems too. Usually, using vi solves them.
Is my answer on-topic enough ?
> This is gun-emacs 20.7.1 (sun-sparc-solaris2.8, x toolkit) running on
> Solaris, perl 5.6.1
Gee, come on, gun-emacs ? That's what I'd call *editor wars*...
--
I nominate this for serendipitous typo of the month.
-- MJD in c.l.p.misc
------------------------------
Date: 2 Apr 2003 17:59:03 -0800
From: dcomes@wolfshade.com (Demetrius)
Subject: Can Perl mimic the awk '/start/,/end/' syntax
Message-Id: <4fabd8b9.0304021759.37f5b2d7@posting.google.com>
What is the Perl way to do:
cat myfile.txt | awk '/start/,/end/'
if myfile.txt contained
someline
start
hello
this is the lines between the tags
end
another line
you would get
start
hello
this is the lines between the tags
end
Can this be done in perl without using a loop and checking each line
for the first and last line you are looking for?
Thanks
Demetrius
------------------------------
Date: 2 Apr 2003 15:04:40 -0800
From: albeog@yahoo.com (Alberto Ortiz)
Subject: Re: creating virtual directories with urls
Message-Id: <f3a49f19.0304021504.78b51682@posting.google.com>
jmh17@pitt.edu (john harrold) wrote in message news:<31d0e2b6.0304020527.2de06393@posting.google.com>...
> Eric Schwartz <eric.schwartz@hp.com> wrote in message news:<etoel4l6eny.fsf@wormtongue.emschwar>...
>
> >
> > So you know the problem is with Apache configuration, and yet you ask
> > on a Perl language newsgroup? Um, okay. That makes no sense to me,
> > but presumably you think we're better suited than the people over on
> > c.i.w.s.*. Me, I'd have asked comp.lang.forth, since I know somebody
> > who writes CGI in Forth.
> >
> > -=Eric
>
> actually i though that someone here would have encountered this in the
> past. as a result i thought this audience would be good to ask. the
> apache configuration was my first thought, though i'm open to other
> suggestions. i'm truely sorry for wasting your time.
John,
you might want to check mod_rewrite at:
http://httpd.apache.org/docs/mod/mod_rewrite.html
or you could create a perl script called "file" so you can access
like:
http://a.org/stuff/file/abcd-34/bob.jpg
notice the added directory level "stuff" so you don't have to specify
CGI execution in the docroot.
"file" in turn can access the environment variable PATH_INFO to get
"abcd-34/bob.jpg", then you could just dump the contents of the file
but with a "content-type: image/jpg\n\n" header.
------------------------------
Date: Thu, 3 Apr 2003 04:58:36 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: Dialup using Perl
Message-Id: <3e8b33bd$0$17492@echo-01.iinet.net.au>
"Graham Drabble" <graham.drabble@lineone.net> wrote in message
news:Xns9351AAB83C98Bgrahamdrabblelineone@ID-77355.user.dfncis.de...
> I've got some scripts that require access to the internet to work.
> Whilst these work well when I'm at uni with a always on connection they
> fail when I'm at home and need to dial up before I have a net
> connection. What I need is a way to get perl to check whether a
> connection exists and, if it doesn't, dial up and supply the username
> and password for the ISP. I've had a look in the FAQs but can't find
> anything. If it helps I'm using Win 2000.
>
> --
I've used Win32::RASE for this on win2k. I don't recall where I got it .....
the documentation claims it can be obtained from
http://www.dux.ru/guest/fno/perl/ .
Cheers,
Rob
------------------------------
Date: Thu, 3 Apr 2003 05:04:33 +1000
From: "Sisyphus" <kalinabears@hdc.com.au>
Subject: Re: gdtextutils ppm for activestate 5.8
Message-Id: <3e8b3522$0$17494@echo-01.iinet.net.au>
"Mike Solomon" <mike_solomon@lineone.net> wrote in message
news:56568be5.0304020034.3f83b984@posting.google.com...
>
> does anyone know where I can get a ppm for gdtextutils ?
>
For perl 5.8:
http://theoryx5.uwinnipeg.ca/ppms/GDTextUtil.ppd
Cheers,
Rob
------------------------------
Date: Wed, 2 Apr 2003 22:14:02 +0100
From: "Mike Solomon" <mike_solomon@lineone.net>
Subject: Re: gdtextutils ppm for activestate 5.8
Message-Id: <3e8b527d$1_1@mk-nntp-2.news.uk.tiscali.com>
"Sisyphus" <kalinabears@hdc.com.au> wrote in message
news:3e8b3522$0$17494@echo-01.iinet.net.au...
>
> "Mike Solomon" <mike_solomon@lineone.net> wrote in message
> news:56568be5.0304020034.3f83b984@posting.google.com...
>
> >
> > does anyone know where I can get a ppm for gdtextutils ?
> >
>
> For perl 5.8:
> http://theoryx5.uwinnipeg.ca/ppms/GDTextUtil.ppd
>
> Cheers,
> Rob
>
>
thanks
while looking for a ppm for gdtextutils i came across a superb charting
package for use with Perl
http://www.advsofteng.com/
it is well worth a look
regards
mike solomon
------------------------------
Date: 2 Apr 2003 17:36:16 -0800
From: helen@helephant.com (Helen)
Subject: Re: Help me with a Perl Script
Message-Id: <33517f44.0304021736.1a8e92e@posting.google.com>
> >and I think seeing an example would be much more helpful
> >than trying to learn how to use perldoc.
>
> That's pretty stupid as the very first thing in the perldoc
> in question is an example.
>
> Perldoc is easy and good. Nothing is more helpful
> to a beginning Perl programmer than to learn perldoc
> and how to use it.
Learning how to read programming references is useful no matter which
language you're writing in. If you don't know how to read the
programming reference it's really difficult to do things that aren't
documented in a tutorial.
It'd be like only being able to build legos if you have one of those
instruction sheets.
You're just got to be willing to spend a bit of time in trial and
error.
Helen
------------------------------
Date: Wed, 02 Apr 2003 15:02:34 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: How to use newlines in DOS command options
Message-Id: <3E8B41DA.EA45DD0A@earthlink.net>
Gian-Reto Alig wrote:
>
> Hi
>
> I'm using Perl to write automated build and release scripts for CM
> Synergy (Continuus)...
>
> Recently I tried to update the releases attribute with a system
> command...
>
> as far as I know I have to overwrite the whole attribute, and because
> of this I have to be able to supply multi-line values for some
> attributes, even to change one line...
>
> Everything worked fine on my unix server, I used Backquotes and put
> the value into doublequotes ... but when I tried to do the same thing
> on Windows, this failed... Perl seems to replace newlines and tabs
> with spaces...
>
> I tried to do it manually on the console, it didn't worked either...
>
> Is there any way to use newlines in a commandline option in DOS?
I'm afraid not. It's not perl which is changing your newlines, it's the
operating system itself. You simply cannot get newlines into arguments
on windows. (Maybe NT or Win2000, I don't know, but definitely not on
Win95).
> Is it possible using the Win32::Process module?
I don't think so.
#######
What I suspect you will need to do, is get your tool to read attributes
from stdin, or from a file, instead of from the commandline.
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: 2 Apr 2003 13:29:11 -0800
From: yf110@vtn1.victoria.tc.ca (Malcolm Dew-Jones)
Subject: Re: How to use newlines in DOS command options
Message-Id: <3e8b5627@news.victoria.tc.ca>
Benjamin Goldberg (goldbb2@earthlink.net) wrote:
: Gian-Reto Alig wrote:
: >
: > Hi
: >
: > I'm using Perl to write automated build and release scripts for CM
: > Synergy (Continuus)...
: >
: > Recently I tried to update the releases attribute with a system
: > command...
: >
: > as far as I know I have to overwrite the whole attribute, and because
: > of this I have to be able to supply multi-line values for some
: > attributes, even to change one line...
: >
: > Everything worked fine on my unix server, I used Backquotes and put
: > the value into doublequotes ... but when I tried to do the same thing
: > on Windows, this failed... Perl seems to replace newlines and tabs
: > with spaces...
: >
: > I tried to do it manually on the console, it didn't worked either...
: >
: > Is there any way to use newlines in a commandline option in DOS?
: I'm afraid not. It's not perl which is changing your newlines, it's the
: operating system itself. You simply cannot get newlines into arguments
: on windows. (Maybe NT or Win2000, I don't know, but definitely not on
: Win95).
: > Is it possible using the Win32::Process module?
: I don't think so.
: #######
: What I suspect you will need to do, is get your tool to read attributes
: from stdin, or from a file, instead of from the commandline.
You might be able to use another shell. Cygwin comes with a small shell
called sh, and you can run it as an independent program as long as the
right .dll is also in the path (i.e. you do not need to "install" cygwin
to use it).
------------------------------
Date: Wed, 02 Apr 2003 16:53:23 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: How to use newlines in DOS command options
Message-Id: <3E8B5BD3.4BBF4251@earthlink.net>
Malcolm Dew-Jones wrote:
>
> Benjamin Goldberg (goldbb2@earthlink.net) wrote:
>> Gian-Reto Alig wrote:
[getting newlines in command-line arguments on windows]
>> What I suspect you will need to do, is get your tool to read attributes
>> from stdin, or from a file, instead of from the commandline.
>
> You might be able to use another shell. Cygwin comes with a small shell
> called sh, and you can run it as an independent program as long as the
> right .dll is also in the path (i.e. you do not need to "install" cygwin
> to use it).
But, but, but... using Cygwin is cheating! :)
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: Wed, 02 Apr 2003 15:34:27 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Memory leak in Perl Interpreter
Message-Id: <3E8B4953.535AB386@earthlink.net>
dylan wrote:
>
> Hi,
> I did working on some program that integrate perl application into C++
> application. I'm using perl version 5.004_04 in sunOS 2.5.
> When i'm runnig through purify tool, i found the following memory leak
> is happening in libperl.a library, so i suspect there is a memory leak
> in perl interpreter itself. Is anyone aware of situation where perl
> interpreter will allocate memory as shown below. Thanks for the help
> and advice.
[snip]
That's a fairly old perl. The leaks that existed in it have long since
been fixed in newer perls. Since aren't likely to get a version of
5.004 that has had those leaks you found, I would suggest you simply
upgrade; either to 5.6.1, or 5.8.0.
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: 02 Apr 2003 20:26:54 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: Memory leak in Perl Interpreter
Message-Id: <slrnb8mi26.leh.rgarciasuarez@dat.local>
Benjamin Goldberg wrote in comp.lang.perl.misc :
> dylan wrote:
>>
>> Hi,
>> I did working on some program that integrate perl application into C++
>> application. I'm using perl version 5.004_04 in sunOS 2.5.
>> When i'm runnig through purify tool, i found the following memory leak
>> is happening in libperl.a library, so i suspect there is a memory leak
>> in perl interpreter itself. Is anyone aware of situation where perl
>> interpreter will allocate memory as shown below. Thanks for the help
>> and advice.
> [snip]
>
> That's a fairly old perl.
6 years old. That's also a fairly old SunOS. (I don't know whether perl
5.8.0 has been tested on it.)
> The leaks that existed in it have long since
> been fixed in newer perls. Since aren't likely to get a version of
> 5.004 that has had those leaks you found, I would suggest you simply
> upgrade; either to 5.6.1, or 5.8.0.
Or 5.005_03, the oldest supported version.
--
Is it any wonder the world's gone insane, with information come to be
the only real medium of exchange ? -- Thomas Pynchon, Gravity's Rainbow
------------------------------
Date: 2 Apr 2003 16:22:51 -0800
From: rene@protechgroup.com (Rene)
Subject: need help with perl -pi -e
Message-Id: <4f29bc85.0304021622.33d886dc@posting.google.com>
i tried this, no go, please advise.
[root@localhost contents]# perl -pi -e
's#https://yadadada.com/cgi-bin/simple/cart.pl?site=yadada.com&action=main#http://www.hooray.com/scripts/view.pl?page=cart#/'g
*.content
Illegal division by zero at -e line 1, <> line 1.
------------------------------
Date: Thu, 03 Apr 2003 01:26:26 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: need help with perl -pi -e
Message-Id: <3E8B8DB1.3010903@rochester.rr.com>
Rene wrote:
> i tried this, no go, please advise.
>
> [root@localhost contents]# perl -pi -e
> 's#https://yadadada.com/cgi-bin/simple/cart.pl?site=yadada.com&action=main#http://www.hooray.com/scripts/view.pl?page=cart#/'g
> *.content
> Illegal division by zero at -e line 1, <> line 1.
>
Your little program as I think you intended to enter it (what you
entered has the g outside the program, which I don't think is what you
wanted, as that won't compile, rather than giving the divide by zero
error -- *please* cut/paste code!) is essentially:
s#a#b#/g;
which attempts to divide the result of a substitution match by nothing.
Try:
s#a#b#g;
BTW, the ? in your regex is a metacharacter. In this particular case,
that probably won't matter much, but you should get in the habit of
quoting unintended metacharacters, or use quotemeta, probably in its \Q
form, to automatically quote them for you.
--
Bob Walton
------------------------------
Date: Thu, 03 Apr 2003 01:48:41 GMT
From: Steve Grazzini <grazz@nyc.rr.com>
Subject: Re: need help with perl -pi -e
Message-Id: <ZpMia.4461$an1.3545@twister.nyc.rr.com>
Rene <rene@protechgroup.com> wrote:
> i tried this, no go, please advise.
>
> [root@localhost contents]# perl -pi -e
> 's#...#...#/'g
^^^
Just get rid of that slash.
$ perl -pi -e 's#...#...#g'
> *.content
> Illegal division by zero at -e line 1, <> line 1.
^^^^^^^^
This really should have tipped you off. But since it didn't,
the first thing to do (i.e. well before posting to usenet) is
turn on warnings.
$ perl -w -ne 's#..#..#/'g *.content
Unquoted string "g" may clash with future reserved word at -e line 1.
Useless use of division (/) in void context at -e line 1.
Argument "g" isn't numeric in division (/) at -e line 1.
Illegal division by zero at -e line 1.
And it would be much (much!) safer to test the one-liner before
you turn on the in-place edit and become root.
--
Steve
------------------------------
Date: Wed, 02 Apr 2003 21:34:10 GMT
From: Michael Budash <mbudash@sonic.net>
Subject: needs tips installing ImageMagick/PerlMagick on MacOSX
Message-Id: <mbudash-A706A6.13340902042003@typhoon.sonic.net>
hey all-
subject says it all. have any of you gone thru the maneuvers to get
ImageMagick/PerlMagick installed and working on MacOSX? did you use the
binaries or compile from source?
--
Michael Budash
------------------------------
Date: Wed, 02 Apr 2003 18:29:57 -0500
From: tribeguy_15@hotmail.com
Subject: Newbie question about copying directories
Message-Id: <v2sm8vcrk73ugnecojh2sphutap1lpe86l@4ax.com>
Hi,
I'm using version Perl 5.005_03 built for i386-freebsd and
have a problem I can't figure out.
I've made a script to copy a file in a particular directory to another
directory and it works just fine:
system "cp","/usr/templates/.qmail","/home/$username/.qmail" || die
"cannot create $username/.qmail";
I'm trying to do the same type of thing but with directories:
system "cp -R","/usr/templates/Maildir","/home/$username/" || die
"cannot create $username/Maildir";
This script exits without any errors but Maildir and its
subdirectories are not copied to /home/$username for some reason. Can
anyone tell me what I'm doing wrong?
When I type:
cp -R /usr/templates/Maildir /home/test
at the command prompt it works fine.
Thanks for you help,
Shane
------------------------------
Date: Wed, 02 Apr 2003 23:30:27 GMT
From: "codeWarrior" <GPatnude@adelphia.net>
Subject: Re: Newbie question about copying directories
Message-Id: <noKia.26944$TW2.4881975@news1.news.adelphia.net>
<tribeguy_15@hotmail.com> wrote in message
news:v2sm8vcrk73ugnecojh2sphutap1lpe86l@4ax.com...
> Hi,
> I'm using version Perl 5.005_03 built for i386-freebsd and
> have a problem I can't figure out.
> I've made a script to copy a file in a particular directory to another
> directory and it works just fine:
> system "cp","/usr/templates/.qmail","/home/$username/.qmail" || die
> "cannot create $username/.qmail";
>
> I'm trying to do the same type of thing but with directories:
> system "cp -R","/usr/templates/Maildir","/home/$username/" || die
> "cannot create $username/Maildir";
>
> This script exits without any errors but Maildir and its
> subdirectories are not copied to /home/$username for some reason. Can
> anyone tell me what I'm doing wrong?
>
> When I type:
> cp -R /usr/templates/Maildir /home/test
> at the command prompt it works fine.
>
> Thanks for you help,
> Shane
Sounds like your Perl script (which runs as "nobody" in group "nogroup")
probably does NOT have permissions to read / write from the source
directory....
you might want to consider this instead of using the "system" command (can
be a security leak)
use File::Copy;
GP
------------------------------
Date: 02 Apr 2003 19:47:42 GMT
From: Rafael Garcia-Suarez <rgarciasuarez@free.fr>
Subject: Re: Odd UTF-8 error with Switch.pm
Message-Id: <slrnb8mfla.48j.rgarciasuarez@dat.local>
Simon Fairey wrote in comp.lang.perl.misc :
>
> Used my first 'switch' statement today and when it runs I get the
> following:
>
> Malformed UTF-8 character (unexpected continuation byte 0x9e, with no
> preceding start byte) in bitwise and (&) at
> /opt/customer/local/perl58/lib/5.8.0/Switch.pm line 251.
Could you provide a sample minimal script that triggers this error ?
The output of "perl -V" could be also useful.
--
I'll better skip() some releases until it is() ok() to use Test::More
without() going insane(). Any more than I already am, that is().
-- Tels in the perl-qa mailing list
------------------------------
Date: Wed, 02 Apr 2003 15:21:44 -0500
From: Benjamin Goldberg <goldbb2@earthlink.net>
Subject: Re: Odd UTF-8 error with Switch.pm
Message-Id: <3E8B4658.8AA1FFE@earthlink.net>
Simon Fairey wrote:
>
> Hi,
>
> Used my first 'switch' statement today and when it runs I get the
> following:
>
> Malformed UTF-8 character (unexpected continuation byte 0x9e, with no
> preceding start byte) in bitwise and (&) at
> /opt/customer/local/perl58/lib/5.8.0/Switch.pm line 251.
>
> I'm running Perl 5.8 on Solaris 5.8.
>
> I tried using the 'no utf8' pragma and making sure UTF8 is not in any
> of my locale information but it still keeps coming up.
>
> I've hear that Perl now implicitly converts everything to UTF8 and
> that it causes a performance hit so I wanted to switch it off anyway
> so I guess I'm hoping if I get it switched off properly my problem
> will also go away?
Perl doesn't convert anything to utf8 unless you tell it to, or unless
it has to. If you use the chr() operator with a value >=256, the result
is utf8. If you "use encoding ':utf'", then your script is going to be
read and processed as utf8. If you have a string "foo\x{1234}", and
that hex number 0x1234 is >= 256, then it will be utf8 encoded. If you
use the utf8::upgrade() function, you get a utf8 string.
Some *modules* convert their data to utf8... but that's done because the
module chooses to do so -- it's not perl itself magically doing it.
--
$a=24;split//,240513;s/\B/ => /for@@=qw(ac ab bc ba cb ca
);{push(@b,$a),($a-=6)^=1 for 2..$a/6x--$|;print "$@[$a%6
]\n";((6<=($a-=6))?$a+=$_[$a%6]-$a%6:($a=pop @b))&&redo;}
------------------------------
Date: Wed, 2 Apr 2003 21:27:26 +0000 (UTC)
From: "David H. Adler" <dha@panix.com>
Subject: Re: Test / Performance benchmarking position available in Germantown, MD
Message-Id: <slrnb8mldu.ha.dha@panix2.panix.com>
In article <1a3bf200.0304011503.40b31f58@posting.google.com>, ldap wrote:
> We have an entry level position available:
You have posted a job posting or a resume in a technical group.
Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.
Had you read and understood the Usenet user manual posted frequently to
"news.announce.newusers", you might have already known this. :) (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Another good source of information on how Usenet functions is
news.newusers.questions (information from which is also available at
http://www.geocities.com/nnqweb/).
Please do not explain your posting by saying "but I saw other job
postings here". Just because one person jumps off a bridge, doesn't
mean everyone does. Those postings are also in error, and I've
probably already notified them as well.
If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.
http://jobs.perl.org may be of more use to you
Yours for a better usenet,
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
In the silence that followed, Homer was heard to mutter,
"Mmmm... context- dependent semantics..."
- Darrin Edwards in c.l.p.m.
------------------------------
Date: Wed, 2 Apr 2003 13:54:43 -0800
From: Robert Brooks <Use-Author-Supplied-Address-Header@[127.1]>
Subject: Text::ParseWords
Message-Id: <200304022154.h32Lshso028125@www.aarg.net>
In the following script, &shellwords returns an array
of three elements. I would like to know what the first
element is, that is element number 0.
Can you tell me how to print out the element in question?
Or, could you supply some code that would print the character
out in hexadecimal or binary?
Thanks for any help you might give.
# ----------- script ----------
#!/usr/bin/perl
#
use warnings;
use strict;
use Text::ParseWords;
my $string = ' alpha beta';
my @words = &shellwords($string);
my $z = $#words; # Get index number of last element
print "Last element number is: $z \n";
foreach my $w (@words) {
print $w, "\n";
}
print "==============================\n";
my @copy = @words; # Make a copy
if ($copy[0] eq 0x20) {shift @copy} # Get rid of ?
foreach my $c (@copy) {
print $c, "\n";
}
------------------------------
Date: Thu, 03 Apr 2003 01:46:32 GMT
From: Bob Walton <bwalton@rochester.rr.com>
Subject: Re: Text::ParseWords
Message-Id: <3E8B9266.5020205@rochester.rr.com>
Robert Brooks wrote:
> In the following script, &shellwords returns an array
> of three elements. I would like to know what the first
> element is, that is element number 0.
>
> Can you tell me how to print out the element in question?
Sure:
use Data::Dumper;
...
print Dumper(\@words);
Doing that, you will discover that @words[0] is empty. You could also
discover this handily if you call your program like:
perl -d progname.pl
and use the Perl debugger.
> Or, could you supply some code that would print the character
> out in hexadecimal or binary?
What character? If there was one or more, you could try:
print sprintf '%02X ',ord $_ for split //,$words[0];
or:
print sprintf '%08b ',ord $_ for split //,$words[0];
...
--
Bob Walton
------------------------------
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 4807
***************************************