in reply to Moose hash with default values
Moose::Manual::Attributes says: "If you want to use a reference of any sort as the default value, you must return it from a subroutine. has 'mapping' => ( is => 'ro', default => sub { {} }, );
So perhaps:
has 'url' => (is => 'rw', isa => 'HashRef', default => sub{ {'url1' => + 'perlmonks.org'}}, );
I can't test; I've never used Moose.
|
|---|