Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: Handling weird return values with or die

by japhy (Canon)
on Jul 05, 2001 at 16:37 UTC ( [id://94075]=note: print w/replies, xml ) Need Help??


in reply to Handling weird return values with or die

The problem is not with or. The problem is with system(). Unlike functions like open(), unlink(), and chmod(), this does not return a true value on success -- rather, it turns 0 (the shell's version of true) on success, and non-zero on failure. This is documented.

Many people write system(...) == 0 or die to get around this. You can use my Perl 6 module for "fixing" the senses of true and false, found at japhygesis. I'll probably put it on CPAN soon.

japhy -- Perl and Regex Hacker
  • Comment on Re: Handling weird return values with or die

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2024-04-26 07:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found