Prevent imports from cluttering your namespace with this software solution.
This module removes all imported symbols at the end of the current package's compile cycle. Functions called within the package will still be bound by their name, but they won't show up as methods on your class or instances. This is similar to namespace::clean, but with some key differences.
For example, namespace::autoclean will clean all imported functions, no matter if you imported them before or after you used the pragma. It will not touch anything that looks like a method, as determined by 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. Here's an example:
```
package My::MooseX::namespace::autoclean;
use strict;
use namespace::autocleanclean (); # no cleanup, just load
sub import {
namespace::autoclean->import(
-cleanee => scalar(caller),
);
}
```
In the SYNOPSIS, we see an example of namespace::autoclean in action. In this case, we have a package called Foo. We're importing a function called imported_function from Some::Package. We then define a sub, bar, that uses that function. Later on, we try to call imported_function as a method on Foo.
Thanks to namespace::autoclean, this fails. The imported function was cleaned up after compilation, so it's not available as a method on Foo.
Overall, namespace::autoclean is a useful module for keeping your code organized and reducing clutter.
Version 0.08: N/A