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:
package Foo; use Moose; use Carp; Foo->new->carp;
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:
package Foo; use Moose; use namespace::autoclean; has after => (is => 'ro', default => 'yay'); print "It worked " . Foo->new->after;
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.
In reply to Re: can has ELI5 namespace::autoclean pls?
by Haarg
in thread can has ELI5 namespace::autoclean pls?
by Ea
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |