MooseX:...:Custom(3)
π MooseX::Extended::Role::Custom π
okay bestie, so this page is all about MooseX::Extended::Role::Custom β a lil manual for building your very own custom Moose::Role. just for you. nobody else. main character energy fr.
β¨ NAME β¨
MooseX::Extended::Role::Custom β build a custom Moose::Role, just for you. π
πΈ VERSION πΈ
version 0.35
π¦ SYNOPSIS π¦
okay so step one: define your own version of MooseX::Extended. literally just:
package My::Moose::Role {
use MooseX::Extended::Role::Custom;
sub import {
my ( $class, %args ) = @_;
MooseX::Extended::Role::Custom->create(
excludes => [qw/ carp /],
includes => ['multi'],
%args # you need this to allow customization of your customization
);
}
}
# no need for a true value
no cap, you genuinely do not need a true value at the end there. she's already slaying. π
and then you use it, like:
package Some::Class::Role {
use My::Moose::Role types => [qw/ArrayRef Num/];
param numbers => ( isa => ArrayRef[Num] );
multi sub foo ($self) { ... }
multi sub foo ($self, $bar) { ... }
}
ate. periodt. π
π DESCRIPTION π
okay so, real talk: I hate boilerplate, so let's get rid of it. be gone. not me writing the same setup over and over π
so let's say you don't want warnings on classes implicitly overriding role methods, you don't want namespace::autoclean, and you don't want carp β but you do want multi. plus, you've got your own custom versions of carp and croak. here's what that looks like:
package Some::Class {
use MooseX::Extended
excludes => [qw/ WarnOnConflict autoclean carp /],
includes => ['multi'];
use My::Carp q(carp croak);
... my code here
}
and likeβ¦ you probably get tired of typing that every single time, right? honestly valid. but now you don't have to. π«Ά
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, literally everything is set up for you already. iconic behavior honestly β¨
and if you need to change this on a per class basis:
use My::Moose
excludes => ['carp'],
types => [qw/ArrayRef Num/];
so the way that works: the above changes your excludes and adds types, but it does not change your includes. iykyk. π
π AUTHOR π
Curtis "Ovid" Poe <curtis.poe@gmail.com> β king behavior π
π 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)
and that's the whole vibe check, bestie π this was perl v5.42.0, dated 2025-07-25, and the manual name is MooseX:...:Custom(3) β thanks for reading, mwah πβ¨π¦
π¦ 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