MouseX...Dashes(3pm)
NAME β¨
Hey bestie, welcome to MouseX::Getopt::Dashes(3pm) β the header shortens it to MouseX...Dashes(3pm), and it lives in the User Contributed Perl Documentation. It's giving convert underscores in attribute names to dashes π
no cap.
SYNOPSIS π
Okay so here's the whole vibe:
package My::App;
use Mouse;
with 'MouseX::Getopt::Dashes';
# Will be called as --some-thingy, not --some_thingy
has 'some_thingy' => (
is => 'ro',
isa => 'Str',
default => 'foo'
);
# Will be called as --another_thingy, not --another-thingy
has 'another_thingy' => (
traits => [ 'Getopt' ],
cmd_flag => 'another_thingy'
is => 'ro',
isa => 'Str',
default => 'foo'
);
# use as MouseX::Getopt
DESCRIPTION π¦
Okay so this is a version of MouseX::Getopt that converts underscores in attribute names to dashes when it's generating command line flags. So like, some_thingy can show up as --some-thingy instead of --some_thingy, and that's literally the whole point. π
You can selectively disable this on a per-attribute basis by supplying a cmd_flag argument with the command flag you'd like for a given attribute. And bestie, listen: no underscore to dash replacement will be done on the cmd_flag. So if you set it, it stays exactly how you wrote it. periodt.
That's the little caveat: the cmd_flag itself does not get the underscore-to-dash glow-up. π
mwah π this page came from the User Contributed Perl Documentation, it's running on perl v5.32.1, and it's dated 2021-09-16. bye bestie, go slay those flags π«Άπ
π¦ 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