Skip Menu |
 

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 125855
Status: new
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: rt [...] illuminated.co.uk
Cc:
AdminCc:

Bug Information
Severity: Unimportant
Broken in: (no value)
Fixed in: (no value)



Subject: The documentation for Moose::Meta::Attribute::Native::Trait::Number shouldn't claim its attribute is ro
Download (untitled) / with headers
text/plain 660b
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.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.