1MooseX::Getopt::Meta::AUtsterribCuotnet(r3i)buted Perl DMoocousmeeXn:t:aGteitoonpt::Meta::Attribute(3)
2
3
4
6 MooseX::Getopt::Meta::Attribute - Optional meta attribute for custom
7 option names
8
10 package App;
11 use Moose;
12
13 with 'MooseX::Getopt';
14
15 has 'data' => (
16 metaclass => 'MooseX::Getopt::Meta::Attribute',
17 is => 'ro',
18 isa => 'Str',
19 default => 'file.dat',
20
21 # tells MooseX::Getopt to use --somedata as the
22 # command line flag instead of the normal
23 # autogenerated one (--data)
24 cmd_flag => 'somedata',
25
26 # tells MooseX::Getopt to also allow --moosedata,
27 # -m, and -d as aliases for this same option on
28 # the commandline.
29 cmd_aliases => [qw/ moosedata m d /],
30
31 # Or, you can use a plain scalar for a single alias:
32 cmd_aliases => 'm',
33 );
34
36 This is a custom attribute metaclass which can be used to specify a the
37 specific command line flag to use instead of the default one which Moo‐
38 seX::Getopt will create for you.
39
40 This is certainly not the prettiest way to go about this, but for now
41 it works for those who might need such a feature.
42
43 Custom Metaclass alias
44
45 This now takes advantage of the Moose 0.19 feature to support custom
46 attribute metaclass aliases. This means you can also use this as the
47 Getopt alias, like so:
48
49 has 'foo' => (metaclass => 'Getopt', cmd_flag => 'f');
50
52 These methods are of little use to most users, they are used interally
53 within MooseX::Getopt.
54
55 cmd_flag
56 Changes the commandline flag to be this value, instead of the
57 default, which is the same as the attribute name.
58
59 cmd_aliases
60 Adds more aliases for this commandline flag, useful for short
61 options and such.
62
63 has_cmd_flag
64 has_cmd_aliases
65 meta
66
68 All complex software has bugs lurking in it, and this module is no
69 exception. If you find a bug please either email me, or add the bug to
70 cpan-RT.
71
73 Stevan Little <stevan@iinteractive.com>
74
75 Brandon L. Black, <blblack@gmail.com>
76
78 Copyright 2007 by Infinity Interactive, Inc.
79
80 <http://www.iinteractive.com>
81
82 This library is free software; you can redistribute it and/or modify it
83 under the same terms as Perl itself.
84
85
86
87perl v5.8.8 2007-08-10MooseX::Getopt::Meta::Attribute(3)