MouseX...Getopt(3pm)
π MouseX::Getopt::Meta::Attribute::Trait::NoGetopt(3pm) π
okay bestie, welcome to the perl corner of the internet β¨ this one lives in the User Contributed Perl Documentation collection, and it is so much simpler than that giant name makes it look, fr fr π
πΈ NAME πΈ
MouseX::Getopt::Meta::Attribute::Trait::NoGetopt β the optional meta attribute trait for when you wanna just... ignore a param π
Like, that's it. That's the whole job. It's giving "not my problem" energy and honestly? iconic π
β¨ SYNOPSIS β¨
okay so picture this, you got a package and you want MouseX::Getopt doing its thing, but there's ONE attribute you want it to keep its hands off of. Here's the move:
package App;
use Mouse;
with 'MouseX::Getopt';
has 'data' => (
traits => [ 'NoGetopt' ], # do not attempt to capture this param
is => 'ro',
isa => 'Str',
default => 'file.dat',
);
see that comment up there? # do not attempt to capture this param β that's the whole vibe of this module in one line, no cap π₯
π¦ DESCRIPTION π¦
So here's the tea β β this is a custom attribute metaclass trait, and what it does is let you say "hey, this specific attribute? do NOT let MouseX::Getopt process it" π
And the way you do that is genuinely so easy it's almost silly. All you gotta do is specify the NoGetopt metaclass trait, like:
has 'foo' => (traits => [ 'NoGetopt', ... ], ... );
boom. Done. That attribute is now off-limits to the getopt machinery and it will live its best quiet life π«Ά
tl;dr bestie: slap traits => [ 'NoGetopt' ] on the attribute you want skipped, and MouseX::Getopt will politely pretend it doesn't exist. periodt π
and that's the whole page!! π if you were wondering, this lil doc is from perl v5.32.1, dated 2021-09-16, and it's filed right here under MouseX...Getopt(3pm) in the User Contributed Perl Documentation π
mwah, go write some slay code, bestie πβ¨π§ββοΈ
π¦ 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