learning.moose has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks, how I can add default values to a hash like that?
has 'url' => ( is => 'rw', isa => 'HashRef', default => sub {}, );
I want my hash to have some default values, like:
$url = { 'url1' => 'perlmonks.org'}
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Moose hash with default values
by kcott (Archbishop) on Jun 04, 2015 at 20:09 UTC | |
|
Re: Moose hash with default values
by GotToBTru (Prior) on Jun 04, 2015 at 20:16 UTC | |
|
Re: Moose hash with default values
by GotToBTru (Prior) on Jun 04, 2015 at 19:58 UTC | |
by learning.moose (Novice) on Jun 04, 2015 at 19:59 UTC | |
by GotToBTru (Prior) on Jun 04, 2015 at 20:02 UTC | |
by learning.moose (Novice) on Jun 04, 2015 at 20:06 UTC | |
by Anonymous Monk on Jun 04, 2015 at 22:48 UTC | |
by GotToBTru (Prior) on Jun 04, 2015 at 23:35 UTC |