in reply to Re^4: Questions about sharing code (@EXPORT_OK++)
in thread Questions about sharing code

And all of those reasons are great reasons. The reason I do it for all my OO CPAN modules (and most of mine are OO) is that I don't want $obj->weaken() to be a possibility. Particularly if weaken() is a method in my base class.

My criteria for good software:
  1. Does it work?
  2. Can someone else come in, make a change, and be reasonably certain no bugs were introduced?
  • Comment on Re^5: Questions about sharing code (@EXPORT_OK++)

Replies are listed 'Best First'.
Re^6: Questions about sharing code (@EXPORT_OK++)
by tye (Sage) on Nov 28, 2007 at 17:54 UTC

    There are more problems than that. This is why I usually write classes with separate packages for class methods, object methods, and utility functionsmethods. Unfortunately, caller and thus SUPER: and its ilk are still too stupid to deal with code that actually prevents such method confusion:

    package My::Class::_implement; use Scalar::Util qw( weaken ); sub My::Class::new { # ... } sub My::Class::Object::method { # ... weaken( $someRef ); # ... }

    Yes, you can abstract out having to re-type class names fairly easily; this is just a quick example.

    - tye