Class::MOP::Attribute and legal attribute names

2009-04-13 Thread Dan Harbin
All, This email refers to an RT ticket I've filed that I think warrants some discussion (https://rt.cpan.org/Public/Bug/Display.html?id=44873). I've created a rudimentary ORM that maps attributes in a class to columns in a table and maps an instance of a class to a table row. This has proven

Re: Class::MOP::Attribute and legal attribute names

2009-04-13 Thread Hans Dieter Pearcey
On Mon, Apr 13, 2009 at 12:38:08PM -0500, Dan Harbin wrote: I'd like for the following validation in the Class::MOP::Attribute constructor to be removed:   (defined $name $name)   || confess You must provide a name for the attribute; Is there any reason Class::MOP::Attribute should

Re: Class::MOP::Attribute and legal attribute names

2009-04-13 Thread Darren Duncan
Dan Harbin wrote: For instance, I want a column named 0 (the number zero). While that is valid as a mysql column, that is invalid as an attribute name. The only reason I can fathom that 0 is prohibited from being an attribute name is because $obj-0 is invalid perl, but even so you can still

Re: Class::MOP::Attribute and legal attribute names

2009-04-13 Thread Dan Harbin
I've attached to the RT ticket some tests that Stevan was suggesting: https://rt.cpan.org/Ticket/Attachment/590690/299095/test.pl I'm not sure if it's comprehensive, but at least it's a start.  It uncovered the same (defined $name $name) check in:  * Class::MOP::Class::get_attribute  *

Moose::Util function for applying missing roles

2009-04-13 Thread Hans Dieter Pearcey
I added a note in the Moose::Meta::Role documentation yesterday to the effect that applying a role did not do any checks to make sure that the target had not already consumed the role you were attempting to apply. I always find myself writing apply role unless does role. Would anyone object to