Thanks for the response. Will the use of fudge only work though if I know the failure point?
Use it in every place there can be a failure ... open or Fudge() ... close or Fudge() ... even readline or Fudge();
while ( ! eof($fh) ) { defined( $_ = <$fh> ) or die Fudge("readline \$fh"); ... }
Heck, even enhance it to sparkle some $? extras
sub Fudge { my $pipe = $?; use Errno(); my $msg = join qq/\n/, "Error @_", map { " $_" } int( $! ) . q/ / . $!, int( $^E ) . q/ / . $^E, grep( { $!{$_} } keys %! ) ; $^E = $! = $pipe; $msg .= join qq/\n/, map { " $_" } "\n #", #~ int( $! ) . q/ / . $!, #~ int( $^E ) . q/ / . $^E, 'status($?) '.( $pipe ), 'subexit($? >>8) '.( $pipe >> 8), 'signal($? & 127) '.( $pipe & 127 ), 'coredump($? & 128) '.( $pipe & 128 ), grep( { $!{$_} } keys %! ), q/ /; return $msg; }
In reply to Re^3: Perl open pipe exiting early
by Anonymous Monk
in thread Perl open pipe exiting early
by albob
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |