Code:
$dbh = DBI->connect('dbi:Oracle:','/','');
print "DB Ping result : ".$dbh->ping."\n";
if ( system ("pwd") )
{
print "Error!!!!!!!!\n";
}
print "DB Ping result : ".$dbh->ping."\n";
I never really use the ping method, and it may return a good value when there is still a problem. If you want to test for errors, use $h->err or $h-errstr, see
The Fine Manual for more info.
All system("pwd") does is calls a subshell to attempt to get the present working directory, or whatever the "pwd" executable in your current path does.
You need to figure out where the call is failing. First, make sure you run all your tests with the -w flag to enable warnings. Here are some further tests you can do:
You might try to verify that your working directory is actually valid.
Code:
use Cwd;
print getcwd;
That should make the same system call that pwd does, but without running a subshell.
Then try to see if a subshell works. test true should always return 0.
Code:
rc = system("test", "true");
print(rc, " ", rc >> 8, "\n");
That should return 0 0, with the second value being the actual return code.
You can also try to see if the subshell is working, but the fork is failing.
Code:
exec('pwd');
# Exec will quit your program at this point.
You're just looking for possible error messages. Again, make sure you run with -w.