| 1 | package MooseX::Getopt::Meta::Attribute::Trait; | ||
| 2 | # ABSTRACT: Optional meta attribute trait for custom option names | ||
| 3 | |||
| 4 | 27 | our $VERSION = '0.78'; | |
| 5 | |||
| 6 | 27 | ▶ | use Moose::Role; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 7 | 27 | ▶ | use Moose::Util::TypeConstraints qw(subtype coerce from via as); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 8 | 27 | ▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | |||
| 10 | 27 | has 'cmd_flag' => ( | |
| 11 | is => 'rw', | ||
| 12 | isa => 'Str', | ||
| 13 | predicate => 'has_cmd_flag', | ||
| 14 | ); | ||
| 15 | |||
| 16 | # This subtype is to support scalar -> arrayref coercion | ||
| 17 | # without polluting the built-in types | ||
| 18 | 27 | my $cmd_aliases = subtype as 'ArrayRef'; | |
| 19 | |||
| 20 | coerce $cmd_aliases | ||
| 21 | => from 'Str' | ||
| 22 | 7 | ▶ | => via { [$_] }; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 23 | |||
| 24 | 27 | has 'cmd_aliases' => ( | |
| 25 | is => 'rw', | ||
| 26 | isa => $cmd_aliases, | ||
| 27 | predicate => 'has_cmd_aliases', | ||
| 28 | coerce => 1, | ||
| 29 | ); | ||
| 30 | |||
| 31 | # register this as a metaclass alias ... | ||
| 32 | package # stop confusing PAUSE | ||
| 33 | Moose::Meta::Attribute::Custom::Trait::Getopt; | ||
| 34 | 26 | ▶ | sub register_implementation { 'MooseX::Getopt::Meta::Attribute::Trait' } |
|
Subroutine
register_implementation: called CC=1 SCAR=0.0
| |||
| 35 | |||
| 36 | 27 | 1; | |
| 37 | |||
| 38 | __END__ | ||