Subject: | default attribute-named accessor still created if 'reader' and 'writer' options specified |
Moo still creates the default attribute-named accessor even if reader & writer are specified:
Show quoted text
{
package Foo;
use Moo;
has a => (
is => 'rw',
reader => 'get',
writer => 'set',
);
}
Foo->new->a;
Show quoted text
I would expect this code to die with a message like
Can't locate object method "a" via package "Foo"
I discovered this when I applied modifiers to 'get' and 'set' to monitor them and code which mistakenly used the default accessor name avoided the monitoring code.
Show quoted text
=============================
{
package Foo;
use Moo;
has a => (
is => 'rw',
reader => 'get',
writer => 'set',
);
}
Foo->new->a;
Show quoted text
=============================
I would expect this code to die with a message like
Can't locate object method "a" via package "Foo"
I discovered this when I applied modifiers to 'get' and 'set' to monitor them and code which mistakenly used the default accessor name avoided the monitoring code.