Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??

Without looking, I'd bet that there are one or more subsection of each that are not used by every use of the main module and that these could be factored out into sub module(s) and required when required rather than loading everything always.

CGI.pm certainly could do this, even allowing for the fact that it generates a lot of it's function on demand. I fully understand the motivations and temptations for people that want to "just parse the options string and print a header or two". If the major :xxx load options to CGI.pm effectively turned into

require 'CGI::HTML4' if %opts{ html4 }; require 'CGI::download' if $opts{ download };

I don't think it would do any harm at all.

The only downside of that is that Perl doesn't support a use Foo::*; syntax, though writing a use wild 'Foo::*'; pragma would be possible I think.

I have a general preference for lots of small files, rather than 1 or 2 huge ones. With editors that can hold multiple files and provide search/replace/index across all workspaces, I find the ability to be working in several places at once in different files very useful. My editor also supports having multiple views of a single file, but I very rarely use it. Years ago I used a very excellent folding editor which encouraged you to put lots of stuff in a single file and use a collapsed view to navigate. It worked great, but then compiling became a chore.

I like to keep as much as possible to do with one unit of code in the same file as I can. Code. Interface (user) docs. Breif modification history. Unit tests. This becomes unweildy where the units are too all encompassing.

For a very large OO module, I would seriously consider putting the class definition, initialisation, constructors and destructors into one file and moving the methods into one or more separate files and loading them as procedures.

Anyway, it's just a preference, not an edict. The OP will doubtless make up there own mind on the matter.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon

In reply to Re^3: Preferred method of documentation? (One comment) by BrowserUk
in thread Preferred method of documentation? by Anonymous Monk

Title:
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 How to display code and escape characters are good places to start.
Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (4)
As of 2024-04-25 16:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found