![]() |
|
good chemistry is complicated, and a little bit messy -LW |
|
PerlMonks |
Re: Optimized constants without namespace pollution? constant::co?by tobyink (Abbot) |
on Feb 16, 2013 at 11:40 UTC ( #1019033=note: print w/replies, xml ) | Need Help?? |
You're overthinking this. constant and namespace::clean do play nicely together...
The problem with your tests is that you assume that use namespace::clean deletes subs immediately. It does not. It uses B::Hooks::EndOfScope to wipe the subs away when the enclosing scope is finished compiling.
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
In Section
Seekers of Perl Wisdom
|
|