Moose::...seParent(3)
π NAME π
Moose::Cookbook::Basics::DateTime_ExtendingNonMooseParent β ok bestie, this is the one where we extend a parent class that is not Moose-based. The manual page itself lives at Moose::...seParent(3) in the User Contributed Perl Documentation section, and it's literally titled "Extending a non-Moose parent class". Periodt. π¦
β¨ VERSION β¨
version 2.4000 β yes she's on 2.4000, no cap. π
πΈ SYNOPSIS πΈ
Like, here's the whole vibe, verbatim, don't touch a single character:
package My::DateTime;
use Moose;
use MooseX::NonMoose;
use DateTime::Calendar::Mayan;
extends qw( DateTime );
has 'mayan_date' => (
is => 'ro',
isa => 'DateTime::Calendar::Mayan',
init_arg => undef,
lazy => 1,
builder => '_build_mayan_date',
clearer => '_clear_mayan_date',
predicate => 'has_mayan_date',
);
after 'set' => sub {
$_[0]->_clear_mayan_date;
};
sub _build_mayan_date {
DateTime::Calendar::Mayan->from_object( object => $_[0] );
}
Look at her. A whole Mayan calendar attribute riding shotgun on a DateTime subclass. Iconic behavior honestly. π
π DESCRIPTION π
So this recipe is a whole tutorial on how to use Moose to subclass a parent that is not Moose based. That's the tea. π΅
Important caveat, bestie, do NOT skip this: this recipe only works if the parent class uses a blessed hash reference for object instances. That's the hard requirement. If your parent is doing something funkier than that, you should check outMooseX::NonMoose::InsideOutandMooseX::InsideOutinstead. Fr fr.
The meat of this recipe β like, the actual substance, the protein of the whole thing β is contained in MooseX::NonMoose, which does all the grunt work for you. You just sit there and look pretty while it handles everything. π
π«Ά AUTHORS π«Ά
Shoutout to the whole friend group who made this happen, in order:
- 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>
Ten whole legends. The way that they all showed up for this one cookbook recipeβ¦ main character energy from every single one of them. ππ
β 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. So like, go off, remix it, slay. π§
And that's the whole page, bestie! This one shipped as perl v5.42.0, dated 2025-07-25, living under the name Moose::...seParent(3). Mwah, ily, go extend something that isn't Moose. πβ¨
π¦ 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