So this particular case is likely fixable, so please do submit a bug report on it.

Let me also say that we (the moose devs) know the error handling in Moose is not ideal and could be improved. However, Moose is unlike your typical CPAN module because of how deep it goes into your code. So while we know it is not ideal, fixing this is pretty non-trivial and so we opt to give the user the most information possible (the stack trace) rather then leaving you with not enough information.

The real issue is that it is often very difficult for Moose to divine the intention of the user from the error condition that is thrown. And further still, the context in which the error occurs can be nowhere near the actual source of the error, and going from context to intent is often times just impossible. Doing this kind of error handling inside a library is very difficult, often times you can only get this kind of contextually sensitive error handling in a parser/lexer/compiler (and even then, not always, just ask anyone who has done any serious Haskell programming).

So, regarding your code. There is a Moose::Error subsystem which will allow to replace the default confess stack trace with the less verbose croak or even write your own error handler (see Moose::Error::Croak for some details). For a more generic solution to the issue you might want to take a look at that.

-stvn

In reply to Re: Moose warnings by stvn
in thread Moose warnings by bobr

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.