MooX::late(3pm)

πŸ“¦
version 0.100 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– MooX::late β€” bestie edition πŸ’–

okay so this is the MooX::late manual page, from the User Contributed Perl Documentation section. sit down, grab a boba, we're translating Moose code to Moo and it's gonna be so good.


✨ NAME ✨

MooX::late β€” the lowkey easiest way to translate Moose code to Moo πŸ¦‹


🌸 SYNOPSIS 🌸

package Foo;
use Moo;
use MooX::late;
has bar => (is => "ro", isa => "Str", default => "MacLaren's Pub");

(there's more examples for Moo roles further down, keep reading bestie)


πŸ’… DESCRIPTION πŸ’…

So Moo is this light-weight object oriented programming framework, right? And it wants to be compatible with Moose. The way it does that is by noticing when Moose has been loaded, and then automatically "inflating" its classes and roles up into full Moose classes and roles. Which means Moo classes can consume Moose roles, Moose classes can extend Moo classes, and so on and so forth. it's giving ecosystem harmony ✨

But. 😭 The surface syntax of Moo is a little different from Moose. Example: the isa option when you're defining attributes in Moose has to be either a string or a blessed Moose::Meta::TypeConstraint object. But in Moo? It has to be a coderef. These lil surface-syntax differences make porting code from Moose to Moo potentially tricky, and nobody has time for that. So MooX::late rolls up and helps out by enabling a slightly more Moosey surface syntax. 🫢

Here's the tea on what MooX::late does:

  1. Supports isa => $stringytype.
  2. Supports does => $rolename .
  3. Supports lazy_build => 1.
  4. Exports blessed and confess functions to your namespace.
  5. Handles native attribute traits.

Five features. βœ‹ That's it. It is not the aim of MooX::late to make every single aspect of Moo behave exactly identically to Moose. It's just going after the low-hanging fruit, okay? So it does five things right now, and I promise that future versions will never do more than seven. (iconic promise tbh πŸ’€)

Also, previous releases of MooX::late added support for coerce => 1 and default => $nonref. Those features have now been added to Moo itself, so MooX::late no longer has to deal with them. slay, we love a glow-up that removes work ✨

🧚 Use in Moo::Roles 🧚

MooX::late should work in Moo::Roles, with no particular caveats. no cap!

package MyRole;
use Moo::Role;
use MooX::late;

Package::Variant can be used to build the Moo equivalent of parameterized roles. And MooX::late should work in roles built with Package::Variant.

use Package::Variant
   importing => [ qw( Moo::Role MooX::late ) ],
   subs      => [ qw( has with ) ];

πŸ”₯ Type constraints πŸ”₯

Type constraint strings are interpreted using Type::Parser, using the type constraints defined in Types::Standard. This provides a very slight superset of Moose's type constraint syntax and built-in type constraints. so you get a lil extra, as a treat πŸ“

Any unrecognized string that looks like it might be a class name is interpreted as a class type constraint. iykyk πŸ’…

πŸŽ€ Subclassing πŸŽ€

MooX::late is designed to be reasonably easy to subclass. There are comments in the source code explaining hooks for extensibility. go forth and extend, bestie πŸ’œ


πŸ’€ BUGS πŸ’€

Please report any bugs to <http://rt.cpan.org/Dist/Display.html?Queue=MooX-late>. (not me asking you to file a ticket, but like, do it fr fr πŸ™ˆ)


πŸ‘‘ SEE ALSO πŸ‘‘

MooX::late uses Types::Standard to check type constraints.

MooX::late uses Sub::HandlesVia to provide native attribute traits support.

The following modules bring additional Moose functionality to Moo, beyond what MooX::late offers:

  • MooX::Override - support override/super
  • MooX::Augment - support augment/inner

Moo allows you to load Moo plus multiple MooX extension modules in a single line. one line!! efficiency queen 🌈


🌟 AUTHOR 🌟

Toby Inkster <tobyink@cpan.org>.


This software is copyright (c) 2012-2014, 2019 by Toby Inkster.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.


🚨 DISCLAIMER OF WARRANTIES 🚨

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

like, no promises, bestie, it's all vibes and no guarantees 😭


and that's the whole page!! periodt πŸ’…βœ¨ this was MooX::late, from perl v5.36.0, dated 2022-11-27, and it lives in the User Contributed Perl Documentation section πŸŽ€πŸ¦‹πŸ’œ

πŸ“¦ where this page comes from