in reply to How portable are common $! error codes?
In my opinion, the $! is for the end-user's edification, and that's all. Do not assume you can find a certain substring inside. Do not assume that it's a certain number.
If you have to verify that something had the right result, then verify the result itself, not the feedback. Maybe something didn't set the feedback variables at all, but failed anyway.
In Eiffel, you code by contract. You start a routine with a check that the input situation must comply with a given test. You then perform the work. You end the routine with another check that the new situation must comply with another test to be sure the work was done. This is Just like the old saw about public speaking, "first you say what you're about to say, then you say what you came to say, then you say what you just said."
Update: Coding by contract's fine in Eiffel, but a bit overkill in most Perlish circumstances. You usually don't need to second-guess the actual Perl return values, but you shouldn't assume that feedback (like $!) will be more useful than the basic return values. Double-test the results and fail only when it's critical that you either succeed or stop.
--
[ e d @ h a l l e y . c c ]
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: How portable are common $! error codes?
by Anonymous Monk on Apr 23, 2003 at 21:18 UTC | |
by Anonymous Monk on Apr 24, 2003 at 10:49 UTC | |
by ctilmes (Vicar) on Apr 24, 2003 at 11:24 UTC | |
by Necos (Friar) on Apr 24, 2003 at 17:27 UTC |