Subject: | The documentation for Moose::Meta::Attribute::Native::Trait::Number shouldn't claim its attribute is ro |
https://metacpan.org/pod/Moose::Meta::Attribute::Native::Trait::Number says in the synopsis
Show quoted text
> package Real;
> use Moose;
>
> has 'integer' => (
> traits => ['Number'],
> is => 'ro',
> ...
> );
>
> my $real = Real->new();
> $real->add(5); # same as $real->integer($real->integer + 5);
The problem is that saying $real->integer($real->integer + 5) would trigger a "Cannot assign a
value to a read-only accessor" error.
At the very least the documentation should mention that you can get around an attribute value being
modifiable this way by using method delegation. Or it should avoid mentioning this and just have the
example attribute be rw.