[Catalyst] Attribute::Handlers wont work in own classes under
catalyst
Brian Cassidy
brian.cassidy at nald.ca
Wed Aug 29 19:11:37 GMT 2007
Felix Antonius Wilhelm Ostmann wrote:
> we have build some classes with Attribute::Handlers (was inspired from
> Attribute::Property)
>
> This works realy fine!
>
> after a few tests we gone use this classes under catalyst ... and ...
> dont work :-/ under catalyst our classes dont use Attribute::Handlers
> :-/ we declare UNIVERSAL::Property and then use "sub nondigit : Property
> { defined && !m{[0-9]} }" (see the code)
>
> then you can call: $obj->nondigit(4) and it will croak or
> $obj->nondigit("car") and it will set the object-property nondigit to
> "car".
I'm gonna stop right here because it seems like you're trying to
re-invent Moose in some round-about way.
Take a look at the simple "Point" example [1] plus the docs for
TypeConstraints [2].
I'd trying to help with your existing code, but it makes my eyes bleed. :)
-Brian
[1] http://search.cpan.org/~stevan/Moose-0.25/lib/Moose/Cookbook/Recipe1.pod
[2]
http://search.cpan.org/~stevan/Moose-0.25/lib/Moose/Util/TypeConstraints.pm
More information about the Catalyst
mailing list