Skip Menu |

This queue is for tickets about the MooseX-ClassAttribute CPAN distribution.

Report information
The Basics
Id: 55360
Status: open
Priority: 0/
Queue: MooseX-ClassAttribute

People
Owner: Nobody in particular
Requestors: ether [...] cpan.org
Cc:
AdminCc:

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



Subject: MooseX::ClassAttribute does not play well with MooseX::Role::Parameterized
It does not appear to be possible to manipulate class attributes from within a parameterized role. The error is: Attribute (genitor) is required at /usr/lib/perl5/site_perl/5.8.8/i386-linux-thread-multi/Class/MOP/Class.pm line 364 The below example includes two different uses of a class attribute from within a parameterized role, each of which give the same error (above): #!/usr/bin/perl use strict; use warnings; { package Role; use MooseX::Role::Parameterized; use MooseX::ClassAttribute; parameter foo => ( is => 'ro', isa => 'Str' ); role { my $params = shift; my %args = @_; # example 1 class_has role_attr1 => ( is => 'ro', isa => 'Str', default => $params->foo, ); # example 2 my $meta = $args{consumer}; $meta->add_class_attribute('role_attr2', isa => 'Str'); }; } { package Foo; use Moose; with 'Role' => { foo => 'bar' }; } package main; print "compilation successful!\n";
From: bitcard [...] froods.org
Actually, it appears that simply trying to use MooseX::ClassAttribute from a parameterized role will give the same error; it is not necessary to actually call class_has().
On Mon Mar 08 20:05:55 2010, bitcard@froods.org wrote: Show quoted text
> Actually, it appears that simply trying to use MooseX::ClassAttribute > from a parameterized role will give the same error; it is not necessary > to actually call class_has().
I'm not sure how fixable this is. MX::CA should work with regular roles, but a parameterized role isn't a role yet, and doesn't have the necessary metaclasses to hook into.
Subject: Re: [rt.cpan.org #55360] MooseX::ClassAttribute does not play well with MooseX::Role::Parameterized
Date: Sat, 22 May 2010 09:01:33 -0700
To: Dave Rolsky via RT <bug-MooseX-ClassAttribute [...] rt.cpan.org>
From: Karen Etheridge <bitcard [...] froods.org>
I've been looking into this more and I think it's possible to make it work, using the instructions in MX:R:P:Extending. My $work app doesn't need this anymore so I haven't spent any time fleshing it out, but if I get around to it I'll post an example. On Fri, May 21, 2010 at 11:45:42PM -0400, Dave Rolsky via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=55360 > > > On Mon Mar 08 20:05:55 2010, bitcard@froods.org wrote:
> > Actually, it appears that simply trying to use MooseX::ClassAttribute > > from a parameterized role will give the same error; it is not necessary > > to actually call class_has().
> > I'm not sure how fixable this is. MX::CA should work with regular roles, > but a parameterized role isn't a role yet, and doesn't have the > necessary metaclasses to hook into.
-- "Egoist: A person of low taste, more interested in themselves than in me." - Ambrose Bierce . . . . . Karen Etheridge, karen@etheridge.ca GCS C+++$ USL+++$ P+++$ w--- M++ http://etheridge.ca/ PS++ PE-- b++ DI++++ e++ h(-)
Subject: Re: [rt.cpan.org #55360] MooseX::ClassAttribute does not play well with MooseX::Role::Parameterized
Date: Sat, 22 May 2010 11:41:37 -0500 (CDT)
To: Karen Etheridge via RT <bug-MooseX-ClassAttribute [...] rt.cpan.org>
From: Dave Rolsky <autarch [...] urth.org>
On Sat, 22 May 2010, Karen Etheridge via RT wrote: Show quoted text
> I've been looking into this more and I think it's possible to make it work, > using the instructions in MX:R:P:Extending. My $work app doesn't need > this anymore so I haven't spent any time fleshing it out, but if I get > around to it I'll post an example.
Ah, looking into it, that could definitely be made to work. Personally, I don't need this either, but I'll leave this ticket open in case someone else is interested in writing a patch. -dave /*============================================================ http://VegGuide.org http://blog.urth.org Your guide to all that's veg House Absolute(ly Pointless) ============================================================*/