RECENT POSTS

P5-namespace-clean

May 26, 2018

Keep imports and functions out of your namespace

When you define a function, or import one, into a Perl package, it will naturally also be available as a method. This does not per se cause problems, but it can complicate subclassing and, for example, plugin classes that are included via multiple inheritance by loading them as base classes.

The “namespaceclean” pragma will remove all previously declared or imported symbols at the end of the current package’s compile cycle. Functions called in the package itself will still be bound by their name, but they won’t show up as methods on your class or instances.

WWW http//search.cpan.org/dist/namespace-clean/