Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: When is a logical or not logical

by BrowserUk (Patriarch)
on May 10, 2003 at 03:27 UTC ( [id://257066]=note: print w/replies, xml ) Need Help??


in reply to When is a logical or not logical

As far as the system "failures" are concerned, the problem is that you cannot use or die...; to test these calls for failure. For a better explanation than I can give see sauoq's explanation at Re: Re: vanishing system call. (Notice also that he was replying to my bad use of this 'meme':)

As for the `backticks`, in essence, if the `cmd` returns no output, then the die will be triggered, but it doesn't mean that the cmd didn't execute, only that it didn't produce any output.

As for the open case working from the command line but not under the auspices of AT, the problem is probably that when it runs under the scheduler, it runs under a different account to when you are running it from the command line and that account doesn't have permission to access the file? It's a guess, but it's a problem that has come up here before.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"When I'm working on a problem, I never think about beauty. I think only how to solve the problem. But when I have finished, if the solution is not beautiful, I know it is wrong." -Richard Buckminster Fuller

Replies are listed 'Best First'.
Re: Re: When is a logical or not logical
by rah (Monk) on May 10, 2003 at 03:41 UTC
    I like the system explaination - makes sense. Thanks for the link.

    The backtick case may have been when I was still battling permissions problems. In that case I believe you are right on the mark, because without correct permissions, the command runs, but gives no output. I'll need to re-examine that now that I have those resolved.

    Unfortunately that still leaves the "open" case. This one is not permissions. The curious thing is that it does create a 0 byte file, then dies. I actually had two typos in my OP. Should have been:

    open (LOGFILE, ">$logfile") or die "Can't open $logfile: $!";
      Ah - well - the correction to your typo presents an explatnation not addressed yet, for the apparently anamolos behaviour. The "greater-than" symbol in the OPEN statement will be treated as an output redirect by the command prompt, even if it is inside quotes. To avoid that, it needs to be preceded by the caret (^). So, to run the open statement at the command line the way you want, you will need to enter it as:
      open (LOGFILE, "^>$logfile") or die "Can't open $logfile: $!";
      (Notice the tiny little "^" symbol after the first quote mark)

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://257066]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2024-12-12 17:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which IDE have you been most impressed by?













    Results (65 votes). Check out past polls.