1MouseX::Getopt::Meta::AUtsterribCuotnet(r3ipbmu)ted PerlMoDuosceuXm:e:nGteattoipotn::Meta::Attribute(3pm)
2
3
4

SYNOPSIS

6         package App;
7         use Mouse;
8
9         with 'MouseX::Getopt';
10
11         has 'data' => (
12             metaclass => 'MouseX::Getopt::Meta::Attribute',
13             is        => 'ro',
14             isa       => 'Str',
15             default   => 'file.dat',
16
17             # tells MouseX::Getopt to use --somedata as the
18             # command line flag instead of the normal
19             # autogenerated one (--data)
20             cmd_flag  => 'somedata',
21
22             # tells MouseX::Getopt to also allow --moosedata,
23             # -m, and -d as aliases for this same option on
24             # the commandline.
25             cmd_aliases => [qw/ moosedata m d /],
26
27             # Or, you can use a plain scalar for a single alias:
28             cmd_aliases => 'm',
29         );
30

DESCRIPTION

32       This is a custom attribute metaclass which can be used to specify a the
33       specific command line flag to use instead of the default one which
34       MouseX::Getopt will create for you.
35
36       This is certainly not the prettiest way to go about this, but for now
37       it works for those who might need such a feature.
38
39   Custom Metaclass alias
40       This now takes advantage of the Moose 0.19 feature to support custom
41       attribute metaclass aliases. This means you can also use this as the
42       Getopt alias, like so:
43
44         has 'foo' => (metaclass => 'Getopt', cmd_flag => 'f');
45
46       cmd_flag
47           Changes the commandline flag to be this value, instead of the
48           default, which is the same as the attribute name.
49
50       cmd_aliases
51           Adds more aliases for this commandline flag, useful for short
52           options and such.
53
54       has_cmd_flag
55       has_cmd_aliases
56
57
58
59perl v5.32.0                      2020-07-2M8ouseX::Getopt::Meta::Attribute(3pm)
Impressum