On Mon, Jul 18, 2005 at 12:07:23AM +0100, Dave Mitchell wrote: > > > +{ > > > + my $r = runperl( > > > + stderr => 1, > > > + prog => 'my $d; my $w = sub { return if $d++; warn q(bar)}; > > > local $SIG{__WARN__} = sub { goto &$w; }; warn q(foo);' > > > + ); > > > + like($r, qr/bar/, "goto &foo in warn"); > > > > This program does not segfault, it does nothing. > > > > 0 ~$ perl5.8.6 -wle 'my $d; my $w = sub { return if $d++; warn q(bar)}; > > local $SIG{__WARN__} = sub { goto &$w; }; warn q(foo);' > > 0 ~$ > > That's the idea. In fixed bleed, it prints a warning: > > $ ./perl -wle 'my $d; my $w = sub { return if $d++; warn q(bar)}; local > $SIG{__WARN__} = sub { goto &$w; }; warn q(foo);' > bar at -e line 1. > $ > > The test minimally detects bad behaviour while avoiding runaway recursion > and segfault.
But with runperl() its ok to segfault, its run in a different process. You can even reduce it using fresh_perl_like(). fresh_perl_like(<<'CODE', qr/bar/); my $w = sub { warn q(bar) }; local $SIG{__WARN__} = sub { goto &$w; }; warn q(foo); CODE -- Michael G Schwern [EMAIL PROTECTED] http://www.pobox.com/~schwern Insulting our readers is part of our business model. http://somethingpositive.net/sp07122005.shtml