MouseX...:Trait(3pm)
π MouseX::Getopt::Meta::Attribute::Trait(3pm) π
okay so bestie, this is a page from the User Contributed Perl Documentation, and it's all about MouseX::Getopt::Meta::Attribute::Trait β the optional meta attribute trait that lets you name your own command line options instead of letting the computer pick for you. she's giving custom option names and honestly? iconic. π
β¨ NAME β¨
MouseX::Getopt::Meta::Attribute::Trait β optional meta attribute trait for custom option names π
πΈ SYNOPSIS πΈ
package App;
use Mouse;
with 'MouseX::Getopt';
has 'data' => (
traits => [ 'Getopt' ],
is => 'ro',
isa => 'Str',
default => 'file.dat',
# tells MouseX::Getopt to use --somedata as the
# command line flag instead of the normal
# autogenerated one (--data)
cmd_flag => 'somedata',
# tells MouseX::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',
);
like. look at her. she's literally telling MouseX::Getopt "no babe, I pick the flag name" and MouseX::Getopt is like "okay periodt" π«Ά
π¦ DESCRIPTION π¦
This is a custom attribute metaclass trait, and what it does is let you specify the specific command line flag to use β instead of the default one that MouseX::Getopt would just... make up for you. rude of it, honestly. so you take the wheel. π
β cmd_flag
Changes the commandline flag to be this value, instead of the default β and the default is literally just the same as the attribute name. no cap. so if you don't set this, your attribute name is your flag. that's the whole vibe.
π cmd_aliases
Adds more aliases for this commandline flag! super useful for short options and such β you know, the little single-letter guys. one flag, many names. main character energy, she contains multitudes. π
π§ has_cmd_flag
π§ has_cmd_aliases
(yes bestie, those two are just... listed. they exist. the manpage says so and I do not make the rules. πΈ)
π«Ά reminder: don't sleep oncmd_aliasesβ a plain scalar gets you one alias, and an arrayref like[qw/ moosedata m d /]gets you the whole squad. pick your fighter.
and that's the whole page, bestie!! you ate. no crumbs left. π β¨
this was perl v5.32.1, dated 2021-09-16 β shouting out the source and the date, mwah π
π¦ where this page comes from
- debian bookworm: libmousex-getopt-perl 0.38-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu jammy: libmousex-getopt-perl 0.38-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libmousex-getopt-perl 0.38-2 Β· 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