Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re^3: usage of $? in windows

by ikegami (Patriarch)
on Mar 04, 2010 at 23:32 UTC ( [id://826840]=note: print w/replies, xml ) Need Help??


in reply to Re^2: usage of $? in windows
in thread usage of $? in windows

$? == 256 means the child called exit(1) (256>>8 = 1). Chances are that the value (1) is not significant beyond meaning an error occurred. You'd think it would have emitted a message to STDERR identifying the error.

$ perl -le'qx{date abc}; print $?' date: invalid date `abc' 256

One likely cause is improper escaping of arguments. Print out $cmd, check for bad quoting, and try that same command at the prompt.

$ perl -le'qx{cat some file}; print $?' cat: some: No such file or directory cat: file: No such file or directory 256 $ perl -le'qx{cat "some file"}; print $?' 0

You mentioned the child is some kind of searching utility. An error could also indicate no matches were found.

$ perl -le'qx{echo foo | grep bar}; print $?' 256 $ perl -le'qx{echo foo | grep foo}; print $?' 0

The program's man page might identify situations where it might return an error.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (5)
As of 2024-04-24 07:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found