MooseX:...:Custom(3)
π MooseX::Extended::Custom π
okay bestie, so this is MooseX:...:Custom(3) from the User Contributed Perl Documentation set β the manual page for MooseX::Extended::Custom. it's giving build-your-own-Moose, and honestly? iconic. π
β¨ NAME β¨
MooseX::Extended::Custom β Build a custom Moose, just for you. π
like, your Moose. bespoke. one of one. no cap.
πΈ VERSION πΈ
version 0.35 β that's the one we're vibing with rn. π¦
π SYNOPSIS π
okay so step one: you define your own version of MooseX::Extended, and it looks like this:
package My::Moose {
use MooseX::Extended::Custom;
sub import {
my ( $class, %args ) = @_;
MooseX::Extended::Custom->create(
excludes => [qw/ StrictConstructor c3 /],
includes => ['multi'],
%args # you need this to allow customization of your customization
);
}
}
# no need for a true value
bestie the # no need for a true value comment?? that's the whole personality. no 1; required. slay. β¨
And then β step two β you actually use it:
package Some::Class {
use My::Moose types => [qw/ArrayRef Num/];
param numbers ( isa => ArrayRef[Num] );
multi sub foo ($self) { ... }
multi sub foo ($self, $bar) { ... }
}
look at those multi subs. look at them. π«Ά
π DESCRIPTION π
I hate boilerplate, so let's get rid of it. ποΈβ¨ fr fr, boilerplate is the enemy and this module is the main character who defeats it.
so let's say β hypothetically, for the plot β that you don't want namespace::autoclean or "carp", but you do want "multi". and also you've got your own custom versions of "carp" and "croak". then it'd look like this:
package Some::Class {
use MooseX::Extended
excludes => [qw/ autoclean carp /],
includes => ['multi'];
use My::Carp q(carp croak);
... my code here
}
ngl you're probably getting SO tired of typing that every single time. π and likeβ¦ now you don't have to?? because:
package My::Moose {
use MooseX::Extended::Custom;
use My::Carp ();
use Import::Into;
sub import {
my ( $class, %args ) = @_;
my $target_class = caller;
MooseX::Extended::Custom->create(
excludes => [qw/ autoclean carp /],
includes => ['multi'],
%args # you need this to allow customization of your customization
);
My::Carp->import::into($target_class, qw(carp croak));
}
}
and then when you use "My::Moose", all of that is already set up for you. no extra typing. no copy-paste crimes. just vibes. π
π¦ per-class customization π¦
but wait, there's more β if you need to change this on a "per class" basis:
use My::Moose
excludes => ['carp'],
types => [qw/ArrayRef Num/];
The above changes your "excludes" and adds "types", but doesn't change your "includes". periodt. π
π AUTHOR π
Curtis "Ovid" Poe <curtis.poe@gmail.com> π
β COPYRIGHT AND LICENSE β
This software is Copyright (c) 2022 by Curtis "Ovid" Poe.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
okay and that's the whole page bestie!! π this was perl v5.42.0, dated 2025-07-25, and it's the MooseX:...:Custom(3) page from User Contributed Perl Documentation. go forth and build your custom Moose. it's giving main character energy. π
β¨π«Ά
π¦ where this page comes from
- fedora 43: perl-MooseX-Extended 0.35-6.fc43 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms