MooseX...:Trait(3pm)
π MooseX::Getopt::Meta::Attribute::Trait π
okay bestie, welcome to the manual page for MooseX::Getopt::Meta::Attribute::Trait β that's the name, that's the whole vibe, and yes it is long. It ships as part of the User Contributed Perl Documentation, so you know it's community-made with love. β¨
It's the optional meta attribute trait for custom option names. Basically: you want your command line flags to be called something other than what Moose auto-picks for you? This is the girl for the job. π
πΈ VERSION πΈ
version 0.78 β periodt.
π¦ SYNOPSIS π¦
package App;
use Moose;
with 'MooseX::Getopt';
has 'data' => (
traits => [ 'Getopt' ],
is => 'ro',
isa => 'Str',
default => 'file.dat',
# tells MooseX::Getopt to use --somedata as the
# command line flag instead of the normal
# autogenerated one (--data)
cmd_flag => 'somedata',
# tells MooseX::Getopt to also allow --moosedata,
# -m, and -d as aliases for this same option on
# the commandline.
cmd_aliases => [qw/ moosedata m d /],
# Or, you can use a plain scalar for a single alias:
cmd_aliases => 'm',
);
β¨ DESCRIPTION β¨
So here's the tea β: this is a custom attribute metaclass trait. You use it to say exactly which command line flag you want, instead of just letting MooseX::Getopt cook up the default one for you. You're the main character, you pick your own flag names. π
π METHODS π
cmd_flag
Changes the command-line flag to be this value, instead of the default. And what's the default, you ask? It's the same as the attribute name. Simple as that. π
cmd_aliases
Adds more aliases for this command-line flag. Super useful for short options and such β you know, the little single-letter girlies. π
has_cmd_flag
has_cmd_aliases
π«Ά SUPPORT π«Ά
Got bugs? π Don't suffer in silence, submit them through the RT bug tracker:
- <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Getopt>
- or email <bug-MooseX-Getopt@rt.cpan.org>
There's also a mailing list for users of this distribution, hanging out at <http://lists.perl.org/list/moose.html>. π¬
And if you wanna chat live, there's an irc channel for users of this distribution: #moose on irc.perl.org β <irc://irc.perl.org/#moose>. Come say hi, iykyk. π¬
π AUTHOR π
Stevan Little <stevan@iinteractive.com> β icon, legend, the moment.
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2007 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. ποΈ
and that's the whole page bestie!! this was documented with perl v5.40.0 on 2025-01-11 β go forth and name your flags whatever your heart desires πβ¨π
π¦ where this page comes from
- debian trixie: libmoosex-getopt-perl 0.78-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libmoosex-getopt-perl 0.78-1 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libmoosex-getopt-perl 0.78-1 Β· 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