From essential practice number eight in Conway's Ten Essential Development Practices,
"Throw Exceptions Instead of Returning Special Values or Setting Flags" (also covered in
Perl Best Practices, Chapter 13, Error Handling):
The bottom line: regardless of the programmer's (lack of) intention, an error indicator is being ignored.
That's not good programming.
Though you may not agree with all Conway's arguments,
as indicated at Two Different Languages: Two Similar Books (PBP and CCS) (in the "Some Similar Guidelines Found in Both Books" section),
throwing exceptions rather than returning flags seems to have become mainstream error handling advice nowadays.
Update: All 255 Perl Best Practices listed here: Perl Best Practices Summary
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|