note
Haarg
<p>If you don't clean your imports using something like namespace::autoclean or namespace::clean, then they will remain and be callable as methods on your objects. So something like the following will work and issue a warning with your object stringified:</p>
<code>
package Foo;
use Moose;
use Carp;
Foo->new->carp;
</code>
<p>This is usually not harmful, although it can be unexpected or allow people to accidentally call things in unusual ways. Cleaning your imports also allows you to re-use those imported sub names as method, such as for attributes. That means that the following will work:</p>
<code>
package Foo;
use Moose;
use namespace::autoclean;
has after => (is => 'ro', default => 'yay');
print "It worked " . Foo->new->after;
</code>
<p>Normally, after would be one of Moose's helpers that creates a method modifier, but cleaning it using namespace::autoclean allows an attribute with the same name to be created.</p>
1229960
1229960