File Coverage

blib/lib/MooseX/Getopt/Meta/Attribute/NoGetopt.pm
Criterion Covered Total %
statement 6 7 85.7
branch n/a
condition n/a
subroutine 2 3 66.6
pod n/a
total 8 10 80.0


line stmt bran cond sub pod time code
1             package MooseX::Getopt::Meta::Attribute::NoGetopt;
2             # ABSTRACT: Optional meta attribute for ignoring parameters
3              
4             our $VERSION = '0.75';
5              
6 27     27   201 use Moose;
  27         69  
  27         225  
7             extends 'Moose::Meta::Attribute'; # << Moose extending Moose :)
8             with 'MooseX::Getopt::Meta::Attribute::Trait::NoGetopt';
9              
10 27     27   183138 use namespace::autoclean;
  27         84  
  27         299  
11              
12             # register this as a metaclass alias ...
13             package # stop confusing PAUSE
14             Moose::Meta::Attribute::Custom::NoGetopt;
15 0     0     sub register_implementation { 'MooseX::Getopt::Meta::Attribute::NoGetopt' }
16              
17             1;
18              
19             __END__
20              
21             =pod
22              
23             =encoding UTF-8
24              
25             =head1 NAME
26              
27             MooseX::Getopt::Meta::Attribute::NoGetopt - Optional meta attribute for ignoring parameters
28              
29             =head1 VERSION
30              
31             version 0.75
32              
33             =head1 SYNOPSIS
34              
35             package App;
36             use Moose;
37              
38             with 'MooseX::Getopt';
39              
40             has 'data' => (
41             metaclass => 'NoGetopt', # do not attempt to capture this param
42             is => 'ro',
43             isa => 'Str',
44             default => 'file.dat',
45             );
46              
47             =head1 DESCRIPTION
48              
49             This is a custom attribute metaclass which can be used to specify
50             that a specific attribute should B<not> be processed by
51             C<MooseX::Getopt>. All you need to do is specify the C<NoGetopt>
52             metaclass.
53              
54             has 'foo' => (metaclass => 'MooseX::Getopt::Meta::Attribute::NoGetopt', ... );
55              
56             =head2 Use 'traits' instead of 'metaclass'
57              
58             You should rarely need to explicitly set the attribute metaclass. It is much
59             preferred to simply provide a trait (a role applied to the attribute
60             metaclass), which allows other code to further modify the attribute by applying
61             additional roles.
62              
63             Therefore, you should first try to do this:
64              
65             has 'foo' => (traits => ['NoGetopt', ...], ...);
66              
67             =head2 Custom Metaclass alias
68              
69             This now takes advantage of the Moose 0.19 feature to support
70             custom attribute metaclass. This means you can also
71             use this as the B<NoGetopt> alias, like so:
72              
73             has 'foo' => (metaclass => 'NoGetopt', cmd_flag => 'f');
74              
75             =head1 SUPPORT
76              
77             Bugs may be submitted through L<the RT bug tracker|https://rt.cpan.org/Public/Dist/Display.html?Name=MooseX-Getopt>
78             (or L<bug-MooseX-Getopt@rt.cpan.org|mailto:bug-MooseX-Getopt@rt.cpan.org>).
79              
80             There is also a mailing list available for users of this distribution, at
81             L<http://lists.perl.org/list/moose.html>.
82              
83             There is also an irc channel available for users of this distribution, at
84             L<C<#moose> on C<irc.perl.org>|irc://irc.perl.org/#moose>.
85              
86             =head1 AUTHOR
87              
88             Stevan Little <stevan@iinteractive.com>
89              
90             =head1 COPYRIGHT AND LICENSE
91              
92             This software is copyright (c) 2007 by Infinity Interactive, Inc.
93              
94             This is free software; you can redistribute it and/or modify it under
95             the same terms as the Perl 5 programming language system itself.
96              
97             =cut