G'day learning.moose,
default => sub { { 'url1' => 'perlmonks.org'} }
It's documented in Moose. Look for has and its subsection default.
"... if you wish to initialize it with a HASH or ARRAY ref, then you need to wrap that inside a CODE reference."
If you really are learning Moose then you should read all of that (fairly short) document. It provides basic information with links to more detailed information and advanced topics.
-- Ken
In reply to Re: Moose hash with default values
by kcott
in thread Moose hash with default values
by learning.moose
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |