develooper Front page | perl.moose | Postings from June 2011

Feedback request for suggested changes in Moose.git/topic/validation-passthrough-objects

From:
Kent Fredric
Date:
June 20, 2011 19:13
Subject:
Feedback request for suggested changes in Moose.git/topic/validation-passthrough-objects
Message ID:
BANLkTikxdboXvxgOAqoj-6zZPmu2LpjhQg@mail.gmail.com
Hi.

I've pushed some suggested changes as
'topic/validation-passthrough-objects' for Moose::Meta::Attribute to
permit the validation phase to pass-through any results from type
constraints 'get_message' function if they so happen to be objects (
or any other kind of ref ).

The idea is that we can be permitted to create more deeply structured
validation failures ( ie: Exception Objects ) that more accurately
describe why the validation failed.

This is more pertinent with nested/parametrized type constraints.

Presently, no native type constraints throw exceptions, and the system
relies completely on string error messages.

I have, alternatively, a module that will hack this behaviour on to
attributes on a case-by-case basis (
http://search.cpan.org/dist/MooseX-Attribute-ValidateWithException/ )
but I'd much rather do away with that forever and make something much
more powerful and practical as part of Moose itself.

Critique welcome.

For those who do not wish to have to use git directly to see the
proposed changes, here is a link to the diff on github:

https://github.com/moose/moose/compare/master...topic/validation-passthrough-objects

-- 
Kentnl



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About