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
38 MooseX::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 This now takes advantage of the Moose 0.19 feature to support custom
45 attribute metaclass aliases. This means you can also use this as the
46 Getopt alias, like so:
47
48 has 'foo' => (metaclass => 'Getopt', cmd_flag => 'f');
49
51 These methods are of little use to most users, they are used interally
52 within MooseX::Getopt.
53
54 cmd_flag
55 Changes the commandline flag to be this value, instead of the
56 default, which is the same as the attribute name.
57
58 cmd_aliases
59 Adds more aliases for this commandline flag, useful for short
60 options and such.
61
62 has_cmd_flag
63 has_cmd_aliases
64 meta
65
67 All complex software has bugs lurking in it, and this module is no
68 exception. If you find a bug please either email me, or add the bug to
69 cpan-RT.
70
72 Stevan Little <stevan@iinteractive.com>
73
74 Brandon L. Black, <blblack@gmail.com>
75
77 Copyright 2007-2008 by Infinity Interactive, Inc.
78
79 <http://www.iinteractive.com>
80
81 This library is free software; you can redistribute it and/or modify it
82 under the same terms as Perl itself.
83
84
85
86perl v5.12.0 2010-03-01MooseX::Getopt::Meta::Attribute(3)