in reply to Re^2: Question regarding handling exceptions in subroutine
in thread Question regarding handling exceptions in subroutine
The obvious answer is to remove the croak (or perhaps change it to a carp/warn).
You can run a command in backticks to trap both the output and the status code it returns. So you should be able to do something like:
my $response=`useradd fred ....`; #check the status code (0 = success) if ($? >>8) { # we could not add the user }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Question regarding handling exceptions in subroutine
by karlgoethebier (Abbot) on May 12, 2013 at 12:24 UTC | |
by space_monk (Chaplain) on May 13, 2013 at 10:28 UTC | |
by karlgoethebier (Abbot) on May 13, 2013 at 12:31 UTC | |
|
Re^4: Question regarding handling exceptions in subroutine
by karlgoethebier (Abbot) on May 12, 2013 at 12:23 UTC |