Getopt/Meta/Attribute/Trait.pm

filter: Statementstmt 100% 17 / 17 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 22 / 22 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Getopt/Meta/Attribute.pm ↑ Summary Getopt/Meta/Attribute/Trait/NoGetopt.pm »
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__
« Getopt/Meta/Attribute.pm ↑ Summary Getopt/Meta/Attribute/Trait/NoGetopt.pm »