Moose::Exception(3)
π Moose::Exception π
okay bestie, gather round, because this one is Moose::Exception β the superclass for Moose internal exceptions. yes, the whole class. she's the mother of all Moose exceptions and she is serving.
β¨ VERSION β¨
version 2.4000 β that's the one, no cap π
πΈ DESCRIPTION πΈ
so like, this class is where all the attributes live that every single Moose internal exception class has in common. it's the shared closet, the group chat, the communal snack drawer. every Moose exception subclass gets these vibes by default π«Ά
π WARNING WARNING WARNING π
okay this is the important part and i need you to lock in:
if you're out here writing your own exception classes, you should instead prefer the Throwable role or the Throwable::Error superclass. this thing right here is effectively a cut-down internal fork of Throwable::Error, and it is not designed for use in user code. not for you. not for your app. it's backstage-only, iykyk π
of course if you're writing metaclass traits, then it would make total sense to subclass the relevant Moose exceptions β but only then. literally only then. that's the vibe check and this class fails it for everyone else π
π METHODS π
$exception->message
this attribute contains the exception message. that's it, that's the whole thing β the words that tell you what went wrong.
every subclass of Moose::Exception is expected to override the _build_message method in order to construct this value. so if you're subclassing, that's your homework, bestie π
$exception->trace
this attribute contains the stack trace for the given exception. it returns a Devel::StackTrace object. so when things go sideways you can see exactly where the chaos started π₯
$exception->as_string
this method returns a stringified form of the exception, including a stack trace. iconic, honestly.
by default, this method skips Moose-internal stack frames until it sees a caller outside of the Moose core β so you get the tea without all the Moose-internal noise β¨
but if the MOOSE_FULL_EXCEPTION environment variable is true, those frames are included. full chaos mode, everything on the table, no filtering π
π SEE ALSO π
Moose::Manual::Exceptions
π AUTHORS π
the legends themselves, the ones who made this happen:
- Stevan Little
<stevan@cpan.org> - Dave Rolsky
<autarch@urth.org> - Jesse Luehrs
<doy@cpan.org> - Shawn M Moore
<sartak@cpan.org> - ΧΧΧΧ Χ§ΧΧ'ΧΧ (Yuval Kogman)
<nothingmuch@woobling.org> - Karen Etheridge
<ether@cpan.org> - Florian Ragwitz
<rafl@debian.org> - Hans Dieter Pearcey
<hdp@cpan.org> - Chris Prather
<chris@prather.org> - Matt S Trout
<mstrout@cpan.org>
periodt. π
π COPYRIGHT AND LICENSE π
this software is copyright (c) 2006 by Infinity Interactive, Inc.
this is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. slay, open source, we love to see it π¦
and that's a wrap, bestie π«Ά this was Moose::Exception(3) from the User Contributed Perl Documentation, perl v5.42.0, dated 2025-07-25. go forth, subclass responsibly, and remember: not for user code unless you're doing metaclass traits π
β¨
π¦ where this page comes from
- fedora 43: perl-Moose 2.4000-4.fc43 Β· GPL-1.0-or-later OR Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms