spelling (RT#87780)
[gitmo/MooseX-Getopt.git] / lib / MooseX / Getopt / Meta / Attribute / NoGetopt.pm
CommitLineData
0f8232b6 1package MooseX::Getopt::Meta::Attribute::NoGetopt;
669588e2 2# ABSTRACT: Optional meta attribute for ignoring params
a01f08fb 3
669588e2 4use Moose;
a01f08fb 5
6extends 'Moose::Meta::Attribute'; # << Moose extending Moose :)
adbe3e57 7 with 'MooseX::Getopt::Meta::Attribute::Trait::NoGetopt';
a01f08fb 8
9no Moose;
10
11# register this as a metaclass alias ...
6ac028c4 12package # stop confusing PAUSE
13 Moose::Meta::Attribute::Custom::NoGetopt;
0f8232b6 14sub register_implementation { 'MooseX::Getopt::Meta::Attribute::NoGetopt' }
a01f08fb 15
f969917f 161;
17
f969917f 18=head1 SYNOPSIS
19
20 package App;
21 use Moose;
669588e2 22
f969917f 23 with 'MooseX::Getopt';
669588e2 24
f969917f 25 has 'data' => (
669588e2 26 metaclass => 'NoGetopt', # do not attempt to capture this param
f969917f 27 is => 'ro',
28 isa => 'Str',
29 default => 'file.dat',
30 );
31
32=head1 DESCRIPTION
33
669588e2 34This is a custom attribute metaclass which can be used to specify
35that a specific attribute should B<not> be processed by
36C<MooseX::Getopt>. All you need to do is specify the C<NoGetopt>
f969917f 37metaclass.
38
1e592bee 39 has 'foo' => (metaclass => 'MooseX::Getopt::Meta::Attribute::NoGetopt', ... );
40
195fb408 41=head2 Use 'traits' instead of 'metaclass'
42
43You should rarely need to explicitly set the attribute metaclass. It is much
44preferred to simply provide a trait (a role applied to the attribute
74771704 45metaclass), which allows other code to further modify the attribute by applying
195fb408 46additional roles.
47
48Therefore, you should first try to do this:
49
50 has 'foo' => (traits => ['NoGetopt', ...], ...);
51
1e592bee 52=head2 Custom Metaclass alias
53
54This now takes advantage of the Moose 0.19 feature to support
55custom attribute metaclass. This means you can also
56use this as the B<NoGetopt> alias, like so:
57
58 has 'foo' => (metaclass => 'NoGetopt', cmd_flag => 'f');
f969917f 59
f969917f 60=cut