Re: Issue with HashRef attritubes

[email protected] (Kent Fredric) Wed, 26 Jun 2013 18:36:30 +1200
Newsgroups perl.moose
Message-ID <CAATnKFDb+bYaF_Wi7D1d4zeKqGvfpJDUKxV5UGmG6dbp1y9i6g@mail.gmail.com>
On 26 June 2013 14:36, Faelin McCaley Landy <[email protected]> wrote:

> meaning that it's a bit more frustrating to use them if I don't want a
> default value...
>

I think your problem is the attributes you're trying to use are not
'required'

If you have an attribute that you require users to populate, but sometime
after '$class->new()'

Then you may want to look at 'MooseX::LazyRequire'
https://metacpan.org/module/ETHER/MooseX-LazyRequire-0.10/lib/MooseX/LazyRequire.pm

Which is more or less equivalent to

has attr => (
     ...
     lazy => 1 ,
     builder => sub { die }
);


-- 
Kent