Re: Moose Type Constraints violations to warnings?

[email protected] (Ovid)
Newsgroups perl.moose
Message-ID <[email protected]>
>________________________________
>From: Ovid <[email protected]>
>To: Moose <[email protected]>
>Sent: Friday, 10 June 2011, 12:06
>Subject: Moose Type Constraints violations to warnings?
>
>When I declare a parameter as follows:
>
>
>    has 'some_val' => (
>        is  => 'rw',
>        isa => 'Int',
>    );
> 
>Later if I do $object->some_value("foobar"), it blows up with a stack trace because of the type constraint violation.
>
>Without using signal handlers, is there some way I can convert that exception into a warning except when something like $ENV{HARNESS_ACTIVE} is true? Preferably on a per-attribute basis?

Naturally, despite searching beforehand, I found the answer ("no, you can't do that") immediately after I sent this:

    http://search.cpan.org/dist/Moose/lib/Moose/Manual/FAQ.pod#Can_I_turn_off_type_constraint_checking?

    Can I turn off type constraint checking?
    Not yet. This option may come in a future release.

Hopefully this email might at least spur discussion.

Cheers,
Ovid

--
Live and work overseas - http://overseas-exile.blogspot.com/
Buy the book           - http://www.oreilly.com/catalog/perlhks/
Tech blog              - http://blogs.perl.org/users/ovid/
Twitter                - http://twitter.com/OvidPerl/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.