Would you agree that using CGI.pm is less effort and more maintainable? I posit that this is a non-trivial example because it is so frequent (still!), particularly roll-your-own query-string parsing.
Using CGI.pm or not is about code reuse, not maintainability. But say I had handrolled my own CGI parsing, and for whatever new requirement, I now have the need to separate arguments not only by '&' and ';', but also by '-'. What do you think would be easier to do, change the code I wrote myself, or code that someone else wrote, and which doesn't live in my source control, but instead is maintained by the system wide packaging system, as it's third party software? (Note that I almost always would use CGI.pm if the alternative was writing it myself, but not for maintainability reasons - because code reuse makes I can deliver faster).
Could it be that monks of your experience will see almost any example as trivial, because it's something you've been doing for years
There's a lot that's not trivial. But I do mean a real function (or module) that does something - not a fragment like variable names. I'm asking for two implementations of the same functionality: one written in the simplest way, doing nothing more than required, and one written in the maintainable way, and then to show the latter did not take more effort to write than the former. (And with more effort, I do not mean the number of characters - typing '$target_hostname' or '$th' takes the same effort - effort is much more than the physical act of depressing and releasing keys; thinking what to write is effort; testing your code is effort; merging it into existing code may be an effort, etc)
-
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.
|