It is not a matter of opposing standards. There are two
different things. First, there are the function calls,
whose behaviour is strictly defined (or else they would
be unusuable). At the C level, failure is often indicated
by a return value of
-1, or
NULL,
and the reason of failure is passed in a global variable,
errno. Not very intuitive (IMO), and Perl,
being the thin layer it is above Unix/C, only makes it
slightly more convenient. It returns
0 on
failure. The reason of failure is still passed in a global
variable,
$! (which explains that variable).
The return values of spawned process have nothing to do with
the shell. It's the other way around. Processes typically
return 0 indicating success, and anything else
for failure. There's no global variable to set, all they can
do is return a single integer. "0 on success"
is a mere convention. It's just because this
convention is followed so often, typical shell Boolean logic
is "reversed"; 0 is true, other integers are
false.
-- Abigail
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.