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

Re: Moose Type Constraints violations to warnings?

Thread Previous | Thread Next
Buddy Burden
June 10, 2011 10:14
Re: Moose Type Constraints violations to warnings?
Message ID:

On Fri, Jun 10, 2011 at 3:06 AM, Ovid <> wrote:
> 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?

Is it possible that Jesse's answer to my question here:

could help?  I know it isn't exactly the same problem that you're
describing, but it seems that if there's a way to solve one, there
must be a way to solve the other as well.  Possibly the code of the
module he mentions would be illuminating.

Apologies if this isn't actually helpful.

            -- Buddy

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About