Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

comment on

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

Based on reading the thread you linked, and testing the code, this action-at-a-distance behavior can be avoided simply by using the module first.

From what I understand there are three major arguments against base.pm:

  1. Hidden errors when a module cannot be found.
  2. Manipulation of fields (ala fields.pm) when it's not needed.
  3. Inability to pass a list to used modules.

Given that there are simple counters:

  • Use the module prior to passing it to use base. This solves both 1 and 3.
  • The fields manipulation is conditional, based on whether or not fields have been manipulated prior. If you don't need fields, base.pm won't do anything to them.

So, given all of that, what you're left with is a decision between:

use Module; use base qw(Module);

and:

use Module; our @ISA = qw(Module);

I can tell you I prefer use base from a readability standpoint alone. It also has the advantage of assigning to @ISA at compile-time, instead of run-time, which can resolve some problems if the modules being used attempt to call class methods immediately. Admittedly, this is extremely rare, however.

If you are aware of any other outstanding problems with base.pm, by all means, share them. Otherwise what this boils down to is a simple style issue.


In reply to Re^2: base.pm vs @ISA by Somni
in thread base.pm vs @ISA by jettero

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 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? | Other CB clients
Other Users?
Others surveying the Monastery: (6)
As of 2022-05-23 21:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (82 votes). Check out past polls.

    Notices?