namespace::autocleanKeep imports out of your namespace | |
Download |
namespace::autoclean Ranking & Summary
Advertisement
- License:
- Perl Artistic License
- Price:
- FREE
- Publisher Name:
- Florian Ragwitz
- Publisher web site:
- http://search.cpan.org/~flora/
namespace::autoclean Tags
namespace::autoclean Description
Keep imports out of your namespace When you import a function into a Perl package, it will naturally also be available as a method.namespace::autoclean is a Perl module that will remove all 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.This module is very similar to namespace::clean, except it will clean all imported functions, no matter if you imported them before or after you used the pagma. It will also not touch anything that looks like a method, according to Class::MOP::Class::get_method_list.If you're writing an exporter and you want to clean up after yourself (and your peers), you can use the -cleanee switch to specify what package to clean: package My::MooseX::namespace::autoclean; use strict; use namespace::autocleanclean (); # no cleanup, just load sub import { namespace::autoclean->import( -cleanee => scalar(caller), ); }SYNOPSIS package Foo; use namespace::autoclean; use Some::Package qw/imported_function/; sub bar { imported_function('stuff') } # later on: Foo->bar; # works Foo->imported_function; # will fail. imported_function got cleaned after compilation Requirements: · Perl
namespace::autoclean Related Software