« blib/lib/MouseX/Getopt/Meta/Attribute.pm
↑ Summary
blib/lib/MouseX/Getopt/Meta/Attribute/Trait.pm »
| 1 | package MouseX::Getopt::Meta::Attribute::NoGetopt; | ||
| 2 | # ABSTRACT: Optional meta attribute for ignoring params | ||
| 3 | |||
| 4 | 22 | ▶ | use Mouse; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 5 | |||
| 6 | 22 | extends 'Mouse::Meta::Attribute'; # << Mouse extending Mouse :) | |
| 7 | 22 | with 'MouseX::Getopt::Meta::Attribute::Trait::NoGetopt'; | |
| 8 | |||
| 9 | 22 | ▶ | no Mouse; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | # register this as a metaclass alias ... | ||
| 12 | package # stop confusing PAUSE | ||
| 13 | Mouse::Meta::Attribute::Custom::NoGetopt; | ||
| 14 | 21 | ▶ | sub register_implementation { 'MouseX::Getopt::Meta::Attribute::NoGetopt' } |
|
Subroutine
register_implementation: called CC=1 SCAR=0.0
| |||
| 15 | |||
| 16 | 22 | 1; | |
| 17 | |||
| 18 | =for stopwords metaclass commandline | ||
| 19 | |||
| 20 | =head1 SYNOPSIS | ||
| 21 | |||
| 22 | package App; | ||
| 23 | use Mouse; | ||
| 24 | |||
| 25 | with 'MouseX::Getopt'; | ||
| 26 | |||
| 27 | has 'data' => ( | ||
| 28 | metaclass => 'NoGetopt', # do not attempt to capture this param | ||
| 29 | is => 'ro', | ||
| 30 | isa => 'Str', | ||
| 31 | default => 'file.dat', | ||
| 32 | ); | ||
| 33 | |||
| 34 | =head1 DESCRIPTION | ||
| 35 | |||
| 36 | This is a custom attribute metaclass which can be used to specify | ||
| 37 | that a specific attribute should B<not> be processed by | ||
| 38 | C<MouseX::Getopt>. All you need to do is specify the C<NoGetopt> | ||
| 39 | metaclass. | ||
| 40 | |||
| 41 | has 'foo' => (metaclass => 'NoGetopt', ... ); | ||
| 42 | |||
| 43 | =cut | ||