elf_firein has asked for the wisdom of the Perl Monks concerning the following question:
I am facing a strange problem with perl code. I have a perl package abc.pm which has following subroutine:
sub DB_xxx { my ($dbUser, $dbPass, $db, $autoCommit) = @_; my $dbh; # logon to DB unless( $dbh = DBI->connect('dbi:Oracle:' . ($$db || ''), $$dbUser +, $$dbPass, {AutoCommit => $$autoCommit}) ) { croak "Error connecting to database $DBI::errstr \n"; } return $dbh; }
This method is for connecting to database
Inside my own .pl file I am using this subroutine in following manner:use abc qw (DB_xxx); my $dbh; my $stat1 = system ("gzip -t xyz.gz"); print "The stat checking:$stat1\n"; my $userid = xxx; my $passwd = xxx; my $database = xyz; my $autocommit = 0; $dbh=DB_xxx(\$userid, \$passwd, \$database, \$autocommit); my $stat2 = system ("gzip -t xyz.gz"); print "The stat checking:$stat2\n";
The problem is:the value of $stat1 is 0 but value of $stat2 is -1. though the .gz file is same in same location. In Solaris 8 box but in $stat1 & $stat2 have values 0 for both. But in solaris 10 box giving to two differnt output:$stat1=0 & $stat2=-1
I have also printed $!: For $stat2 it is showing error message: / No child process/
Can anybody please help me? Please it is urgent.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: system function is returning status -1 when running a unix command
by ikegami (Patriarch) on Apr 08, 2009 at 06:01 UTC | |
by repellent (Priest) on Apr 08, 2009 at 18:16 UTC | |
by ikegami (Patriarch) on Apr 08, 2009 at 18:37 UTC |
Back to
Seekers of Perl Wisdom