Re: Moose Type Constraints violations to warnings?

[email protected] (Buddy Burden)
Newsgroups perl.moose
Message-ID <[email protected]>
Ovid,

On Fri, Jun 10, 2011 at 3:06 AM, Ovid <[email protected]> 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/[email protected]/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
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.