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

NAME

6       MooseX::Getopt::Meta::Attribute - Optional meta attribute for custom
7       option names
8

VERSION

10       version 0.75
11

SYNOPSIS

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

DESCRIPTION

39       This is a custom attribute metaclass which can be used to specify a the
40       specific command line flag to use instead of the default one which
41       MooseX::Getopt will create for you.
42
43       This is certainly not the prettiest way to go about this, but for now
44       it works for those who might need such a feature.
45
46   Use 'traits' instead of 'metaclass'
47       You should rarely need to explicitly set the attribute metaclass. It is
48       much preferred to simply provide a trait (a role applied to the
49       attribute metaclass), which allows other code to further modify the
50       attribute by applying additional roles.
51
52       Therefore, you should first try to do this:
53
54         has 'foo' => (traits => ['Getopt'], cmd_flag => 'f');
55
56   Custom Metaclass alias
57       This now takes advantage of the Moose 0.19 feature to support custom
58       attribute metaclass aliases. This means you can also use this as the
59       Getopt alias, like so:
60
61         has 'foo' => (metaclass => 'Getopt', cmd_flag => 'f');
62

METHODS

64   cmd_flag
65       Changes the command-line flag to be this value, instead of the default,
66       which is the same as the attribute name.
67
68   cmd_aliases
69       Adds more aliases for this command-line flag, useful for short options
70       and such.
71
72   has_cmd_flag
73   has_cmd_aliases

SUPPORT

75       Bugs may be submitted through the RT bug tracker
76       <https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Getopt> (or
77       bug-MooseX-Getopt@rt.cpan.org <mailto:bug-MooseX-Getopt@rt.cpan.org>).
78
79       There is also a mailing list available for users of this distribution,
80       at <http://lists.perl.org/list/moose.html>.
81
82       There is also an irc channel available for users of this distribution,
83       at "#moose" on "irc.perl.org" <irc://irc.perl.org/#moose>.
84

AUTHOR

86       Stevan Little <stevan@iinteractive.com>
87
89       This software is copyright (c) 2007 by Infinity Interactive, Inc.
90
91       This is free software; you can redistribute it and/or modify it under
92       the same terms as the Perl 5 programming language system itself.
93
94
95
96perl v5.36.0                      2023-01-2M0ooseX::Getopt::Meta::Attribute(3pm)
Impressum