Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 77863
Status: rejected
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: perl [...] evancarroll.com
Cc:
AdminCc:

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



Subject: init_arg default and required.
If you want to establish an interface package Base; use Moose::Role; has 'foo' => ( isa => 'Str', is => 'ro', init_arg => undef, required => 1 ); You can't currently has '+foo' => ( default => 'Bar' ); because you'll get You cannot have a required attribute (_action) without a default, builder, or an init_arg at /usr/local/lib/perl/5.14.2/Moose/Meta/Attribute.pm line 485 It should look to see if the attribute set is modified when composed. -- Evan Carroll System Lord of the Internets http://www.evancarroll.com
On Sat Jun 16 15:46:10 2012, ECARROLL wrote: Show quoted text
> If you want to establish an interface > > package Base; > use Moose::Role; > has 'foo' => ( isa => 'Str', is => 'ro', init_arg => undef, required
=> Show quoted text
> 1 ); > > You can't currently > > has '+foo' => ( default => 'Bar' ); > > because you'll get > > You cannot have a required attribute (_action) without a default, > builder, or an init_arg at > /usr/local/lib/perl/5.14.2/Moose/Meta/Attribute.pm line 485 > > It should look to see if the attribute set is modified when composed.
I can only reproduce this when I put both the role and the class in the same file. If I put them in separate files it seems to work fine. Real code or it didn't happen.