[29422] in Perl-Users-Digest
Perl-Users Digest, Issue: 666 Volume: 11
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 20 14:10:13 2007
Date: Fri, 20 Jul 2007 11: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: 666
Today's topics:
Re: A perl issue when execute system call <jeanwelly@gmail.com>
Re: FAQ 4.45 How do I find the first array element for anno4000@radom.zrz.tu-berlin.de
Re: Math <blb8@po.cwru.edu>
Re: OK, so what's the different between OR and || in co anno4000@radom.zrz.tu-berlin.de
Re: OK, so what's the different between OR and || in co <ryandetzel@gmail.com>
Re: OK, so what's the different between OR and || in co anno4000@radom.zrz.tu-berlin.de
Re: OK, so what's the different between OR and || in co <kkeller-usenet@wombat.san-francisco.ca.us>
Re: OK, so what's the different between OR and || in co <attn.steven.kuo@gmail.com>
Re: pid from startet process anno4000@radom.zrz.tu-berlin.de
Re: pid from startet process anno4000@radom.zrz.tu-berlin.de
Re: pid from startet process xhoster@gmail.com
Re: STDOUT and STDERR redirection fails for forked proc <nobull67@gmail.com>
using a module on cpanel when not root <nospam@home.com>
Re: using a module on cpanel when not root <nobull67@gmail.com>
Re: using a module on cpanel when not root <nobull67@gmail.com>
Re: using a module on cpanel when not root anno4000@radom.zrz.tu-berlin.de
Re: XML::Twig segfault on solaris xhoster@gmail.com
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Fri, 20 Jul 2007 15:51:58 -0000
From: jeanwelly <jeanwelly@gmail.com>
Subject: Re: A perl issue when execute system call
Message-Id: <1184946718.882912.211790@j4g2000prf.googlegroups.com>
Hi Glenn,
Actually I was using `which upd` to got the full datapath of clearcase
bin/upd command, when I debug, I found similar hang issue of `which
whois`, due to different server setup, I can't rely on the PATH to
tell where is the bin/upd.
The interesting thing is in SUN server1 I have the issue, but no in
SUN server2, and the two with same kernel version and perl verison.
On 7 20 , 10 27 , Glenn Jackman <gle...@ncf.ca> wrote:
> 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: 20 Jul 2007 15:26:33 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: FAQ 4.45 How do I find the first array element for which a condition is true?
Message-Id: <5gc2h9F3g7m4iU1@mid.dfncis.de>
MrL22 <mr.leishman@gmail.com> wrote in comp.lang.perl.misc:
> # Do this using GREP
>
> my @people = ('Jacob Smith', 'Michael Brown', 'Joshua Smith', 'Matthew
> Cope');
> @smiths = grep(/smith/i, @people);
Look closer! The FAQ is about finding the *first* array element for
which a condition holds.
Your code gets all such elements and for that grep() is indeed the
right tool. If only the first element is wanted, grep may be
inefficient because it doesn't stop there. The FAQ shows solutions
that do.
Anno
------------------------------
Date: Fri, 20 Jul 2007 16:50:20 +0000 (UTC)
From: Brian Blackmore <blb8@po.cwru.edu>
Subject: Re: Math
Message-Id: <f7qp4b$riq$1@gnus01.u.washington.edu>
Michele Dondi <bik.mido@tiscalinet.it> wrote:
> On Fri, 20 Jul 2007 03:46:47 +0000 (UTC), Brian Blackmore
> <blb8@po.cwru.edu> wrote:
> >Yeah, everyone has pretty much indicated the problems here, but I'll
> >echo the "it depends on what you're doing". I'm not the expert, but I
> >have my own arbitrary precision stuff in perl and it's slow, but
> >that's okay because it is supposed to be slow (figure that one out).
> >On the other hand, my C matrix routines are faster than PARI.
> I must have said this already, but a friend of mine, who does QCD
> lattice simulations and is AFAIK very knowledgeable, uses C++ as the
> main language for his programs, and he's a skilled C++ programmer...
> yet for very critical portions of code he creates libraries in
> fortran, which then he links to his C++ programs, because he swears he
> can gain some percent of speed, which is relevant in this respect:
> just think that he's been given access to some supercomuters and huge
> number crunching clusters, and the granted usage time is limited too.
Yeah, it seems to vary quite a bit depending on what one is actually
doing; doesn't it? It's too bad that OS programmers don't concern
themselves with efficient algorithms any more.
I remember once where we had an algorithm that should have been faster
in assembly, but the GCC optimizer came up with something better than
that for the slow i386 machine. Nevertheless, the simple assembly was
still the better choice for the manufactured chip (not exactly a
surprise).
Oh, and I think I came in a bit late to this thread, so if you said it
already, I missed it. Thanks for the recap.
It's sad that I've never used fortran. :( Maybe I'll try to fix
that.
--
Brian Blackmore
blb8 at po dot cwru dot edu
------------------------------
Date: 20 Jul 2007 15:12:41 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: OK, so what's the different between OR and || in conditions?
Message-Id: <5gc1n9F3fi3h1U1@mid.dfncis.de>
Jürgen Exner <jurgenex@hotmail.com> wrote in comp.lang.perl.misc:
> 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".
...apart from the fact the Perl doesn't have an "OR" operator.
Anno
------------------------------
Date: Fri, 20 Jul 2007 16:15:23 -0000
From: detz <ryandetzel@gmail.com>
Subject: Re: OK, so what's the different between OR and || in conditions?
Message-Id: <1184948123.915929.72310@q75g2000hsh.googlegroups.com>
On Jul 20, 11:12 am, anno4...@radom.zrz.tu-berlin.de wrote:
> J=FCrgen Exner <jurge...@hotmail.com> wrote in comp.lang.perl.misc:
>
> > 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".
>
> ...apart from the fact the Perl doesn't have an "OR" operator.
>
> Anno
There's always one smart-ass in the crowd..that's for nothing.
------------------------------
Date: 20 Jul 2007 16:54:22 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: OK, so what's the different between OR and || in conditions?
Message-Id: <5gc7luF3g1dv6U1@mid.dfncis.de>
detz <ryandetzel@gmail.com> wrote in comp.lang.perl.misc:
> On Jul 20, 11:12 am, anno4...@radom.zrz.tu-berlin.de wrote:
> > Jürgen Exner <jurge...@hotmail.com> wrote in comp.lang.perl.misc:
> >
> > > 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".
> >
> > ...apart from the fact the Perl doesn't have an "OR" operator.
> >
> > Anno
>
> There's always one smart-ass in the crowd..that's for nothing.
It does make a difference, so it ought to be mentioned.
Anno
------------------------------
Date: Fri, 20 Jul 2007 10:17:04 -0700
From: Keith Keller <kkeller-usenet@wombat.san-francisco.ca.us>
Subject: Re: OK, so what's the different between OR and || in conditions?
Message-Id: <g977n4xnt6.ln2@goaway.wombat.san-francisco.ca.us>
On 2007-07-20, detz <ryandetzel@gmail.com> wrote:
> On Jul 20, 11:12 am, anno4...@radom.zrz.tu-berlin.de wrote:
>>
>> ...apart from the fact the Perl doesn't have an "OR" operator.
>
> There's always one smart-ass in the crowd..that's for nothing.
If you don't want help, don't ask for it. If you tried to run
perl -e 'print hi if (1 OR 2)'
you'd get a syntax error. Sure, maybe you know the difference, but what
if someone reading the archives does not?
--keith
--
kkeller-usenet@wombat.san-francisco.ca.us
(try just my userid to email me)
AOLSFAQ=http://www.therockgarden.ca/aolsfaq.txt
see X- headers for PGP signature information
------------------------------
Date: Fri, 20 Jul 2007 10:57:03 -0700
From: "attn.steven.kuo@gmail.com" <attn.steven.kuo@gmail.com>
Subject: Re: OK, so what's the different between OR and || in conditions?
Message-Id: <1184954223.878850.306170@z24g2000prh.googlegroups.com>
On Jul 20, 6:45 am, detz <ryandet...@gmail.com> wrote:
> OK, so what's the different between OR and || in conditions? I've
> never been given a clear answer to this.
Read 'perldoc perlop' regarding operator precedence
and associativity. Then try to predict the output of:
print "foo" if (1 or 1 ^ 1);
print "bar" if (1 | 1 ^ 1);
--
Hope this helps,
Steven
------------------------------
Date: 20 Jul 2007 15:42:40 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: pid from startet process
Message-Id: <5gc3fgF3ggf7oU1@mid.dfncis.de>
Douglas Wells <see@signature.invalid> wrote in comp.lang.perl.misc:
> In article <20070719123834.995$wB@newsreader.com>,
> xhoster@gmail.com writes:
> > carlo.maier@netcologne.de wrote:
> (And in response to another comment in this thread, the PID of
> child will almost certainly not be the shell's PID plus 1. Any
> system that does that presents a major security risk and should
> be trashed immediately -- because PIDs would then be guessable.)
It's the other way around. Anything that relies on the non-predict-
ability of PIDs is insecure, unless the system guarantees that property
in a quantifiable way. I've never heard of that.
Many Unix systems assign PIDs sequentially (usually skipping those
that have been used recently, in some sense).
Anno
------------------------------
Date: 20 Jul 2007 15:51:03 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: pid from startet process
Message-Id: <5gc3v7F3ggf7oU2@mid.dfncis.de>
<carlo.maier@netcologne.de> wrote in comp.lang.perl.misc:
> hi,
>
> i am starting an exectuable on hp-ux (ActivePerl Build 817) from a
> perl script and need to know the childs pid.
>
> my $cmd="myexecutable -P parmfile "
>
> my $pid=open(H, "${cmd} |");
> print "\ttest: $_" while (<H>);
> close(H);
>
> The executable starts, but the pid i am getting is not right. The
> executable writes a logfile with the pid as part of the logfile name.
> After the executable returns, i want to check the logfile:
>
> my $logfile="${logdir}/program_${pid}.log";
> open(H,"< $logfile") or die "Can't open logfile '${logfile}': ($!)\n";
> while (<H>) {
> print if (/ENTRY/);
> }
> close (H);
>
> For the reason that the pid, that i am trying to catch with the first
> open-statement, is not correct, i have a problem to check the logfile.
>
> What kind of reasons can be imagined, that the method "$pid=open(H, "$
> {cmd} |");" doesn't supply the correct pid?
> Does anybody know about a method that gives me the correct pid?
The problem (or one compounding problem) seems to be that Perl uses
a shell or not to run the external program, depending on whether the
string contains shell metacharacters. It may depend on other factors
too.
As has been suggested in the thread, exec() could be helpful here. For
instance, *if* it's a perl-interpolated shell that is the problem, you
can change the command as in $cmd = "exec $cmd". Then your command
will run under the shell's PID.
Anno
------------------------------
Date: 20 Jul 2007 16:27:03 GMT
From: xhoster@gmail.com
Subject: Re: pid from startet process
Message-Id: <20070720122705.298$54@newsreader.com>
see@signature.invalid (Douglas Wells) wrote:
> In article <20070719123834.995$wB@newsreader.com>,
> xhoster@gmail.com writes:
> > carlo.maier@netcologne.de wrote:
> > > i am starting an exectuable on hp-ux (ActivePerl Build 817) from a
> > > perl script and need to know the childs pid.
> > >
> > > my $cmd="myexecutable -P parmfile "
> > >
> > > my $pid=open(H, "${cmd} |");
> > > print "\ttest: $_" while (<H>);
> > > close(H);
> > >
> > > The executable starts, but the pid i am getting is not right.
> >
> > I don't see that problem.
> >
> > $ perl -le 'print open my $fh, q{perl -le "print \$$;" |}; print
> > <$fh>' 11050
> > 11050
>
> You don't see the problem because you're not doing the same thing
> as the original poster.
Obviously I'm not doing the exact thing as he is, because I don't
have access to his program "myexecutable -P parmfile". However, I am doing
the same thing as far as Perl is concerned.
>
> The original poster's basic problem is that this form of open
> (using '|') almost certainly invokes the system shell in order to
> execute the command.
Right. As does my example.
And the shell executes the command. Specifically, it "exec"s the command,
which means it doesn't change the pid. That is what my example shows, too.
> (And in response to another comment in this thread, the PID of
> child will almost certainly not be the shell's PID plus 1.
I am far from certain of that. In fact, in 2 out of 3 OS I tested it on,
after arranging for it to fork rather than exec so the pid changes, it was
in fact the old pid plus 1.
> Any
> system that does that presents a major security risk and should
> be trashed immediately -- because PIDs would then be guessable.)
Sorry, but I have no intention of trashing my systems.
> What you have done is to present to the shell a command (print)
> that it can execute internally.
No, I presented the shell with a one line Perl script. The "print" is a
Perl print, not a shell print.
> Thus, it does not need to create
> a child to execute the command.
Whether or not it *needs* to do so, that is what it actually does; strace
verifies this.
> Even if that weren't the case,
> you have used a construct ($$) that gets expanded at the shell
> level before the subprocess is invoked.
I back-whacked the first $ for a reason. And strace verifies that
the expansion does not occur in either of the shells, but is passed to the
inner Perl as intended.
> (Note you have actually
> quoted that construct in several ways, but you have only protected
> it against expansion in the shell that invoked perl and within
> perl itself. To protect it against the shell that is created by
> the open function would require several more backslashes and lots
> of experimentation.)
I did the experimentation. The escaping I supplied is appropriate.
>
> > Maybe your $cmd isn't doing what you think it is doing.
> >
> > Also, you might want to try using the 3-or-more argument form
> > of open:
> >
> > open my $fh, "-|", "$cmd1", @cmd_args;
>
> That will exhibit the same problem.
That would depend on what the actual problem is.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
Date: Fri, 20 Jul 2007 18:02:39 -0000
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: STDOUT and STDERR redirection fails for forked process
Message-Id: <1184954559.223772.198650@r34g2000hsd.googlegroups.com>
On Jul 19, 11:09 am, Peter <mail...@petervannes.nl> wrote:
> Hi,
>
> I am trying to redirect STDERR to STDOUT and catching the returncode
> using the script below.
> Currently every error is redirected to the terminal instead of to
> STDERR or STDOUT, so i am not able to catch the output if it
> originates from a process's STDERR.
>
> Any ideas/suggestions why STDERR is not redirectoed ? (i assume that
> the RC is always 0 because of the failed STDERR redirection).
>
> ## Issue the command by forking the process and monitoring the
> output
> if (open STATUS, "$cmdstr 2>&1 |") {
> while (<STATUS>) {
> $result .= $_ ;
> }
> close STATUS ;
> $rcverror = $? >> 8;
> $errmsg = $! ;
>
> }
> else {
> $errmsg = "Fork failed for \'$cmdstr\'" ;
> $rcverror = -2 ;
> }
>
> # reset the alarm
> alarm(0) ;
> $rcvtimeout = 0 ;
> } ;
>
> Peter
I can't see anything wrong with that code, but then again I can't run
it because it's incomplete and the problem could easily lie in the
bits you don't show us anyhow.
Please post a _minimal_ but _complete_ script that you've actually run
and found to produce the effect you are trying to understand.
This advice, and much more, can be found in the posting guidelines.
------------------------------
Date: Fri, 20 Jul 2007 17:08:22 GMT
From: "Nospam" <nospam@home.com>
Subject: using a module on cpanel when not root
Message-Id: <a_5oi.538$S91.61@newsfe7-win.ntli.net>
I am trying to use a module I have already installed on cpanel theme v3,
I have installed it per the host's instructions, and have added the code
given by the host:
my $homedir = (getpwuid($>))[7];
my $n_inc = scalar @INC;
for (my $i = 0; $i < $n_inc; $i++ ) {
if (-d $homedir . '/perl' . $INC[$i]) {
unshift(@INC,$homedir . '/perl' . $INC[$i]);
$n_inc++;
$i++;
}
}
However it says the module cannot be located even though I have tried it
with and without the library paths, i.e
use module;
or
use module '/path/to/module.pm';
------------------------------
Date: Fri, 20 Jul 2007 17:47:40 -0000
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: using a module on cpanel when not root
Message-Id: <1184953660.440879.247350@q75g2000hsh.googlegroups.com>
On Jul 20, 6:08 pm, "Nospam" <nos...@home.com> wrote:
> I am trying to use a module I have already installed on cpanel theme v3,
>
> I have installed it per the host's instructions, and have added the code
> given by the host:
> my $homedir = (getpwuid($>))[7];
> my $n_inc = scalar @INC;
> for (my $i = 0; $i < $n_inc; $i++ ) {
> if (-d $homedir . '/perl' . $INC[$i]) {
> unshift(@INC,$homedir . '/perl' . $INC[$i]);
> $n_inc++;
> $i++;
>
> }
> }
Golly that's nasty code. What's with the $i and $n_inc stuff? I
strongly suspect that code was not written by a Perl programmer.
my $homedir = (getpwuid($>))[7];
unshift @INC, reverse grep { -d } map { "$homedir/perl/$_" } @INC;
Actually I'm not sure why the original code reversed the order so you
can probably omit the 'reverse'.
> However it says the module cannot be located
I suspect you are attempting to load the module using the 'use'
function. Documentation of the use function can be viewed by entering
perldoc -f use
The important bit to note is where it says "...happen at compile
time".
> even though I have tried it
> with and without the library paths, i.e
>
> use module;
That is a compile time operation. Loading of the module happens when
that line of is compiled and therefore before run-time operations even
if they appear earlier in the source. If you attempt to manipulate
@INC and runtime this won't help because information does not travel
backwards in time.
If you want to make your manipulations of @INC happen at compile time
you need to wrap them in BEGIN {}
> or
>
> use module '/path/to/module.pm';
That is trying to load module.pm from the usual @INC search path and
pass the string '/path/to/module.pm' as the argument to module-
>import().
BTW: I'm having to make assumptions about what you are actually doing
because you didn't post a _minimal_ but _complete_ script to
illustrate your problem.
Please see the posting guidelines for this group.
------------------------------
Date: Fri, 20 Jul 2007 17:51:48 -0000
From: Brian McCauley <nobull67@gmail.com>
Subject: Re: using a module on cpanel when not root
Message-Id: <1184953908.686491.227220@w3g2000hsg.googlegroups.com>
On Jul 20, 6:47 pm, Brian McCauley <nobul...@gmail.com> wrote:
> On Jul 20, 6:08 pm, "Nospam" <nos...@home.com> wrote:
>
> > I am trying to use a module I have already installed on cpanel theme v3,
>
> > I have installed it per the host's instructions, and have added the code
> > given by the host:
> > my $homedir = (getpwuid($>))[7];
> > my $n_inc = scalar @INC;
> > for (my $i = 0; $i < $n_inc; $i++ ) {
> > if (-d $homedir . '/perl' . $INC[$i]) {
> > unshift(@INC,$homedir . '/perl' . $INC[$i]);
> > $n_inc++;
> > $i++;
>
> > }
> > }
>
> Golly that's nasty code. What's with the $i and $n_inc stuff? I
> strongly suspect that code was not written by a Perl programmer.
>
> my $homedir = (getpwuid($>))[7];
> unshift @INC, reverse grep { -d } map { "$homedir/perl/$_" } @INC;
But do you really want a ~/perl/usr/lib/perl/... structure?
I suspect you really just want to say:
use lib (getpwuid($>))[7] . '/perl';
------------------------------
Date: 20 Jul 2007 17:52:41 GMT
From: anno4000@radom.zrz.tu-berlin.de
Subject: Re: using a module on cpanel when not root
Message-Id: <5gcb39F3egjggU1@mid.dfncis.de>
Nospam <nospam@home.com> wrote in comp.lang.perl.misc:
> I am trying to use a module I have already installed on cpanel theme v3,
cPanel is a proprietary product.
> I have installed it per the host's instructions, and have added the code
> given by the host:
Wouldn't the "host", whoever that is, be the first one to ask what may
be wrong?
> my $homedir = (getpwuid($>))[7];
> my $n_inc = scalar @INC;
> for (my $i = 0; $i < $n_inc; $i++ ) {
> if (-d $homedir . '/perl' . $INC[$i]) {
> unshift(@INC,$homedir . '/perl' . $INC[$i]);
> $n_inc++;
> $i++;
> }
> }
That snippet says a lot about the coder's (lack of) familiarity with
Perl (and C for that matter), but little about its intent and purpose.
Apparently you're supposed to put your module in one of a number of
specific subdirectories in your home directory. Have you done that?
Maybe the problem is that it only checks every other element of @INC,
who knows.
> However it says the module cannot be located even though I have tried it
> with and without the library paths, i.e
>
> use module;
>
> or
>
> use module '/path/to/module.pm';
*shrug*
There's no way of knowing how these calls are supposed to work.
If the second form is meant to specify the module's location in
the use-statement, it would take some major voodoo to pull that
off.
Anno
------------------------------
Date: 20 Jul 2007 16:57:49 GMT
From: xhoster@gmail.com
Subject: Re: XML::Twig segfault on solaris
Message-Id: <20070720125751.215$rB@newsreader.com>
Thomas Peter <braindumped@expires-31-07-2007.news-group.org> wrote:
> 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 ***
Are you using threads? I think that getcontext is used in threaded
code, and I suspect XML::Twig might not be thread safe (specifically,
it might use XML::Parser::Expat, which might use a C library that might
not be thread safe.)
>
> > 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
The problem with _exit is that it causes the program to exit without
flushing the buffers, so any buffered output not yet flushed
might be lost. If all your file handles closed (or otherwise flushed)
before the _exit (or seg-fault) happens, then this would not be a problem.
But that is not always easy to arrange or guarantee.
>
> > 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
Yep, that is the Twig cleaning itself up. But there should be call to
the SEGV SIG handler (called something like main::__ANON__). What are the
few lines immediately before this call? Those are the subroutines Perl
was most likely executing when the segfault occurred.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
------------------------------
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 666
**************************************