Test::Moose(3)
π Test::Moose β the manual page, but make it make sense π
okay so real talk: this is Test::Moose, from the User Contributed Perl Documentation section of your friendly neighbourhood man pages (that's section 3, bestie, iykyk). It's the little test-helper module for Moose-flavoured classes and it is so useful. Let's get into it π«Ά
β¨ NAME β¨
Test::Moose β test functions for Moose specific features. literally what it says on the tin π
π VERSION π
version 2.4001
πΈ SYNOPSIS πΈ
use Test::More plan => 1;
use Test::Moose;
meta_ok($class_or_obj, "... Foo has a ->meta");
does_ok($class_or_obj, $role, "... Foo does the Baz role");
has_attribute_ok($class_or_obj, $attr_name, "... Foo has the 'bar' attribute");
look at that. gorgeous. no notes ππ
π¦ DESCRIPTION π¦
This module hands you some genuinely useful test functions for classes built on Moose. It's described as an experimental first release, so comments and suggestions are very welcome β like pls, the author wants your feedback, don't be shy π₯Ί
π EXPORTED FUNCTIONS π
β meta_ok ($class_or_object)
Checks whether a class or an object actually has a metaclass. vibe check for metaclasses, essentially π«
β does_ok ($class_or_object, $role, ?$message)
Checks whether a class or object does a certain role. It's basically the same kind of energy as what isa_ok does for the isa method, except for roles π§
β has_attribute_ok($class_or_object, $attr_name, ?$message)
Checks whether a class or object has a certain attribute β same vibe as what can_ok does for methods, but for attributes π
β with_immutable { CODE } @class_names
Runs CODE β which should contain your normal, regular, everyday tests β twice, and makes each class in @class_names immutable in between the two runs. two runs, one glow-up β¨
The CODE block gets called with a single boolean argument telling you whether or not the classes have been made immutable yet. so your test code knows which lap it's on πββοΈ
π TODO π
- Convert the Moose test suite to use this module.
- Here is a list of possible functions to write:
- immutability predicates
- anon-class predicates
- discovering original method from modified method
- attribute metaclass predicates (
attribute_isa?)
not me reading a todo list and getting excited about future features π
π SEE ALSO π
Test::More
π BUGS π
See "BUGS" in Moose for the details on how to report bugs. go snitch, respectfully π
π― AUTHORS π―
- 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>
the whole squad showed up and they all ate ππ₯
π 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. free software, free vibes, zero drama π
ok that's the whole page, bestie β every flag-free function, every argument, every author, every word of the license, all present and accounted for. no cap π
and that's a wrap, bb π β brought to you by perl v5.44.0, dated 2026-10-17, formatting and all πΈβ¨
π¦ where this page comes from
- arch rolling: perl-moose 2.4001-2 Β· GPL-1.0-or-later AND Artistic-1.0-Perl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms