in reply to Re: Continue Processing Subrouting Until Successfull
in thread Continue Processing Subrouting Until Successfull

Frank,

Thank you for your response. Wouldn't this execute the run sub if $result equals 255? Should I use a until loop instead like:
until ($result == 255) { $result = run($_); }
Also, can you plase explain what this does a little more $result = run($_);

Thanks,
Dru

Replies are listed 'Best First'.
Re: Re: Re: Continue Processing Subrouting Until Successfull
by ides (Deacon) on Jan 08, 2003 at 17:59 UTC

    No, the result is 255 until a success. So you want to continue looping until $result is not 255.

    As for the $result = run($_); If you notice I added a return() into the run subroutine. This will return the exit code of the ssh() call, which will be 255 ( according to OpenSSH's documentation ) if there is an error or the exit code of the command being run if there isn't an error.

    If your down.pl script returns a different exit code you'll want to adust your test to not be 255.

    -----------------------------------
    Frank Wiles <frank@wiles.org>
    http://frank.wiles.org
Re: Re: Re: Continue Processing Subrouting Until Successfull
by osama (Scribe) on Jan 09, 2003 at 22:36 UTC
    Why use $result at all
    while (run($_)==255) { shift @hosts; }