Monks,
I've come across a strange phenomenon I'm hoping someone can shed some light on. It appears that some logical "or"s in my code behave differently if run from the command line, than if called from the scheduler or from a scheduler service I built.
The code works fine when run on the command line (this is 5.6.1 on Win2K). I've seen it in a couple of different places. The problem statements are part of a script I inherited which parses output from some fax software, reformats it then dumps out a text file. I've also seen it in another simpler script. A snippet should serve to illusatrate. Based on the varying circumstances in which I've observed this, the rest of the code is irrelevant. Anyway here goes:
$logfile = "C:\\somepath\\somefile";
open (LOGFILE, "$logfile) || die "Can't open $logfile: $!";
do something with the file
close (LOGFILE);
When executed on the command line, it opens the logfile and continues to execute. When called via "at" or the simple scheduler I wrote, it opens the logfile AND dies. Similarly:
$cmd = "G:\\somepath\\bin\\vfxolog -U vsifax";
$return = `$cmd` or die "Can't execute $cmd: $!";
alternate form fails as well:
$cmd = "G:\\somepath\\bin\\vfxolog -U vsifax";
system ( $cmd ) || die "Can't execute $cmd: $!";
Same behavior as the filehandle operation above. From the command line this dumps the Vsi-Fax log file as directed, and continues processing. But, from "at" or my scheduler, it executes the command AND dies.
I could sort of understand how precedence might change based on context, but I can't figure out how an "or" becomes an "and". What am I missing?