good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: use base 'XYZ' and exportingby ihb (Deacon) |
on May 29, 2005 at 18:46 UTC ( [id://461556]=note: print w/replies, xml ) | Need Help?? |
If you want to inherit, use base. If you want to import, call import. (If you want to import constants and benefit from constant folding, use use to import.) Those are the simple ideas. If you make it so that base exports, you can't control what to import. Then you have to rely on @EXPORT, and can't use tags nor refuse to import. Personally I almost always name what I import, so that when I or someone else return to the code, it'll be clear from where a function was imported. For similar reasons I'd like to advice against using import to set up inheritance unless you really have to, since that is what base is for, and it'll surprise people who read your code. ihb
See perltoc if you don't know which perldoc to read!
In Section
Meditations
|
|