1MouseX::Getopt::Dashes(U3spemr)Contributed Perl DocumentMaotuisoenX::Getopt::Dashes(3pm)
2
3
4
6 package My::App;
7 use Mouse;
8 with 'MouseX::Getopt::Dashes';
9
10 # Will be called as --some-thingy, not --some_thingy
11 has 'some_thingy' => (
12 is => 'ro',
13 isa => 'Str',
14 default => 'foo'
15 );
16
17 # Will be called as --another_thingy, not --another-thingy
18 has 'another_thingy' => (
19 traits => [ 'Getopt' ],
20 cmd_flag => 'another_thingy'
21 is => 'ro',
22 isa => 'Str',
23 default => 'foo'
24 );
25
26 # use as MouseX::Getopt
27
29 This is a version of "MouseX::Getopt" which converts underscores in
30 attribute names to dashes when generating command line flags.
31
32 You can selectively disable this on a per-attribute basis by supplying
33 a cmd_flag argument with the command flag you'd like for a given
34 attribute. No underscore to dash replacement will be done on the
35 "cmd_flag".
36
37
38
39perl v5.36.0 2022-07-22 MouseX::Getopt::Dashes(3pm)