MooseX...nitArg(3pm)
π NAME π
MooseX::MultiInitArg β it's giving attributes with aliases for constructor arguments. bestie, one attribute, many names. iconic behavior honestly.
β¨ SYNOPSIS β¨
package Thinger;
use Moose;
use MooseX::MultiInitArg;
has 'data' => (
metaclass => 'MultiInitArg',
# For composability, you could use the following:
# traits => ['MooseX::MultiInitArg::Trait'],
is => 'ro',
isa => 'Str',
init_args => [qw(munge frobnicate)],
);
package main;
# All these are equivalent
my $foo = Thinger->new(data => 'foo');
my $foo = Thinger->new(munge => 'foo');
my $foo = Thinger->new(frobnicate => 'foo');
all three of those? same thing. literally the same object. no cap. π¦
πΈ DESCRIPTION πΈ
okay so picture this: you've ever wanted to be able to call an attribute any number of things while you're passing arguments to your object constructor? Now You Can. π periodt.
the primary motivator β and this is the real tea π β is that the author had some attributes that were named inconsistently, and wanted to rename them without breaking backwards compatibility with the existing API. the way that's such a mood. main character energy from a metaclass fr fr.
π AUTHOR π
Paul Driver, "<frodwith at cpan.org>" π«Ά
π COPYRIGHT AND LICENSE π
Copyright 2007-2013 by Paul Driver.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. π
and that's the whole page bestie, you ate it up ππ
this little beauty came to you via perl v5.34.0, dated 2022-06-15, filed under MooseX...nitArg(3pm) β go forth and alias your init args, queen πβ¨
π¦ where this page comes from
- debian bookworm: libmoosex-multiinitarg-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libmoosex-multiinitarg-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmoosex-multiinitarg-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmoosex-multiinitarg-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmoosex-multiinitarg-perl 0.02-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms