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?


In reply to When is a logical or not logical by rah

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.