Subject: | 'lazy_required' doesn't work on inherited attributes |
MooseX::LazyRequire doesn't work for inherited attributes, test is in
attached file.
Subject: | moosex-lazyrequire-inheritance.t |
#!/usr/bin/env perl
use strict;
use warnings;
use Test::Exception tests => 1;
{
package Account;
use Moose;
use MooseX::LazyRequire;
has 'password' => (
is => 'rw',
isa => 'Str',
);
package AccountExt;
use Moose;
extends 'Account';
use MooseX::LazyRequire;
use Carp;
has '+password' => (
is => 'ro',
# Probably there also should be:
# traits => ['LazyRequire'],
# but I'm not sure
lazy_required => 1,
);
}
my $r = AccountExt->new;
throws_ok(
sub { print $r->password },
qr/Attribute password must be provided before calling reader/,
'works on inherited attributes'
);