I am migrating an Oracle 9i to Oracle 10g database, and Perl 5.0.4 to Perl 5.8.7 in Sun Solaris environment.
Using Perl 5.8.7, the following legacy code segment is returning a '-1' return code on the system call to execute the 'mv' command. Note that the mv request is across directories.
sub move_inproc
{
print "sub move_inproc\n";
`mv $histhome/dat/inbound/$filename $histhome/dat/inproc/$filename`;
if ($? !=0)
{
&fatal_error ("913", "ERROR - Cant Move $histhome/dat/inbound/$filename to $histhome/dat/inproc");
}
else
{
&log_msg("000", "File $filename successfully moved to $histhome/dat/inproc dir");
}
Interestingly, when the code executes the fatal_error routine the Perl rename function works fine (also across directories).
sub fatal_error
{
...
rename ("$histhome/dat/inproc/$filename", "$histhome/dat/inbad/$filename");
if ($? !=0)
{
&log_msg ("523", "WARNING - Cant Move $histhome/dat/inproc/$filename to $histhome/dat/inbad");
}
else
{
&log_msg("000", "File $filename moved to $histhome/dat/inbad dir"); ...
}
I can find no reason why the system call to the 'mv' command fails, and the Perl 'rename' function works, and better yet, why the 'mv' system call is used in one sub-module, and the Perl 'rename' function in another sub-module.
I am planning on replacing the 'mv' system call with the Perl 'rename' function, unless of course you experts out there tell me different.
Comments welcome; thanks,