[31046] in Perl-Users-Digest
Perl-Users Digest, Issue: 2291 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Mar 23 14:09:51 2009
Date: Mon, 23 Mar 2009 11:09:13 -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 Mon, 23 Mar 2009 Volume: 11 Number: 2291
Today's topics:
Re: DateTime format of date <justin.0903@purestblue.com>
Extract Parren matched values <Ansher.M@gmail.com>
How to use a variable as regular expression? <slsamliu@gmail.com>
Re: How to use a variable as regular expression? (Greg Bacon)
Re: How to use a variable as regular expression? <jurgenex@hotmail.com>
Re: i have a question <schaitan@gmail.com>
Re: i have a question <ben@morrow.me.uk>
Re: Most efficient way to do set-comparison <schaitan@gmail.com>
net telnet mount sydneypuente@yahoo.com
Re: net telnet mount <placebo@dontbesilly.com>
new CPAN modules on Mon Mar 23 2009 (Randal Schwartz)
Perl class to remove HTML tags from a page using a list <landemaine@gmail.com>
Perl killed after child spawn <earthwormgaz@googlemail.com>
Re: Perl killed after child spawn <RedGrittyBrick@spamweary.invalid>
Re: Perl killed after child spawn <schaitan@gmail.com>
Re: Perl killed after child spawn <earthwormgaz@googlemail.com>
Re: Perl killed after child spawn <schaitan@gmail.com>
Re: Perl killed after child spawn (Greg Bacon)
Re: Perl killed after child spawn (Greg Bacon)
Re: Perl killed after child spawn <tadmc@seesig.invalid>
Re: Perl killed after child spawn <earthwormgaz@googlemail.com>
Re: Perl Packager - Free to wrong pool error <ben@morrow.me.uk>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Mon, 23 Mar 2009 10:41:08 -0000
From: Justin C <justin.0903@purestblue.com>
Subject: Re: DateTime format of date
Message-Id: <1704.49c76744.5cb9f@zem>
On 2009-03-20, Eric Pozharski <whynot@pozharski.name> wrote:
> On 2009-03-19, Justin C <justin.0903@purestblue.com> wrote:
>> On 2009-03-18, Glenn Jackman <glennj@ncf.ca> wrote:
> *SKIP*
>>> my $formattedDate = strftime "%d%m%y", localtime;
>>
>> Works perfectly, thank you. But I'm not sure what's going on.
>> strftime = STRing Formatting of TIME?
>> ... and why is the documentation for it in DateTime when you don't need
>> the DateTime module for it to run? There's obviously still a *lot* for
>> me to learn.
>
> (mere attempt to make you more confused) Consider reading something
> about Unix programming. That will make rounds about C (the very old
> stuff the Perl is still written in, you know) obviously, but when you'll
> succeed you'll acquire better understanding what Perl does.
Does reading K N King 'C. Programming: A Modern Approach' count? I'm
getting through it slowly :-)
Justin.
--
Justin C, by the sea.
------------------------------
Date: Mon, 23 Mar 2009 08:37:47 -0700 (PDT)
From: ansher <Ansher.M@gmail.com>
Subject: Extract Parren matched values
Message-Id: <244ab95b-48ce-4bf9-9db2-deca7537f0bb@h20g2000yqj.googlegroups.com>
Hello
I have a file which looks something like this...
l axn1;c=c(&dat)'&lnk';nz
*include &tt.qin;tt=WEB
*include &base.qin;
*include q6.qin;
*include q7.qin; axn=q7;col(b)=&kod;pun=&p;fil=&fb
*include q8.qin; axn=q8;col(b)=&qod;pun=&p;fil=&fb
n01&txt ;c=gkeeper.eq.1
n01Not &txt ;c=gkeeper.eq.2
I want a list of values which qualifies the condition m/\&[a-z]+/.
It will be great if you can help me in how to get the exact pattern
match values to an array.
&dat
&lnk
&tt
&base
&kod
&p
&fb
&qod
&txt
------------------------------
Date: Mon, 23 Mar 2009 08:35:42 -0700 (PDT)
From: SamL <slsamliu@gmail.com>
Subject: How to use a variable as regular expression?
Message-Id: <7737ba0e-be8d-443c-a696-85b77bf84ed1@v15g2000yqn.googlegroups.com>
I want to use a variable as a regular expression because I want user
to be able to specify the regular expression in command line.
Basically I want something like this:
perl -e '$pattern='s/a/b/'; $x='a'; $x=~$pattern; print $x;'
where user can modify $pattern at runtime.
Of course the above does not work. I am wondering if there is some
mechanism in perl allowing me to do that. For example, something like
eval in ksh.
Thanks.
------------------------------
Date: Mon, 23 Mar 2009 11:01:08 -0500
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: How to use a variable as regular expression?
Message-Id: <gbednQ6M96XZL1rUnZ2dnUVZ_trinZ2d@posted.hiwaay2>
SamL wrote
: I want to use a variable as a regular expression because I want user
: to be able to specify the regular expression in command line.
:
: Basically I want something like this:
:
: perl -e '$pattern='s/a/b/'; $x='a'; $x=~$pattern; print $x;'
:
: where user can modify $pattern at runtime.
:
: Of course the above does not work. I am wondering if there is some
: mechanism in perl allowing me to do that. For example, something like
: eval in ksh.
Yes, and it's called eval even!
perl -le '$pattern="s/a/b/"; $x="a"; eval "\$x=~$pattern"; print $x'
Hope this helps,
Greg
--
Criminal means, once tolerated, are soon preferred.
-- Edmund Burke
------------------------------
Date: Mon, 23 Mar 2009 09:31:39 -0700
From: Jürgen Exner <jurgenex@hotmail.com>
Subject: Re: How to use a variable as regular expression?
Message-Id: <3tdfs4dkcd654unerd75phm4b38pksdjag@4ax.com>
SamL <slsamliu@gmail.com> wrote:
>I want to use a variable as a regular expression because I want user
>to be able to specify the regular expression in command line.
>
>Basically I want something like this:
>
>perl -e '$pattern='s/a/b/'; $x='a'; $x=~$pattern; print $x;'
>
>where user can modify $pattern at runtime.
You seem to be thourougly confused.
s/a/b/
is neither a regular expression nor a pattern. In your context it is a
string but ordinarily as code it would be a command, the substitute
command to be precise.
The only regular expression aka pattern is the 'a' in that line. And
yes, there is no problem whatsoever using variables in regular
expressions, just do it.
That's what you asked for, but that is not your problem. Your problem is
that you have data (the content of $pattern) and want that data
evaluated as code. That is a completely different issue, applies to any
data and any command, and has nothing whatsoever to do with regular
expressions.
>Of course the above does not work. I am wondering if there is some
>mechanism in perl allowing me to do that. For example, something like
>eval in ksh.
Excellent guess. What happened when you checked
perldoc -f eval
jue
------------------------------
Date: Mon, 23 Mar 2009 01:05:46 -0700 (PDT)
From: Krishna Chaitanya <schaitan@gmail.com>
Subject: Re: i have a question
Message-Id: <cf462873-ac80-49d9-ad82-7746e5512d58@x1g2000prh.googlegroups.com>
The answer to problems posed by file locking and concurrency control
is a database (don't kill yourself trying to reinvent the wheel). For
your problem, a sequence object in the DB sounds good. I've done this
many times and your need sounds simple, so yeah a sequence should do.
One more piece of free advice. If you're doing this for a live web-
shop kinda thing, please pay attention to encryption, floating-point
arithmetic, etc.
------------------------------
Date: Mon, 23 Mar 2009 16:06:57 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: i have a question
Message-Id: <1mok96-tt8.ln1@osiris.mauzo.dyndns.org>
Quoth Tad J McClellan <tadmc@seesig.invalid>:
>
> You should use single quotes unless you need one of the two extra
> things that double quotes gives you.
I used to think that, until http://markmail.org/message/e4i3ngej24an7uch
convinced me otherwise. The section on double-quoting starts about a
third of the way down (search for 'politically-correct Bowdlerization').
Ben
------------------------------
Date: Mon, 23 Mar 2009 00:54:25 -0700 (PDT)
From: Krishna Chaitanya <schaitan@gmail.com>
Subject: Re: Most efficient way to do set-comparison
Message-Id: <5aaaaf86-7034-4a0b-9d50-728d6efb0c82@y33g2000prg.googlegroups.com>
> [snip]
>
> >What is a reporting truss, pls? I've searched but didn't find much on
> >it. Also, about this truss and good logging system, again, could you
> >pls. site examples of good CPAN modules that already do all this? I am
> >prepared to read every line of them to understand these concepts. Pls.
> >don't mind if I ask for examples, but they really drive home all of
> >you guys' points...
>
> I'll see if I can find a primitave example for you.
>
Hi sln, could you get your hands on an example yet? Thanks much...
------------------------------
Date: Mon, 23 Mar 2009 02:45:18 -0700 (PDT)
From: sydneypuente@yahoo.com
Subject: net telnet mount
Message-Id: <144997ed-12ed-479c-9fb7-169bed3083da@c9g2000yqm.googlegroups.com>
Hello Guys,
Not sure if this is the correct group tpo post on.
Am using net telnet inside cygwin on my windows laptop to invoke an
NFS mount on a remote solaris box.
print "accessing $host\n";
my $t = new Net::Telnet;
$t->open($host);
$t->login("root", "password");
print "mounting software \n";
$t->cmd(String => " mount -F nfs 192.168.1.18:/expo /mnt",
Timeout = 60);
Works just fine.
Except when the target box is switched off!
How can I check that the mount has succeeded please?
TIA
Syd
------------------------------
Date: Mon, 23 Mar 2009 11:22:44 GMT
From: "Peter Wyzl" <placebo@dontbesilly.com>
Subject: Re: net telnet mount
Message-Id: <8iKxl.30543$cu.1622@news-server.bigpond.net.au>
<sydneypuente@yahoo.com> wrote in message
news:144997ed-12ed-479c-9fb7-169bed3083da@c9g2000yqm.googlegroups.com...
> Hello Guys,
> Not sure if this is the correct group tpo post on.
> Am using net telnet inside cygwin on my windows laptop to invoke an
> NFS mount on a remote solaris box.
> print "accessing $host\n";
>
> my $t = new Net::Telnet;
> $t->open($host);
> $t->login("root", "password");
> print "mounting software \n";
> $t->cmd(String => " mount -F nfs 192.168.1.18:/expo /mnt",
> Timeout = 60);
> Works just fine.
> Except when the target box is switched off!
> How can I check that the mount has succeeded please?
From the Net::Telnet docs re: open
open - connect to port on remote host
$ok = $obj->open($host); $ok = $obj->open([Host => $host,]
[Port => $port,]
[Errmode => $mode,]
[Timeout => $secs,]);This method opens a TCP connection
to $port on $host. If either argument is missing then the current value of
host() or port() is used. Optional named parameters are provided to override
the current setting of errmode and timeout.
On success 1 is returned. On time-out or other connection failures, the
error mode action is performed. See errmode().
HTH, HAND
P
------------------------------
Date: Mon, 23 Mar 2009 04:42:26 GMT
From: merlyn@stonehenge.com (Randal Schwartz)
Subject: new CPAN modules on Mon Mar 23 2009
Message-Id: <KGxzqq.1yq7@zorch.sf-bay.org>
The following modules have recently been added to or updated in the
Comprehensive Perl Archive Network (CPAN). You can install them using the
instructions in the 'perlmodinstall' page included with your Perl
distribution.
API-ISPManager-0.0102
http://search.cpan.org/~nrg/API-ISPManager-0.0102/
OOP interface to the ISPManager Hosting Panel API ( http://ispsystem.com )
----
App-Rsnapshot-1.999_00002
http://search.cpan.org/~dcantrell/App-Rsnapshot-1.999_00002/
----
App-SocialSKK-0.01
http://search.cpan.org/~kentaro/App-SocialSKK-0.01/
SKK Goes Social
----
Champlain-0.03
http://search.cpan.org/~potyl/Champlain-0.03/
Map rendering canvas
----
Class-Mix-0.002
http://search.cpan.org/~zefram/Class-Mix-0.002/
dynamic class mixing
----
Cvs-Trigger-0.04
http://search.cpan.org/~mschilli/Cvs-Trigger-0.04/
Argument parsers for CVS triggers
----
Date-JD-0.003
http://search.cpan.org/~zefram/Date-JD-0.003/
conversion between flavours of Julian Date
----
Date-MSD-0.002
http://search.cpan.org/~zefram/Date-MSD-0.002/
conversion between flavours of Mars Sol Date
----
DateTime-TimeZone-SystemV-0.003
http://search.cpan.org/~zefram/DateTime-TimeZone-SystemV-0.003/
System V and POSIX timezone strings
----
DateTime-TimeZone-Tzfile-0.002
http://search.cpan.org/~zefram/DateTime-TimeZone-Tzfile-0.002/
tzfile (zoneinfo) timezone files
----
Document-Writer-0.12
http://search.cpan.org/~gphat/Document-Writer-0.12/
Library agnostic document creation
----
ExtUtils-MakeMaker-6.50
http://search.cpan.org/~mschwern/ExtUtils-MakeMaker-6.50/
Create a module Makefile
----
Fedora-Bugzilla-0.08
http://search.cpan.org/~rsrchboy/Fedora-Bugzilla-0.08/
Interact with Fedora's bugzilla instance
----
File-Lock-Multi-0.04
http://search.cpan.org/~crakrjack/File-Lock-Multi-0.04/
Lock files more than once
----
Filter-Arguments-0.05
http://search.cpan.org/~dylan/Filter-Arguments-0.05/
Configure and read your command line arguments from @ARGV.
----
FlatFile-DataStore-0.10
http://search.cpan.org/~bbaxter/FlatFile-DataStore-0.10/
Perl module that implements a flat file data store.
----
Gantry-3.54
http://search.cpan.org/~tkeefer/Gantry-3.54/
Web application framework for mod_perl, cgi, etc.
----
Graphics-Primitive-Driver-CairoPango-0.55
http://search.cpan.org/~gphat/Graphics-Primitive-Driver-CairoPango-0.55/
Cairo/Pango backend for Graphics::Primitive
----
IO-Buffered-1.00
http://search.cpan.org/~tlbdk/IO-Buffered-1.00/
A simple buffer class for dealing with different data types
----
IO-EventMux-2.00
http://search.cpan.org/~tlbdk/IO-EventMux-2.00/
Multiplexer for sockets, pipes and any other types of filehandles that you can set O_NONBLOCK on and does buffering for the user.
----
IO-EventMux-Socket-MsgHdr-0.02
http://search.cpan.org/~tlbdk/IO-EventMux-Socket-MsgHdr-0.02/
sendmsg, recvmsg and ancillary data operations
----
JavaScript-Beautifier-0.04
http://search.cpan.org/~fayland/JavaScript-Beautifier-0.04/
Beautify Javascript (beautifier for javascript)
----
List-Util-WeightedChoice-0.06
http://search.cpan.org/~dsadinoff/List-Util-WeightedChoice-0.06/
Perl extension to allow for nonnormalized weighted choices
----
Module-Install-ProvidesClass-0.000001
http://search.cpan.org/~ash/Module-Install-ProvidesClass-0.000001/
provides detection in META.yml for 'class' keyword
----
Module-Release-2.03
http://search.cpan.org/~bdfoy/Module-Release-2.03/
Automate software releases
----
Ocsinventory-Agent-1.0
http://search.cpan.org/~goneri/Ocsinventory-Agent-1.0/
----
Ocsinventory-Agent-1.0.1
http://search.cpan.org/~goneri/Ocsinventory-Agent-1.0.1/
----
Osgood-Client-2.0.1
http://search.cpan.org/~gphat/Osgood-Client-2.0.1/
Client for the Osgood Passive, Persistent Event Queue
----
POE-Component-Client-MPD-0.9.2
http://search.cpan.org/~jquelin/POE-Component-Client-MPD-0.9.2/
a full-blown mpd client library
----
POE-Component-Jabber-3.00
http://search.cpan.org/~nperez/POE-Component-Jabber-3.00/
A POE Component for communicating over Jabber
----
POE-Filter-XML-0.35
http://search.cpan.org/~nperez/POE-Filter-XML-0.35/
A POE Filter for parsing XML
----
SSH-Command-0.02
http://search.cpan.org/~nrg/SSH-Command-0.02/
interface to execute multiple commands on host by SSH protocol
----
SSH-Command-0.03
http://search.cpan.org/~nrg/SSH-Command-0.03/
interface to execute multiple commands on host by SSH protocol without certificates ( only login + password )
----
Scope-OnExit-0.01
http://search.cpan.org/~leont/Scope-OnExit-0.01/
Running code on scope exit
----
TaskForest-1.22
http://search.cpan.org/~enoor/TaskForest-1.22/
A simple but expressive job scheduler that allows you to chain jobs/tasks and create time dependencies. Uses text config files to specify task dependencies.
----
Util-Any-0.06
http://search.cpan.org/~ktat/Util-Any-0.06/
Export any utilities and To create your own Util::Any
----
Win32-Console-ANSI-1.04
http://search.cpan.org/~jlmorel/Win32-Console-ANSI-1.04/
Perl extension to emulate ANSI console on Win32 system.
----
Wx-Perl-DataWalker-0.01
http://search.cpan.org/~smueller/Wx-Perl-DataWalker-0.01/
Perl extension for blah blah blah
----
XML-MiniCity-0.02
http://search.cpan.org/~jkramer/XML-MiniCity-0.02/
----
XML-Tiny-2.0
http://search.cpan.org/~dcantrell/XML-Tiny-2.0/
simple lightweight parser for a subset of XML
If you're an author of one of these modules, please submit a detailed
announcement to comp.lang.perl.announce, and we'll pass it along.
This message was generated by a Perl program described in my Linux
Magazine column, which can be found on-line (along with more than
200 other freely available past column articles) at
http://www.stonehenge.com/merlyn/LinuxMag/col82.html
print "Just another Perl hacker," # the original
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Smalltalk/Perl/Unix consulting, Technical writing, Comedy, etc. etc.
See http://methodsandmessages.vox.com/ for Smalltalk and Seaside discussion
------------------------------
Date: Mon, 23 Mar 2009 10:36:59 -0700 (PDT)
From: "Charles L." <landemaine@gmail.com>
Subject: Perl class to remove HTML tags from a page using a list of CSS selectors?
Message-Id: <cec0fd71-bcdb-4513-bf62-f891ab920dc5@p11g2000yqe.googlegroups.com>
Hello,
I have Squid (a proxy server) on my computer and I use it as an ad
filter (like AdBlock, AdSweep or Privoxy). Every HTML page that I
download from my browser, goes through Squid that in turn sends it to
a Perl script that can alter content from the page and send it back
once changed.
I was wondering if there is a Perl class that exists and that I could
use to take CSS selectors (e.g. #bannerad, div.adsense), search for
each of those selectors inside the HTML page, remove them (and all
child nodes), and return the cleaned page.
Thanks,
------------------------------
Date: Mon, 23 Mar 2009 05:34:24 -0700 (PDT)
From: earthwormgaz <earthwormgaz@googlemail.com>
Subject: Perl killed after child spawn
Message-Id: <d24a506c-45b7-4727-a8ea-9115224b699c@p11g2000yqe.googlegroups.com>
Hi,
I'm using Perl to run some tests over night. The tests are written in C
++ and they spawn their own child processes.
I'm finding that if my C++ child process bombs out with signal ABRT
(this is on Solaris btw, with Perl v5.8.4), then Perl dies. The script
run just says "Killed" and that's all I get out of it.
I tried running through the Perl debugger, but that just gets killed
too. Is there some way to make the script more resiliant to this sort
of thing? Or is it maybe a Perl bug in this version?
Any help would be great, I'm only vaguely familiar with Perl.
Thanks!
Gaz
------------------------------
Date: Mon, 23 Mar 2009 12:43:10 +0000
From: RedGrittyBrick <RedGrittyBrick@spamweary.invalid>
Subject: Re: Perl killed after child spawn
Message-Id: <49c783e7$0$16176$db0fefd9@news.zen.co.uk>
earthwormgaz wrote:
> Hi,
>
> I'm using Perl to run some tests over night. The tests are written in C
> ++ and they spawn their own child processes.
>
> I'm finding that if my C++ child process bombs out with signal ABRT
> (this is on Solaris btw, with Perl v5.8.4), then Perl dies. The script
> run just says "Killed" and that's all I get out of it.
>
> I tried running through the Perl debugger, but that just gets killed
> too. Is there some way to make the script more resiliant to this sort
> of thing? Or is it maybe a Perl bug in this version?
>
> Any help would be great, I'm only vaguely familiar with Perl.
I'd try
perldoc -q trap
--
RGB
------------------------------
Date: Mon, 23 Mar 2009 07:20:17 -0700 (PDT)
From: Krishna Chaitanya <schaitan@gmail.com>
Subject: Re: Perl killed after child spawn
Message-Id: <38bc666a-f20c-4d8f-9d74-bc60d991f759@s38g2000prg.googlegroups.com>
Can you give us a little more info through pseudo-code or still
better, real code?
------------------------------
Date: Mon, 23 Mar 2009 07:30:02 -0700 (PDT)
From: earthwormgaz <earthwormgaz@googlemail.com>
Subject: Re: Perl killed after child spawn
Message-Id: <24a9d65e-3939-4d14-b77d-134f4068e407@a12g2000yqm.googlegroups.com>
On 23 Mar, 14:20, Krishna Chaitanya <schai...@gmail.com> wrote:
> Can you give us a little more info through pseudo-code or still
> better, real code?
The Perl uses backticks to launch the C++ program, and stores the
program output in a variable.
I've got this lot at the top trying to catch if anything nasty
happens, but I never see the goat message.
$SIG{ABRT} = sub { msg("goat!!!!!!"); };
$SIG{TERM} = sub { msg("goat!!!!!!"); };
$SIG{SEGV} = sub { msg("goat!!!!!!"); };
$SIG{FPE} = sub { msg("goat!!!!!!"); };
$SIG{ILL} = sub { msg("goat!!!!!!"); };
$SIG{INT} = sub { msg("goat!!!!!!"); };
------------------------------
Date: Mon, 23 Mar 2009 07:39:28 -0700 (PDT)
From: Krishna Chaitanya <schaitan@gmail.com>
Subject: Re: Perl killed after child spawn
Message-Id: <cad7030e-4057-4db9-817d-dc10fb72fa59@w35g2000prg.googlegroups.com>
Well, I don't know about the msg function but you can add the
backticks code inside an eval block, and then check on $@? Just
thinking aloud. Also it won't hurt to have an END block print out
anything you want.
------------------------------
Date: Mon, 23 Mar 2009 09:52:14 -0500
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Perl killed after child spawn
Message-Id: <2eOdnR6tP-SDP1rUnZ2dnUVZ_u2dnZ2d@posted.hiwaay2>
earthwormgaz@googlemail.com wrote
: I'm finding that if my C++ child process bombs out with signal ABRT
: (this is on Solaris btw, with Perl v5.8.4), then Perl dies. The script
: run just says "Killed" and that's all I get out of it. [...]
How are you starting the child processes?
The bigger-hammer approach would be to ignore SIGABRT from the test
driver, at the disadvantage of losing meaning in exit statuses:
$ cat try
#! /usr/bin/perl
use warnings;
use strict;
my @tests = (
[ null => "/bin/true" ],
[ abort => 'perl -e \'kill ABRT, $$\'' ],
);
foreach my $case (@tests) {
my($desc,$cmd) = @$case;
my $pid = fork;
if ($pid) {
waitpid $pid, 0;
print "$desc: ", $? == 0 ? "PASS" : "FAIL", "\n";
}
else {
$SIG{ABRT} = "IGNORE";
exec $cmd or die "$0: exec: $!";
}
}
$ ./try
null: PASS
abort: PASS
You'll get better advice if you show us some code.
Greg
--
As long as Americans honor Lincoln so highly, there is probably no hope for
individual liberty in America. For, as Lincoln said as a young man, the man
who freed the slaves would be tempted to enslave free men.
-- Wirkman Virkkala, http://wirkman.net/wordpress/?p=1063
------------------------------
Date: Mon, 23 Mar 2009 10:02:47 -0500
From: gbacon@hiwaay.net (Greg Bacon)
Subject: Re: Perl killed after child spawn
Message-Id: <W-SdnUqpg84KOVrUnZ2dnUVZ_oDinZ2d@posted.hiwaay2>
earthwormgaz@googlemail.com wrote
: The Perl uses backticks to launch the C++ program, and stores the
: program output in a variable.
:
: I've got this lot at the top trying to catch if anything nasty
: happens, but I never see the goat message.
:
: $SIG{ABRT} = sub { msg("goat!!!!!!"); };
: $SIG{TERM} = sub { msg("goat!!!!!!"); };
: $SIG{SEGV} = sub { msg("goat!!!!!!"); };
: $SIG{FPE} = sub { msg("goat!!!!!!"); };
: $SIG{ILL} = sub { msg("goat!!!!!!"); };
: $SIG{INT} = sub { msg("goat!!!!!!"); };
But those signal handlers live in your Perl program, not in the
child processes.
Is the code below a reasonable approximation of what you're doing?
#! /usr/bin/perl
use warnings;
use strict;
my @tests = (
[ null => "/bin/true" ],
[ abort => 'perl -e \'kill ABRT, $$\'' ],
);
foreach my $case (@tests) {
my($desc,$cmd) = @$case;
my $output = `$cmd`;
print "$desc: ", $? == 0 ? "PASS" : "FAIL", "\n";
}
Yes, you'll see a message about the abort on the standard error,
but that doesn't necessarily mean the parent died:
$ ./run-tests
null: PASS
Aborted (core dumped)
abort: FAIL
Greg
--
compilant, adj.: Not necessarily compliant, but at least it compiles.
-- Jutta Degener
------------------------------
Date: Mon, 23 Mar 2009 10:20:13 -0500
From: Tad J McClellan <tadmc@seesig.invalid>
Subject: Re: Perl killed after child spawn
Message-Id: <slrngsfa5d.b1t.tadmc@tadmc30.sbcglobal.net>
earthwormgaz <earthwormgaz@googlemail.com> wrote:
> (this is on Solaris btw, with Perl v5.8.4), then Perl dies. The script
> run just says "Killed" and that's all I get out of it.
^^^^^^^^^^^^^^^^^^
^^^^^^^^^^^^^^^^^^
That is a symptom of the "Linux OOM killer", but I thought
Solaris didn't use memory overcommitt...
http://developers.sun.com/solaris/articles/subprocess/subprocess.html
> I tried running through the Perl debugger, but that just gets killed
> too. Is there some way to make the script more resiliant to this sort
> of thing? Or is it maybe a Perl bug in this version?
I'd look into the possibility of running out of memory anyway.
--
Tad McClellan
email: perl -le "print scalar reverse qq/moc.noitatibaher\100cmdat/"
------------------------------
Date: Mon, 23 Mar 2009 08:30:39 -0700 (PDT)
From: earthwormgaz <earthwormgaz@googlemail.com>
Subject: Re: Perl killed after child spawn
Message-Id: <222df5fa-d3d1-49c3-ad78-4a2cb9fdea9a@v19g2000yqn.googlegroups.com>
On 23 Mar, 14:39, Krishna Chaitanya <schai...@gmail.com> wrote:
> Well, I don't know about the msg function but you can add the
> backticks code inside an eval block, and then check on $@? Just
> thinking aloud. Also it won't hurt to have an END block print out
> anything you want.
I looked at an eval block, and wrapped my backtick call in one ...
eval {
$result = `$testLocalBin` or die "oh bugger\n";
}; warn $@ if $@;
It looks like the above now. My Perl script still runs thusly ...
bash-3.00$ ./runTests.pl
Entering directory /tests/unittests
Killed
------------------------------
Date: Mon, 23 Mar 2009 15:51:06 +0000
From: Ben Morrow <ben@morrow.me.uk>
Subject: Re: Perl Packager - Free to wrong pool error
Message-Id: <aonk96-tt8.ln1@osiris.mauzo.dyndns.org>
Quoth tmcd@panix.com:
> In article <0bd49123-0355-4fb7-a205-3bd72d7e020b@v1g2000prd.googlegroups.com>,
> <google@markginsburg.com> wrote:
> >
> >I was unaware that system() could be made to run asynchroneously.
>
> I'd never heard of it either. I Googled and found
> <http://www.mail-archive.com/perl-win32-users@listserv.activestate.com/msg35810.html>
> explaining things.
>
> It's not documented in "perlfunc system" but in "man perlport". The
> text (the trailing "(Win32)" apparently means "this paragraph applies
> to Windows 32-bit"):
If you're running perl on a non-Unix (non-BSD?) system, you should read
the whole of perlport for entries that apply to your OS. In this day and
age it would probably be better if they were folded back into the main
documentation, but that would require someone able and willing to do the
work :).
Ben
------------------------------
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 2291
***************************************