Subject: | init_arg gets confused |
Date: | Wed, 14 Aug 2013 20:01:55 -0700 |
To: | bug-Moo [...] rt.cpan.org |
From: | Aran Deltac <bluefeet [...] gmail.com> |
In Moose this works as I would expect:
has original_foo => (
is => 'ro',
init_arg => 'foo',
);
has foo => (
is => 'ro',
init_arg => undef,
lazy_build => 1,
);
sub _build_foo {
my ($self) = @_;
print "BUILDING FOO\n";
return $self->original_foo() || 'NO FOO';
}
print Package->new( foo => 'bar' )->foo();
Both Moo and Moose will print "bar". But, only Moose will call _build_foo
and print "BUILDING FOO". Something in Moo is getting confused and is
directly assigning the foo argument to the foo attribute, even tho the foo
attribute has an undef init_arg.