- I don't see unless as being any clearer. I rarely use unless. I consider its real value to be providing a way to not have to say if( ! ( complex combination of Boolean expressions ) ) and other methods often serve that same purpose. I could write:
to list a few. I read the first one as "if no arguments", which is perfectly clear to me, clearer than "unless some arguments". But it all seems rather trivial in this case and any of them (including using unless) would be fine by me. (: (I guess I'm more likely to use unless as a statement modifier, not much for a conditional block.)
if( ! @_ )
if( 0 == @_ )
if( @_ < 1 )
- use would cause Carp.pm be loaded at compile-time. I don't want to load Carp.pm unless I actually end up needing it. I wouldn't go to this much work in a script, but I pay attention to minor details when writing modules.
- Mostly because the code started out simpler and the error handling was expanded later and the code hasn't been refactored since then. :)
Update: dragonchild tells me that the question was more about require Exporter. use would call Exporter->import and I'm not importing anything from Exporter so I see no point in useing it. Even Exporter docs use require and not use.
(but my friends call me "Tye")
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>
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
Want more info? How to link or
or How to display code and escape characters
are good places to start.