In general, I prefer not to import or export anything. I find it confusing when I look at the code later, and I don't mind verbose function calls when they give me extra documentation about where things came from.
However, inheritance may not be the right choice for sharing OO code. Only use inheritance as a way to model behavior of an object, not as a way to simply share code. If you just need to share some code but the behaviors in it don't make sense as an inherent behavior of the object you want to use them from, rethink your object model and figure out what concepts are not being modeled. You may need a new class, which the other classes call or delegate to.
Sometimes I even resort to the dreaded "Foo::Util" class for things that don't fit nicely anywhere else. It's still better than using inheritance just for access to some methods.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.