Mouse::Spec(3pm)

Okay bestie, welcome to Mouse::Spec(3pm) from the User Contributed Perl Documentation β€” it's the compatibility receipt for Mouse vs Moose. Let's get into the group chat πŸ’…βœ¨

πŸ’– NAME πŸ’–

Mouse::Spec β€” To what extent Mouse is compatible with Moose.

✨ VERSION ✨

This document describes Mouse version v2.6.2 β€” yes, that exact version, no cap.

🧚 SYNOPSIS 🧚

Run this little icon:

use Mouse::Spec;

printf "Mouse/%s is compatible with Moose/%s\n",
    Mouse::Spec->MouseVersion, Mouse::Spec->MooseVersion;

πŸ¦‹ DESCRIPTION πŸ¦‹

Mouse is a subset of Moose. This doc is here to tell you to what extent Mouse is compatible (and incompatible) with Moose. Buckle up πŸŽ€

🍬 Compatibility with Moose 🍬

Sugary APIs

The sugary APIs are highly compatible with Moose. Methods that have the same name as Moose's are expected to be compatible with Moose's. Slay.

Meta object protocols

Meta object protocols are a subset of the counterpart of Moose. Their methods that have the same name as Moose's are expected to be compatible with Moose's. Feel free to use these methods even if they're not documented β€” yes, even the undocumented ones, iykyk.

However, there are differences between Moose's MOP and Mouse's. For example, meta object protocols in Mouse have no attributes by default, so $metaclass->meta->make_immutable() will not work as you expect. Do not make metaclasses immutable β€” the original page says β€œDon not make metaclasses immutable,” and either way the warning stands πŸ™ˆ.

Mouse::Meta::Instance

Meta instance mechanism is not implemented, so you cannot change the reftype of Mouse objects in the same way as Moose. No cap, that's just not a thing here.

Role exclusion

Role exclusion, exclude(), is not implemented. It's giving β€œwe don't have that.”

-metaclass in Mouse::Exporter

use Mouse -metaclass => ... are not implemented. Use use Mouse -traits => ... instead. That's the move πŸ’…

Mouse::Meta::Attribute::Native

Native traits are not supported directly, but MouseX::NativeTraits is available on CPAN. Once you have installed it, you can use it as the same way in Moose. That is, native traits are automatically loaded by Mouse.

See MouseX::NativeTraits for details. Obsessed.

πŸ“š Notes about Moose::Cookbook πŸ“š

Many recipes in Moose::Cookbook fit Mouse, including:

  • Moose::Cookbook::Basics::Recipe1 β€” The (always classic) Point example
  • Moose::Cookbook::Basics::Recipe2 β€” A simple BankAccount example
  • Moose::Cookbook::Basics::Recipe3 β€” A lazy BinaryTree example
  • Moose::Cookbook::Basics::Recipe4 β€” Subtypes, and modeling a simple Company class hierarchy
  • Moose::Cookbook::Basics::Recipe5 β€” More subtypes, coercion in a Request class
  • Moose::Cookbook::Basics::Recipe6 β€” The augment/inner example
  • Moose::Cookbook::Basics::Recipe7 β€” Making Moose fast with immutable
  • Moose::Cookbook::Basics::Recipe8 β€” Builder methods and lazy_build
  • Moose::Cookbook::Basics::Recipe9 β€” Operator overloading, subtypes, and coercion
  • Moose::Cookbook::Basics::Recipe10 β€” Using BUILDARGS and BUILD to hook into object construction
  • Moose::Cookbook::Roles::Recipe1 β€” The Moose::Role example
  • Moose::Cookbook::Roles::Recipe2 β€” Advanced Role Composition - method exclusion and aliasing
  • Moose::Cookbook::Roles::Recipe3 β€” Applying a role to an object instance
  • Moose::Cookbook::Meta::Recipe2 β€” A meta-attribute, attributes with labels
  • Moose::Cookbook::Meta::Recipe3 β€” Labels implemented via attribute traits
  • Moose::Cookbook::Extending::Recipe3 β€” Providing an alternate base object class

πŸ‘‘ SEE ALSO πŸ‘‘

Go peek at these:

  • Mouse
  • Moose
  • Moose::Manual
  • Moose::Cookbook

πŸ’– That's the teaaa, bestie: this page came from perl v5.42.2 on 2026-04-21. Stay iconic! πŸ’–

πŸ“¦ where this page comes from