in reply to use Module - to exclude or not to exclude...

Don't import anything and use namespaces to be explicit where every function is coming from..

(Ok, this is more of a pet-peeve/stylistic concern than anything else, but I think it's vastly clearer where "Util::random_func" is coming from. People can be reasonably espected to memorized/recognize most of the perl builtin functions, but expecting them to recognize/learn all the random functions that every module can export is pushing it a bit. This way when you go back to your 10,000 line application, you know exactly where every function is defined.)
  • Comment on Re: use Module - to exclude or not to exclude...

Replies are listed 'Best First'.
Re: use Module - to exclude or not to exclude...
by Abigail-II (Bishop) on Apr 05, 2004 at 08:19 UTC
    Don't import anything and use namespaces to be explicit where every function is coming from.
    That requires you to look up where each function is defined, which almost breaks encapsulation. If you do use Module;, and get a function func imported to your name space, it doesn't mean you got Module::func. Module could have use OtherModule itself, and you might have gotten OtherModule::func.

    Do you use this style for OO programming as well? Do you call methods in this way: $obj -> Class::method? If not, why? Or can you remember where all the OO methods are defined, but not the procedurial subs?

    Abigail

Re: Re: use Module - to exclude or not to exclude...
by Fletch (Bishop) on Apr 05, 2004 at 11:07 UTC
    This way when you go back to your 10,000 line application, you know exactly where every function is defined.

    That's what ctags and M-. (or :tag for the heathens) are for . . . . See also ECB.