Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"

Re: DNScmd in perl script

by pc88mxer (Vicar)
on Jul 28, 2008 at 21:12 UTC ( #700647=note: print w/replies, xml ) Need Help??

in reply to DNScmd in perl script

Technically to only test the status code you should use:
if ($? >> 8) { print "Error " }
The lower eight bits of $? contain the signal that terminated the process.

There's more info in the perldoc POSIX documentation. In particular, see the documentation for the functions WEXITSTATUS and WIFEXITED.

Note that you shouldn't always trust the status code since it is possible for the command to terminate (like via a signal) before it has a chance to set it.

Replies are listed 'Best First'.
Re^2: DNScmd in perl script
by ikegami (Pope) on Jul 29, 2008 at 08:15 UTC

    Technically to only test the status code you should use:

    But why would he want to ignore other kinds of errors?

Re^2: DNScmd in perl script
by ajd335 (Novice) on Jul 28, 2008 at 21:23 UTC
    Hi , Yes true thing. But the value of $? m getting is -1 all the times...
      I have a feeling that dnscmd is not in your PATH.

      Try printing $! and see if it is No such file or directory.

        Hi , yes , It shows No such file or directory...Where I am wrong...

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://700647]
[Mr. Muskrat]: (considered) Re^3: Please help with Regexp::Common needs to be reparented to Re^2: Please help with Regexp::Common
[Mr. Muskrat]: Is it just me or does that timeout issue seems to be happening more often lately?
[Corion]: Mr. Muskrat: I'm not sure if it really happens more often, but I don't exactly know either
[LanX]: yep

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (12)
As of 2017-01-19 16:20 GMT
Find Nodes?
    Voting Booth?
    Do you watch meteor showers?

    Results (170 votes). Check out past polls.