Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 83861
Status: open
Priority: 0/
Queue: Moose

Owner: Nobody in particular
Requestors: ipluta [...]
Cc: CHOROBA [...]

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

Subject: no warning about overwriting a locally defined method with an accessor in a Role
Download (untitled) / with headers
text/plain 749b
This code runs without any warning about overwriting as sub with an accessor: package Foo; use Moose::Role; has bar => ( is => 'rw', default => "has bar", ); sub bar { return "sub bar"; } package Self; use Moose; with 'Foo'; package main; my $self = Self->new; print $self->bar; Doing a similar but within a Moose class: package Foo; use Moose; has bar => ( is => 'rw', default => "has bar", ); sub bar { return "sub bar"; } package main; my $self = Foo->new; print $self->bar; raises a complaint like: "You are overwriting a locally defined method (bar) with an accessor at ..." Shouldn't the role behavior follow the class behavior rather than silently ignoring an accessor overwrtiting a method?
From: ipluta [...]
Download (untitled) / with headers
text/plain 120b
I marked "broken in 2.0604" but that only means that I tested on this version, not that this version broke the feature.
Download (untitled) / with headers
text/plain 433b
This is definitely a bug, but fixing it is hard. There's a long outstanding todo item for Moose which involves improving how attributes in roles act. Basically, right now we don't know what methods an attribute in a role will generate until the role is applied to a class. To fix this bug (and several others), we need to be able to calculate the methods earlier. Being able to do so will also let us fix a number of other problems.
PR#19 offers the possibility of fixing this.
Interestingly, changing Moose::Role to Moo::Role makes it work as expected.

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

Please report any issues with to