ddf928f24bae9f460f7a8d9be55c6ddf95de3924
[gitmo/MooseX-Getopt.git] / lib / MooseX / Getopt / Meta / Attribute.pm
1
2 package MooseX::Getopt::Meta::Attribute;
3 use Moose;
4
5 our $VERSION   = '0.01';
6 our $AUTHORITY = 'cpan:STEVAN';
7
8 extends 'Moose::Meta::Attribute'; # << Moose extending Moose :)
9
10 has 'cmd_flag' => (
11     is        => 'rw',
12     isa       => 'Str',
13     predicate => 'has_cmd_flag',
14 );
15
16 no Moose; 1;
17
18 __END__
19
20
21 =pod
22
23 =head1 NAME
24
25 MooseX::Getopt::Meta::Attribute - Optional meta attribute for custom option names
26
27 =head1 SYNOPSIS
28
29   package App;
30   use Moose;
31   
32   with 'MooseX::Getopt';
33   
34   has 'data' => (
35       metaclass => 'MooseX::Getopt::Meta::Attribute',        
36       is        => 'ro',
37       isa       => 'Str',
38       default   => 'file.dat',
39       # tells MooseX::Getopt to use -f as the 
40       # command line flag instead of the normal 
41       # autogenerated one (--data)
42       cmd_flag  => 'f',
43   );
44
45 =head1 DESCRIPTION
46
47 This is a custom attribute metaclass which can be used to specify a 
48 the specific command line flag to use instead of the default one 
49 which L<MooseX::Getopt> will create for you. 
50
51 This is certainly not the prettiest way to go about this, but for 
52 now it works for those who might need such a feature.
53
54 =head1 METHODS
55
56 These methods are of little use to most users, they are used interally 
57 within L<MooseX::Getopt>.
58
59 =over 4
60
61 =item B<cmd_flag>
62
63 =item B<has_cmd_flag>
64
65 =item B<meta>
66
67 =back
68
69 =head1 BUGS
70
71 All complex software has bugs lurking in it, and this module is no 
72 exception. If you find a bug please either email me, or add the bug
73 to cpan-RT.
74
75 =head1 AUTHOR
76
77 Stevan Little E<lt>stevan@iinteractive.comE<gt>
78
79 =head1 COPYRIGHT AND LICENSE
80
81 Copyright 2007 by Infinity Interactive, Inc.
82
83 L<http://www.iinteractive.com>
84
85 This library is free software; you can redistribute it and/or modify
86 it under the same terms as Perl itself.
87
88 =cut