http://www.perlmonks.org?node_id=757585


in reply to Re: The bug in DBI package
in thread The bug in DBI package

Yep. Instead of checking the $? or $! I played a trick.This code sinppet inside a function.
my $status = `gzip -cd filename 2>&1`; print "The status is:$status\n"; if (!($status eq '')) { print " ERROR : $file is corrupt. \n"; return 0; }

It works!!! But do you think this is the right way to tackle?

But problem is when I am trying to close a pipe handle. I did somethig like that:

use IO::Pipe; my @command =qw(gzip -cd filename); my $fh = new IO::Pipe; $fh->reader(@command)|| warn "ERROR : Can't read : $!"; while(<$fh>) { #doing some long job here;such as $variable = readline $fh; . . . } undef $fh;#close $fh if ($? != 0) { print "problem in undef or closing:$? with status:$!"; }

I am getting the last print message as error as:problem in undef or closing:-1 with status:no child process". My question is that is it required to check the $? or $! here? If we ignore it will system dump core?