Skip Menu |

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

Report information
The Basics
Id: 59284
Status: open
Priority: 0/
Queue: MooseX-Traits

People
Owner: Nobody in particular
Requestors: dan.harbin [...] gmail.com
Cc:
AdminCc:

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



Subject: is_anon_class is rendered useless by MooseX::Traits
Why does MooseX::Traits generate its own ANON class names? This makes Class::MOP::Class->is_anon_class useless. For example, I want to find the first superclass that is not anonymous (for logging purposes): use List::Util qw/first/; ... snip ... return first { ! $_->meta()->is_anon_class() } ($self->meta()->name(), $self->meta()->superclasses()); The workaround is fine, but kludgy: return first { ! $_->meta()->is_anon_class() && $_ !~ /MooseX::Traits::__ANON__/ } ($self->meta()->name(), $self->meta()->superclasses());
CC: undisclosed-recipients:;
Subject: Re: [rt.cpan.org #59284] is_anon_class is rendered useless by MooseX::Traits
Date: Mon, 12 Jul 2010 18:30:37 -0500
To: bug-MooseX-Traits [...] rt.cpan.org
From: Jonathan Rockway <jon [...] jrock.us>
We decided that this made debugging much easier. A stack dump where everything is anonymous is impossible to wade through. You should solve your immediate problem by adding a "log_name" field to your class' metaclass, default it to the normal name, and then make create_anon_class copy the log_name from the parent. That way, you can just say $instance->meta->log_name and always get the right answer ... no messy heuristics required. If you have questions, please ask on #moose :) --jrockway * On Mon, Jul 12 2010, Dan Harbin via RT wrote: Show quoted text
> Mon Jul 12 14:21:28 2010: Request 59284 was acted upon. > Transaction: Ticket created by dlharbin > Queue: MooseX-Traits > Subject: is_anon_class is rendered useless by MooseX::Traits > Broken in: 0.11 > Severity: Wishlist > Owner: Nobody > Requestors: dan.harbin@gmail.com > Status: new > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=59284 > > > > Why does MooseX::Traits generate its own ANON class names? This makes > Class::MOP::Class->is_anon_class useless. For example, I want to find > the first superclass that is not anonymous (for logging purposes): > > use List::Util qw/first/; > ... snip ... > return first { ! $_->meta()->is_anon_class() } ($self->meta()->name(), > $self->meta()->superclasses()); > > > The workaround is fine, but kludgy: > > return first { ! $_->meta()->is_anon_class() && $_ !~ > /MooseX::Traits::__ANON__/ } ($self->meta()->name(), > $self->meta()->superclasses()); >
-- print just => another => perl => hacker => if $,=$"
Subject: Re: [rt.cpan.org #59284] is_anon_class is rendered useless by MooseX::Traits
Date: Tue, 13 Jul 2010 02:37:03 +0300
To: bug-MooseX-Traits [...] rt.cpan.org
From: Yuval Kogman <nuffin [...] cpan.org>
Just override is_anon_class using a trait or something to make it DTRT then when composing the anon class. Maybe is_anon_class just needs to become an attribute in CMOP?