Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re (tilly) 2: Eval and system()

by tilly (Archbishop)
on Sep 07, 2001 at 18:29 UTC ( #110897=note: print w/replies, xml ) Need Help??


in reply to Re: Eval and system()
in thread Eval and system()

Not entirely true. For many programs if you get back $? of 256 (which is what a return code of 1 looks like), that is not necessarily an errror.

Here is why. The return codes in the standard C libraries are an error code. 0 means, appropriately enough, no error. After that it is up to the author's imagination. In complex applications this generally means a standardized list of messages (kind of like the list enshrined in $!). In smaller applications people often use the convention that 1 is a minor issue that is not really an error and 2 is a fatal error.

For instance try this:

perl -e 'print system("ls no_such_file")'
That gives back 256. It doesn't list anything, but none of its operations ran into trouble, and you might not have expected the file to be there. Now try that with a directory that you don't have permission to access. You will get back a more serious error - it cannot give you a real answer because you are not permitted to know that.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (2)
As of 2022-08-15 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?