Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

Imagine the following: you're facing a serious programming problem and a coworker tells you not to reinvent the wheel. There's a module that will do just what you need. Rather than just blindly use this module, you decide to give it a code review. Here's what you find:

No strict.

Most variables are global. In fact, much of the module's configuration is controlled by global variables.

Hand-rolled version of Exporter. The author was concerned about performance, so he rolled his own.

To make his code as desireable as possible, the author decided to give users the ability to use the code as both functions or object methods, thus, in your view, unnecessarily complicating the code. Maintenance is rather tricky (just try inheriting from it).

Plenty of symbolic references, such as the following:

*{"${callpack}::$sym"} = \&{"$def\:\:$sym"};

The following line can be found in the contructor:

bless $self,ref $class || $class || $DefaultClass;

In fact, merlyn refers to the above style as Cargo Cult programming. Is it a class method? Is it an instance method? Why is that there?

At least one function has the same name as a standard keyword, forcing the author to use CORE:: to call the original function. Other functions had to be renamed from their originals in prior versions due to collissions with Perl's built-ins.

Needless to say, after discovering all of this, you're absolutely horrified and tell your co-worker that under no circumstances will you use


The above information is valid for $CGI::VERSION='2.752'. I went and downloaded VERSION 2.0 and most, if not all of these points were still valid.

Please note that I am not advocating that anyone abandon this module. I just wanted to take the time to point out that some good programmers can violate the rules and get away with this. In this case, many of the issues above stem from the fact that this is legacy code that has been constantly upgraded.


Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.

In reply to Paradigm Shift - Don't use strict by Ovid

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • 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 or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (3)
As of 2021-09-28 20:47 GMT
Find Nodes?
    Voting Booth?

    No recent polls found