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

Re: Moose Type Constraints violations to warnings?

Thread Previous | Thread Next
From:
Buddy Burden
Date:
June 10, 2011 10:14
Subject:
Re: Moose Type Constraints violations to warnings?
Message ID:
BANLkTin+rvmFgSaMaVME_K134GLgVMfLZg@mail.gmail.com
Ovid,

On Fri, Jun 10, 2011 at 3:06 AM, Ovid <publiustemp-catalyst@yahoo.com> 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:

    http://www.mail-archive.com/moose@perl.org/msg01464.html

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


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