Think about Loose Coupling | |
PerlMonks |
Re^4: Moose and default valuesby tobyink (Canon) |
on Feb 20, 2013 at 22:39 UTC ( [id://1019857]=note: print w/replies, xml ) | Need Help?? |
Indeed; it has no ties to Moose. It's simply a function that takes a list and returns a (possibly smaller) list. While it's handy to use it with Moose/Mouse/Moo constructors, it can be used with any functions that take a list of key-value pairs that you want to filter out undefs from.
package Cow { use Moo; has name => (is => 'lazy', default => sub { 'Mooington' }) } say Cow->new->name
In Section
Seekers of Perl Wisdom
|
|