[29421] in Perl-Users-Digest
Perl-Users Digest, Issue: 665 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 20 11:10:02 2007
Date: Fri, 20 Jul 2007 08:09:06 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 20 Jul 2007 Volume: 11 Number: 665
Today's topics:
Re: A perl issue when execute system call <jeanwelly@gmail.com>
Re: A perl issue when execute system call <jeanwelly@gmail.com>
Re: A perl issue when execute system call <glennj@ncf.ca>
Re: FAQ 4.45 How do I find the first array element for <mr.leishman@gmail.com>
Re: how to distill this par of string from whole string <jeanwelly@gmail.com>
Re: how to distill this par of string from whole string <klaus03@gmail.com>
OK, so what's the different between OR and || in condit <ryandetzel@gmail.com>
Re: OK, so what's the different between OR and || in co <jurgenex@hotmail.com>
Re: retrieving usenet messages III <bik.mido@tiscalinet.it>
What to do about memory leaks <t-use@gmx.net>
Re: What to do about memory leaks anno4000@radom.zrz.tu-berlin.de
Re: What to do about memory leaks <abigail@abigail.be>
Re: What to do about memory leaks <t-use@gmx.net>
Re: What to do about memory leaks <t-use@gmx.net>
Re: What to do about memory leaks anno4000@radom.zrz.tu-berlin.de
Re: What to do about memory leaks <t-use@gmx.net>
Re: XML::Twig segfault on solaris <braindumped@expires-31-07-2007.news-group.org>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 20 Jul 2007 11:05:15 -0000
From: jeanwelly <jeanwelly@gmail.com>
Subject: Re: A perl issue when execute system call
Message-Id: <1184929515.301205.99710@i13g2000prf.googlegroups.com>
Hi Everyone,
Sorry for not presented my problem clearly, here is clarification.
`which whois`; # it will hang.
It is executed in SUN UNIX OS, and some seems fine, some no; if key
the command in shell directly, it tell me "shell built in command" in
the issued SUN server; while in another SUN server that without this
hang issue, the shell tells me the correct directory.
For how long that I waited for the response, the answer is whole
night :(
On 7 20 , 4 56 , Mirco Wahab <wahab-m...@gmx.de> wrote:
> Sherm Pendley wrote:
> > Mirco Wahab <wa...@chemie.uni-halle.de> writes:
> >> jeanwelly wrote:
> >>> my $result = `which command`;
> >>> print "Stop...\n"; # can not call to here.
> >>> chomp($result);
> >> What is "command"?
>
> > Not "what" - "which". It's a *nix command that crawls your PATH and reports
> > where it finds the first occurrence of "command".
>
> Of course, you are correct. I didn't
> really touch the problem here, sorry.
>
> Regards & thanks for corrections
>
> M.
------------------------------
Date: Fri, 20 Jul 2007 11:27:50 -0000
From: jeanwelly <jeanwelly@gmail.com>
Subject: Re: A perl issue when execute system call
Message-Id: <1184930870.580804.167250@i38g2000prf.googlegroups.com>
One more info: in perl script, `which who`; will not hang, but `which
whois`;.
Thanks!
On 7 20 , 7 05 , jeanwelly <jeanwe...@gmail.com> wrote:
> Hi Everyone,
> Sorry for not presented my problem clearly, here is clarification.
> `which whois`; # it will hang.
>
> It is executed in SUN UNIX OS, and some seems fine, some no; if key
> the command in shell directly, it tell me "shell built in command" in
> the issued SUN server; while in another SUN server that without this
> hang issue, the shell tells me the correct directory.
>
> For how long that I waited for the response, the answer is whole
> night :(
>
> On 7 20 , 4 56 , Mirco Wahab <wahab-m...@gmx.de> wrote:
>
>
>
> > Sherm Pendley wrote:
> > > Mirco Wahab <wa...@chemie.uni-halle.de> writes:
> > >> jeanwelly wrote:
> > >>> my $result = `which command`;
> > >>> print "Stop...\n"; # can not call to here.
> > >>> chomp($result);
> > >> What is "command"?
>
> > > Not "what" - "which". It's a *nix command that crawls your PATH and reports
> > > where it finds the first occurrence of "command".
>
> > Of course, you are correct. I didn't
> > really touch the problem here, sorry.
>
> > Regards & thanks for corrections
>
> > M.- -
>
> - -
------------------------------
Date: 20 Jul 2007 14:27:41 GMT
From: Glenn Jackman <glennj@ncf.ca>
Subject: Re: A perl issue when execute system call
Message-Id: <slrnfa1hiu.6km.glennj@smeagol.ncf.ca>
At 2007-07-20 07:05AM, "jeanwelly" wrote:
> > >> jeanwelly wrote:
> > >>> my $result = `which command`;
> > >>> print "Stop...\n"; # can not call to here.
> > >>> chomp($result);
>
> Sorry for not presented my problem clearly, here is clarification.
> `which whois`; # it will hang.
>
> It is executed in SUN UNIX OS, and some seems fine, some no; if key
> the command in shell directly, it tell me "shell built in command" in
> the issued SUN server; while in another SUN server that without this
> hang issue, the shell tells me the correct directory.
What shell do you use that has whois as a builtin command?
Doesn't 'which' read your .cshrc to learn about aliases? Do you have
anything in .cshrc that might be interfering?
Anyway, you shouldn't be relying on the PATH in a Perl program -- it's a
security issue. Either specify the full path /usr/bin/whois where you
need it, or set $ENV{PATH} yourself to something like '/usr/bin:/bin'.
--
Glenn Jackman
"You can only be young once. But you can always be immature." -- Dave Barry
------------------------------
Date: Fri, 20 Jul 2007 07:22:11 -0700
From: MrL22 <mr.leishman@gmail.com>
Subject: Re: FAQ 4.45 How do I find the first array element for which a condition is true?
Message-Id: <1184941331.498545.290230@57g2000hsv.googlegroups.com>
# Do this using GREP
my @people = ('Jacob Smith', 'Michael Brown', 'Joshua Smith', 'Matthew
Cope');
@smiths = grep(/smith/i, @people);
------------------------------
Date: Fri, 20 Jul 2007 11:30:55 -0000
From: jeanwelly <jeanwelly@gmail.com>
Subject: Re: how to distill this par of string from whole string
Message-Id: <1184931055.578858.125710@e16g2000pri.googlegroups.com>
If I can't know how many "\n" in the string, howthe script can be
written to find all characters before /, and cut them, so I can get /
usr/local/.../?
andgjdkj..dlodjghghdhhdghhd\ndkkdkd\n
On 7 20 , 8 54 , Tad McClellan <ta...@seesig.invalid> wrote:
> jeanwelly <jeanwe...@gmail.com> wrote:
> > $mystring = "andgjdkj..dlodjghghdhhdghhd\ndkkdkd\n/usr/local/ddd\n";
>
> ^ ^
> ^ ^
>
> > I want to distill "/usr/loca/add"
>
> What is it about that string that indicates that that is what
> should be extracted?
>
> Where did the missing "l" go?
>
> What changed "ddd" to "add"?
>
> > from the string and assign to a
> > variable, thanks!
>
> (my $variable = $mystring) =~ s/^(.*?\/)|\n//sg;
> or
> my $variable = substr $mystring, rindex($mystring, '/usr/'), -1;
> or
> my $variable = substr $mystring, 35, 14;
> or
> my($variable) = $mystring =~ /^(\/.*)/m;
> or
> my($variable) = $mystring =~ m#(/.*)#;
> or
> my($variable) = grep /\//, split /\n/, $mystring;
> or
> my $variable = (split /\n/, $mystring)[2];
>
> --
> Tad McClellan
> email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Fri, 20 Jul 2007 05:32:36 -0700
From: Klaus <klaus03@gmail.com>
Subject: Re: how to distill this par of string from whole string
Message-Id: <1184934756.947300.256690@22g2000hsm.googlegroups.com>
On Jul 19, 2:20 pm, jeanwelly <jeanwe...@gmail.com> wrote:
> $mystring = "andgjdkj..dlodjghghdhhdghhd\ndkkdkd\n/usr/local/ddd\n";
>
> I want to distill "/usr/loca/add" from the string and assign to a
> variable
I could guess what you want, but you should first describe the general
rule more precisely, then, after you have described the rule precisely
and completely, you can give an example of what you want to achieve by
concrete data, the data should be consistent and in line with the
general rule.
Even in the absence of any rule, the concrete data you have given in
your post does not seem to be consistent (the letter "l" is missing
after '[...] distill "/usr/loca [...]' and "/ddd" is not the same as "/
add".
> $mystring = " [...] /usr/local/ddd [...] ";
> [...] I want to distill "/usr/loca/add [...] "
-- Klaus
------------------------------
Date: Fri, 20 Jul 2007 13:45:22 -0000
From: detz <ryandetzel@gmail.com>
Subject: OK, so what's the different between OR and || in conditions?
Message-Id: <1184939122.939725.92400@q75g2000hsh.googlegroups.com>
OK, so what's the different between OR and || in conditions? I've
never been given a clear answer to this.
------------------------------
Date: Fri, 20 Jul 2007 14:14:22 GMT
From: "Jürgen Exner" <jurgenex@hotmail.com>
Subject: Re: OK, so what's the different between OR and || in conditions?
Message-Id: <2r3oi.11$b04.6@trndny06>
detz wrote:
> OK, so what's the different between OR and || in conditions? I've
> never been given a clear answer to this.
They have different priority. Details see "perldoc perlop".
jue
------------------------------
Date: Fri, 20 Jul 2007 13:15:56 +0200
From: Michele Dondi <bik.mido@tiscalinet.it>
Subject: Re: retrieving usenet messages III
Message-Id: <s961a3dj8efg4rv1lec5vptr27odopf76h@4ax.com>
On Thu, 19 Jul 2007 20:55:59 -0700, "merl the perl"
<zaxfuuq@invalid.net> wrote:
>Merrill is my given name. Many Americans cannot so much as pronounce my
Yeah, like Merril Strip, ain't it? ;-p
Michele
--
{$_=pack'B8'x25,unpack'A8'x32,$a^=sub{pop^pop}->(map substr
(($a||=join'',map--$|x$_,(unpack'w',unpack'u','G^<R<Y]*YB='
.'KYU;*EVH[.FHF2W+#"\Z*5TI/ER<Z`S(G.DZZ9OX0Z')=~/./g)x2,$_,
256),7,249);s/[^\w,]/ /g;$ \=/^J/?$/:"\r";print,redo}#JAPH,
------------------------------
Date: 20 Jul 2007 11:08:21 GMT
From: Martin Trautmann <t-use@gmx.net>
Subject: What to do about memory leaks
Message-Id: <slrnfa15t5.otd.t-use@ID-685.user.individual.de>
Hi all,
I got a perl script here which takes more memory than expected: It
starts at about 10 MB, which is ok. After half of the job (3000 URL
checks) it got > 500 MB, further increasing up to its termination. I've
seen several segmentation fault errors as soon as the script would end,
but don't know why. It's just a while loop, which is processed again and
again without problems, while there's no more command after the end of
this loop. Maybe the increased memory size is related to this error.
I use strict and warnings, I verified that there was nothing wrong about
the variables and open/close files.
I take extensive use of WWW::Mechanize, without any knowledge what going
on inside.
I used Devel::Leaks in order to get the info that there's much going on -
but I do not know yet what to do about this kind of information.
What's your recommendation for a perl novice how to find out about these
leaks?
Thanks,
Martin
------------------------------
Date: 20 Jul 2007 11:35:00 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: What to do about memory leaks
Message-Id: <5gbkv4F3fkhorU1@mid.dfncis.de>
Martin Trautmann <traut@gmx.de> wrote in comp.lang.perl.misc:
>
> Hi all,
>
> I got a perl script here which takes more memory than expected: It
> starts at about 10 MB, which is ok. After half of the job (3000 URL
> checks) it got > 500 MB, further increasing up to its termination. I've
> seen several segmentation fault errors as soon as the script would end,
> but don't know why. It's just a while loop, which is processed again and
> again without problems, while there's no more command after the end of
> this loop. Maybe the increased memory size is related to this error.
>
> I use strict and warnings, I verified that there was nothing wrong about
> the variables and open/close files.
>
> I take extensive use of WWW::Mechanize, without any knowledge what going
> on inside.
>
> I used Devel::Leaks in order to get the info that there's much going on -
> but I do not know yet what to do about this kind of information.
What's that? I can't find it on CPAN.
> What's your recommendation for a perl novice how to find out about these
> leaks?
None.
We'd have to see more of your code. Reduce it to a minimal example
that still exhibits the behavior and post that.
Anno
------------------------------
Date: 20 Jul 2007 11:45:40 GMT
From: Abigail <abigail@abigail.be>
Subject: Re: What to do about memory leaks
Message-Id: <slrnfa182r.i5.abigail@alexandra.abigail.be>
_
Martin Trautmann (t-use@gmx.net) wrote on VLXXI September MCMXCIII in
<URL:news:slrnfa15t5.otd.t-use@ID-685.user.individual.de>:
()
() Hi all,
()
() I got a perl script here which takes more memory than expected: It
() starts at about 10 MB, which is ok. After half of the job (3000 URL
() checks) it got > 500 MB, further increasing up to its termination. I've
() seen several segmentation fault errors as soon as the script would end,
() but don't know why. It's just a while loop, which is processed again and
() again without problems, while there's no more command after the end of
() this loop. Maybe the increased memory size is related to this error.
()
() I use strict and warnings, I verified that there was nothing wrong about
() the variables and open/close files.
()
() I take extensive use of WWW::Mechanize, without any knowledge what going
() on inside.
()
() I used Devel::Leaks in order to get the info that there's much going on -
() but I do not know yet what to do about this kind of information.
()
() What's your recommendation for a perl novice how to find out about these
() leaks?
Check line 17.
Abigail
--
echo "==== ======= ==== ======"|perl -pes/=/J/|perl -pes/==/us/|perl -pes/=/t/\
|perl -pes/=/A/|perl -pes/=/n/|perl -pes/=/o/|perl -pes/==/th/|perl -pes/=/e/\
|perl -pes/=/r/|perl -pes/=/P/|perl -pes/=/e/|perl -pes/==/rl/|perl -pes/=/H/\
|perl -pes/=/a/|perl -pes/=/c/|perl -pes/=/k/|perl -pes/==/er/|perl -pes/=/./;
------------------------------
Date: 20 Jul 2007 12:01:19 GMT
From: Martin Trautmann <t-use@gmx.net>
Subject: Re: What to do about memory leaks
Message-Id: <slrnfa190f.otd.t-use@ID-685.user.individual.de>
On 20 Jul 2007 11:35:00 GMT, anno4000@radom.zrz.tu-berlin.de wrote:
> Martin Trautmann <traut@gmx.de> wrote in comp.lang.perl.misc:
> >
> > Hi all,
> >
> > I got a perl script here which takes more memory than expected: It
> > starts at about 10 MB, which is ok. After half of the job (3000 URL
> > checks) it got > 500 MB, further increasing up to its termination. I've
> > seen several segmentation fault errors as soon as the script would end,
> > but don't know why. It's just a while loop, which is processed again and
> > again without problems, while there's no more command after the end of
> > this loop. Maybe the increased memory size is related to this error.
> >
> > I use strict and warnings, I verified that there was nothing wrong about
> > the variables and open/close files.
> >
> > I take extensive use of WWW::Mechanize, without any knowledge what going
> > on inside.
> >
> > I used Devel::Leaks in order to get the info that there's much going on -
> > but I do not know yet what to do about this kind of information.
>
> What's that? I can't find it on CPAN.
The module itself is Devel::Leak
http://search.cpan.org/~ni-s/Devel-Leak-0.03/
> > What's your recommendation for a perl novice how to find out about these
> > leaks?
>
> None.
>
> We'd have to see more of your code. Reduce it to a minimal example
> that still exhibits the behavior and post that.
I don have a short example at hand - it's an interactive web site where
I have to step along some inputs up to the result, then start again.
I'll try to reproduce it while submitting it to a local server and find
out more about it...
The script is not that long, if I should mail it to you completely.
Thanks,
Martin
------------------------------
Date: 20 Jul 2007 12:08:39 GMT
From: Martin Trautmann <t-use@gmx.net>
Subject: Re: What to do about memory leaks
Message-Id: <slrnfa19e7.otd.t-use@ID-685.user.individual.de>
On 20 Jul 2007 11:45:40 GMT, Abigail wrote:
> Check line 17.
[http://search.cpan.org/~ni-s/Devel-Leak-0.03/|Devel::Leak]s
my perl was NOT build with -DDEBUGGING and compilation warns me about an
existing sv_dump. I don't know what I may expect from this Utitlity - I
get the memory warnings, but I don't know yet what to do with them.
What should I learn from the result of Devel::Leak::CheckSV($handle);
new 0x18ebd08 :
Thanks,
Martin
------------------------------
Date: 20 Jul 2007 12:19:08 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: What to do about memory leaks
Message-Id: <5gbnhsF3e3p8uU1@mid.dfncis.de>
Martin Trautmann <traut@gmx.de> wrote in comp.lang.perl.misc:
> On 20 Jul 2007 11:35:00 GMT, anno4000@radom.zrz.tu-berlin.de wrote:
> > Martin Trautmann <traut@gmx.de> wrote in comp.lang.perl.misc:
> > >
> > > Hi all,
> > >
> > > I got a perl script here which takes more memory than expected: It
> > > starts at about 10 MB, which is ok. After half of the job (3000 URL
> > > checks) it got > 500 MB, further increasing up to its termination. I've
> > > seen several segmentation fault errors as soon as the script would end,
> > > but don't know why. It's just a while loop, which is processed again and
> > > again without problems, while there's no more command after the end of
> > > this loop. Maybe the increased memory size is related to this error.
> > >
> > > I use strict and warnings, I verified that there was nothing wrong about
> > > the variables and open/close files.
> > >
> > > I take extensive use of WWW::Mechanize, without any knowledge what going
> > > on inside.
> > >
> > > I used Devel::Leaks in order to get the info that there's much going on -
> > > but I do not know yet what to do about this kind of information.
> >
> > What's that? I can't find it on CPAN.
>
> The module itself is Devel::Leak
> http://search.cpan.org/~ni-s/Devel-Leak-0.03/
Aha. Please be careful, typos like that frustrate those who try to help
you.
> > > What's your recommendation for a perl novice how to find out about these
> > > leaks?
> >
> > None.
> >
> > We'd have to see more of your code. Reduce it to a minimal example
> > that still exhibits the behavior and post that.
>
> I don have a short example at hand - it's an interactive web site where
> I have to step along some inputs up to the result, then start again.
>
> I'll try to reproduce it while submitting it to a local server and find
> out more about it...
>
> The script is not that long, if I should mail it to you completely.
No, not to me personally.
Read the posting guidelines that come up here twice a week. It has
recommendations on how to prepare an example script. When you have
a short demo of the problem, post it here. You'll probably find
the solution while preparing the demo, it often happens.
Anno
------------------------------
Date: 20 Jul 2007 14:15:03 GMT
From: Martin Trautmann <t-use@gmx.net>
Subject: Re: What to do about memory leaks
Message-Id: <slrnfa1gr7.otd.t-use@ID-685.user.individual.de>
On 20 Jul 2007 12:19:08 GMT, anno4000@radom.zrz.tu-berlin.de wrote:
> > The module itself is Devel::Leak
> > http://search.cpan.org/~ni-s/Devel-Leak-0.03/
>
> Aha. Please be careful, typos like that frustrate those who try to help
> you.
Sorry about that - I may be used too much to wiki styles, changing suffix or
conjugation for better readability
> Read the posting guidelines that come up here twice a week. It has
> recommendations on how to prepare an example script. When you have
> a short demo of the problem, post it here. You'll probably find
> the solution while preparing the demo, it often happens.
Ok, I´ll try a combination of a cgi perl script and a mechanize script,
asking the same page again and again and will make these scripts more
and more complex until they will show the leaking - if they do.
I hoped that there are other modules that would give more information
what's going on. Devel::Leak does show me that something is leaking -
now I´d like to see further info what to do about it. This package from
2000 is somehow dead and unmaintained (unfortunately the owner also died
himself), while there's little docu for the novice what to do with this
kind of info.
------------------------------
Date: Fri, 20 Jul 2007 12:24:33 +0200
From: Thomas Peter <braindumped@expires-31-07-2007.news-group.org>
Subject: Re: XML::Twig segfault on solaris
Message-Id: <1184927073.04@user.newsoffice.de>
thank you for the useful hints!!
xhoster@gmail.com wrote:
> I would strace (or struss, as I think it is called on Solaris) the program
> to see what is the very last system call made before the seg-fault.
that is not so informative to me:
many "getcontext(0x.......)"
getcontext(0xFF3F0258)
Incurred fault #6, FLTBOUNDS %pc = 0xFF132AA0
siginfo: SIGSEGV SEGV_MAPERR addr=0xFF3EE000
Received signal #11, SIGSEGV [caught]
siginfo: SIGSEGV SEGV_MAPERR addr=0xFF3EE000
*** process killed ***
> If that didn't seem informative, then I'd try using POSIX::_exit to abort
> the program after the print finished, and if it exits that way without
> segfault, then that suggests the problem is in the END blocks or DESTROY
> routines.
that worked. adding
POSIX::_exit(0);
let the script not segfault
> If that didn't narrow it down, I would remove the _exit and try adding
> $SIG{SEGV}=sub {die @_};
> Then running the program through the profiler (perl -d:DProf),
> then dump the call tree to see what was the last thing that perl
> did before triggering the SEGV handler:
> dprofpp -t |tail
the result is
XML::Twig::Elt::DESTROY
XML::Twig::Elt::twig
XML::Twig::Elt::root
i redirected 'dprofpp -t's output to a file (120mb) and those messages
appeared the last ~40k lines
these are twig-internas and i mailed michel rodriguez, the developer of
xml-twig
thanx again for the hints...
------------------------------
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.
NOTE: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V11 Issue 665
**************************************