blib/lib/Type/Coercion.pm

filter: Statementstmt 87.5% 234 / 266 (1 uncoverable) Branchbran 70.7% 99 / 140 Conditioncond 50.5% 51 / 101 MC/DCmcdc 27.1% 16 / 59 Subroutinesub 90.3% 56 / 62 Podpod 100% 35 / 35 totaltotal 73.9% 491 / 663 (1 uncoverable) CC 108 SCAR 22.1
CC
108
Cov
76%
add
33.1
AUTOLOAD
23.7
isa
21.8
CRAP 9.1
« blib/lib/Type/Params/Signature.pm ↑ Summary blib/lib/Type/Params.pm »
1 package Type::Coercion;
2  
3 277 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 277 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 277 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 277 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
8 277 $Type::Coercion::AUTHORITY = 'cpan:TOBYINK';
9 277 $Type::Coercion::VERSION = '2.010001';
10 }
11  
12 277 $Type::Coercion::VERSION =~ tr/_//d;
13  
14 277 ▶use Eval::TypeTiny qw<>;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 277 ▶use Scalar::Util qw< blessed >;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 277 ▶use Types::TypeTiny qw<>;
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 4 ▶sub _croak ($;@) { require Error::TypeTiny; goto \&Error::TypeTiny::croak }
Subroutine _croak: called CC=1 SCAR=0.0
19  
20 277 require Type::Tiny;
21  
22 __PACKAGE__->Type::Tiny::_install_overloads(
23 743 ▶ q("") => sub {
Subroutine __ANON__: called CC=2 SCAR=7.6
24 743 ▶ caller =~ m{^(Moo::HandleMoose|Sub::Quote)}
Branch: 1 branch
BranchTrueFalseTotal
(caller) =~ /^(Moo::HandleMoose|Sub::Quote)/ ? : 0 743 743
25 ? $_[0]->_stringify_no_magic
26 : $_[0]->display_name;
27 },
28 26396 ▶ q(bool) => sub { 1 },
Subroutine __ANON__: called CC=1 SCAR=0.0
29 277 q(&{}) => "_overload_coderef",
30 );
31  
32 __PACKAGE__->Type::Tiny::_install_overloads(
33 0 ▶ q(~~) => sub { $_[0]->has_coercion_for_value( $_[1] ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
34 277 ) if Type::Tiny::SUPPORT_SMARTMATCH();
35  
36 16 ▶sub _overload_coderef {
Subroutine _overload_coderef: called CC=6 SCAR=18.1
37 16 my $self = shift;
38
39 16 ▶ if ( "Sub::Quote"->can( "quote_sub" ) && $self->can_be_inlined ) {
Branch: 1 branch
BranchTrueFalseTotal
if ('Sub::Quote'->can('quote_sub') and $self->can_be_inlined) { } 3 13 16
Condition100%3/3
"Sub::Quote"->can("quote_sub") and $self->can_be_inlined
!ll&&!rl&&r
3103
MC/DC100%2/2
"Sub::Quote"->can("quote_sub") and $self->can_be_inlined
"Sub::Quote"->can("quote_sub") $self->can_be_inlined
Truth table100%3/3
A and B
A= "Sub::Quote"->can("quote_sub")B= $self->can_be_inlined
ABresult
0X0
100
111
40 $self->{_overload_coderef} =
41 Sub::Quote::quote_sub( $self->inline_coercion( '$_[0]' ) )
42 3 ▶ if !$self->{_overload_coderef} || !$self->{_sub_quoted}++;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->{"_overload_coderef"} and $self->{"_sub_quoted"}++ 3 0 3
Condition66%2/3
$self->{"_overload_coderef"} and $self->{"_sub_quoted"}++
!ll&&!rl&&r
210
MC/DC0%0/2
$self->{"_overload_coderef"} and $self->{"_sub_quoted"}++
$self->{"_overload_coderef"} $self->{"_sub_quoted"}++
Truth table66%2/3
A and B
A= $self->{"_overload_coderef"}B= $self->{"_sub_quoted"}++
ABresult
0X0
100
111
43 }
44 else {
45 13 Scalar::Util::weaken( my $weak = $self );
46 13 ▶ $self->{_overload_coderef} ||= sub { $weak->coerce( @_ ) };
Subroutine __ANON__: called CC=1 SCAR=0.1
Condition66%2/3
$self->{"_overload_coderef"} ||= sub { $weak->coerce(@_); }
l!l&&r!l&&!r
670
MC/DC0%0/2
$self->{"_overload_coderef"} ||= sub { $weak->coerce(@_); }
$self->{"_overload_coderef"} sub { $weak->coerce(@_); }
Truth table66%2/3
A ||= B
A= $self->{"_overload_coderef"}B= sub { $weak->coerce(@_); }
ABresult
1X1
011
000
47 }
48
49 16 $self->{_overload_coderef};
50 } #/ sub _overload_coderef
51  
52 13617 ▶sub new {
Subroutine new: called CC=9 SCAR=22.1
Pod documented
53 13617 my $class = shift;
54 13617 ▶ my %params = ( @_ == 1 ) ? %{ $_[0] } : @_;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 ? : 822 12795 13617
55
56 13617 ▶ $params{name} = '__ANON__' unless exists( $params{name} );
Branch: 1 branch
BranchTrueFalseTotal
unless exists $params{"name"} 12761 856 13617
57 13617 ▶ my $C = delete( $params{type_coercion_map} ) || [];
Condition100%2/2
delete $params{'type_coercion_map'} || []
l!l
29113326
MC/DC100%1/1
delete $params{'type_coercion_map'} || []
delete $params{'type_coercion_map'}
Truth table100%2/2
A
A= delete $params{'type_coercion_map'}
Aresult
11
00
58 13617 my $F = delete( $params{frozen} );
59
60 13617 my $self = bless \%params, $class;
61 13617 ▶ $self->add_type_coercions( @$C ) if @$C;
Branch: 1 branch
BranchTrueFalseTotal
if @$C 291 13326 13617
62 13617 $self->_preserve_type_constraint;
63 13617 Scalar::Util::weaken( $self->{type_constraint} ); # break ref cycle
64 13617 ▶ $self->{frozen} = $F if $F;
Branch: 1 branch
BranchTrueFalseTotal
if $F 14 13603 13617
65
66 13617 ▶ unless ( $self->is_anon ) {
Branch: 1 branch
BranchTrueFalseTotal
unless ($self->is_anon) 856 12761 13617
67
68 # First try a fast ASCII-only expression, but fall back to Unicode
69 856 ▶ $self->name =~ /^_{0,2}[A-Z][A-Za-z0-9_]+$/sm
Branch: 1 branch
BranchTrueFalseTotal
$self->name =~ /^_{0,2}[A-Z][A-Za-z0-9_]+$/ms or eval " use 5.008; \$self->name =~ /^_{0,2}\\p{Lu}[\\p{L}0-9_]+\$/sm " or &_croak("\"%s\" is not a valid coercion name", $self->name) 856 0 856
Condition33%1/3
$self->name =~ /^_{0,2}[A-Z][A-Za-z0-9_]+$/ms or eval " use 5.008; \$self->name =~ /^_{0,2}\\p{Lu}[\\p{L}0-9_]+\$/sm "
l!l&&r!l&&!r
85600
MC/DC0%0/2
$self->name =~ /^_{0,2}[A-Z][A-Za-z0-9_]+$/ms or eval " use 5.008; \$self->name =~ /^_{0,2}\\p{Lu}[\\p{L}0-9_]+\$/sm "
$self->name =~ /^_{0,2}[A-Z][A-Za-z0-9_]+$/ms eval " use 5.008; \$self->name =~ /^_{0,2}\\p{Lu}[\\p{L}0-9_]+\$/sm "
Truth table33%1/3
A or B
A= $self->name =~ /^_{0,2}[A-Z][A-Za-z0-9_]+$/msB= eval " use 5.008; \$self->name =~ /^_{0,2}\\p{Lu}[\\p{L}0-9_]+\$/sm "
ABresult
1X1
011
000
70 or eval q( use 5.008; $self->name =~ /^_{0,2}\p{Lu}[\p{L}0-9_]+$/sm )
71 or _croak '"%s" is not a valid coercion name', $self->name;
72 }
73
74 13617 return $self;
75 } #/ sub new
76  
77 1 ▶sub _stringify_no_magic {
Subroutine _stringify_no_magic: called CC=1 SCAR=0.0
78 1 sprintf(
79 '%s=%s(0x%08x)', blessed( $_[0] ), Scalar::Util::reftype( $_[0] ),
80 Scalar::Util::refaddr( $_[0] )
81 );
82 }
83  
84 17601 ▶sub name { $_[0]{name} }
Subroutine name: called CC=1 SCAR=0.0
Pod documented
85 743 ▶sub display_name { $_[0]{display_name} ||= $_[0]->_build_display_name }
Subroutine display_name: called CC=2 SCAR=7.2
Pod documented
Condition66%2/3
$_[0]{"display_name"} ||= $_[0]->_build_display_name
l!l&&r!l&&!r
6431000
MC/DC0%0/2
$_[0]{"display_name"} ||= $_[0]->_build_display_name
$_[0]{"display_name"} $_[0]->_build_display_name
Truth table66%2/3
A ||= B
A= $_[0]{"display_name"}B= $_[0]->_build_display_name
ABresult
1X1
011
000
86 31 ▶sub library { $_[0]{library} }
Subroutine library: called CC=1 SCAR=0.0
Pod documented
87  
88 5450 ▶sub type_constraint {
Subroutine type_constraint: called CC=2 SCAR=6.9
Pod documented
89 5450 ▶ $_[0]{type_constraint} ||= $_[0]->_maybe_restore_type_constraint;
Condition100%3/3
$_[0]{"type_constraint"} ||= $_[0]->_maybe_restore_type_constraint
l!l&&r!l&&!r
544532
MC/DC100%2/2
$_[0]{"type_constraint"} ||= $_[0]->_maybe_restore_type_constraint
$_[0]{"type_constraint"} $_[0]->_maybe_restore_type_constraint
Truth table100%3/3
A ||= B
A= $_[0]{"type_constraint"}B= $_[0]->_maybe_restore_type_constraint
ABresult
1X1
011
000
90 }
91 24804 ▶sub type_coercion_map { $_[0]{type_coercion_map} ||= [] }
Subroutine type_coercion_map: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
$_[0]{"type_coercion_map"} ||= []
l!l
1258012224
MC/DC100%1/1
$_[0]{"type_coercion_map"} ||= []
$_[0]{"type_coercion_map"}
Truth table100%2/2
A
A= $_[0]{"type_coercion_map"}
Aresult
11
00
92 0 ▶sub moose_coercion { $_[0]{moose_coercion} ||= $_[0]->_build_moose_coercion }
Subroutine moose_coercion: not called CC=2 SCAR=17.9
Pod documented
Condition0%0/3
$_[0]{"moose_coercion"} ||= $_[0]->_build_moose_coercion
l!l&&r!l&&!r
000
MC/DC0%0/2
$_[0]{"moose_coercion"} ||= $_[0]->_build_moose_coercion
$_[0]{"moose_coercion"} $_[0]->_build_moose_coercion
Truth table0%0/3
A ||= B
A= $_[0]{"moose_coercion"}B= $_[0]->_build_moose_coercion
ABresult
1X1
011
000
93  
94 1727 ▶sub compiled_coercion {
Subroutine compiled_coercion: called CC=2 SCAR=7.2
Pod documented
95 1727 ▶ $_[0]{compiled_coercion} ||= $_[0]->_build_compiled_coercion;
Condition66%2/3
$_[0]{"compiled_coercion"} ||= $_[0]->_build_compiled_coercion
l!l&&r!l&&!r
10167110
MC/DC0%0/2
$_[0]{"compiled_coercion"} ||= $_[0]->_build_compiled_coercion
$_[0]{"compiled_coercion"} $_[0]->_build_compiled_coercion
Truth table66%2/3
A ||= B
A= $_[0]{"compiled_coercion"}B= $_[0]->_build_compiled_coercion
ABresult
1X1
011
000
96 }
97 4721 ▶sub frozen { $_[0]{frozen} ||= 0 }
Subroutine frozen: called CC=2 SCAR=6.9
Pod documented
Condition100%2/2
$_[0]{"frozen"} ||= 0
l!l
33901331
MC/DC100%1/1
$_[0]{"frozen"} ||= 0
$_[0]{"frozen"}
Truth table100%2/2
A
A= $_[0]{"frozen"}
Aresult
11
00
98 14 ▶sub coercion_generator { $_[0]{coercion_generator} }
Subroutine coercion_generator: called CC=1 SCAR=0.0
Pod documented
99 7 ▶sub parameters { $_[0]{parameters} }
Subroutine parameters: called CC=1 SCAR=0.0
Pod documented
100 7 ▶sub parameterized_from { $_[0]{parameterized_from} }
Subroutine parameterized_from: called CC=1 SCAR=0.0
Pod documented
101  
102 988 ▶sub has_library { exists $_[0]{library} }
Subroutine has_library: called CC=1 SCAR=0.0
Pod documented
103 2700 ▶sub has_type_constraint { defined $_[0]->type_constraint } # sic
Subroutine has_type_constraint: called CC=1 SCAR=0.0
Pod documented
104 995 ▶sub has_coercion_generator { exists $_[0]{coercion_generator} }
Subroutine has_coercion_generator: called CC=1 SCAR=0.0
Pod documented
105 23 ▶sub has_parameters { exists $_[0]{parameters} }
Subroutine has_parameters: called CC=1 SCAR=0.0
Pod documented
106  
107 # It is possible for the target type constraint to have been garbage collected
108 # but the type coercion object to still exist, as we only keep a weak
109 # reference to the target type constraint to prevent cyclical references.
110 # For this reason, we also keep a copy of the type's compiled check which
111 # will just be a simple coderef that unlikely has any references to anything.
112 # We preserve it during the constructor, then in the getter for the type
113 # constraint, we can quickly rebuild a dummy type constraint using the same
114 # compiled check we preserved, which will usually be sufficient for our needs.
115  
116 13552 ▶sub _preserve_type_constraint {
Subroutine _preserve_type_constraint: called CC=2 SCAR=6.9
117 13552 my $self = shift;
118 $self->{_compiled_type_constraint_check} =
119 $self->{type_constraint}->compiled_check
120 13552 ▶ if $self->{type_constraint};
Branch: 1 branch
BranchTrueFalseTotal
if $self->{"type_constraint"} 13547 5 13552
121 }
122  
123 4 ▶sub _maybe_restore_type_constraint {
Subroutine _maybe_restore_type_constraint: called CC=2 SCAR=7.0
124 4 my $self = shift;
125 4 ▶ if ( my $check = $self->{_compiled_type_constraint_check} ) {
Branch: 1 branch
BranchTrueFalseTotal
if (my $check = $self->{"_compiled_type_constraint_check"}) 2 2 4
126 2 return Type::Tiny->new( constraint => $check );
127 }
128 2 return; # uncoverable statement
129 }
130  
131 2 ▶sub add {
Subroutine add: called CC=15 SCAR=35.0
Pod documented
132 2 my $class = shift;
133 2 my ( $x, $y, $swap ) = @_;
134
135 2 ▶ Types::TypeTiny::is_TypeTiny( $x ) and return $x->plus_fallback_coercions( $y );
Branch: 1 branch
BranchTrueFalseTotal
Types::TypeTiny::is_TypeTiny($x) and return $x->plus_fallback_coercions($y) 0 2 2
136 2 ▶ Types::TypeTiny::is_TypeTiny( $y ) and return $y->plus_coercions( $x );
Branch: 1 branch
BranchTrueFalseTotal
Types::TypeTiny::is_TypeTiny($y) and return $y->plus_coercions($x) 0 2 2
137
138 2 ▶ _croak "Attempt to add $class to something that is not a $class"
Branch: 1 branch
BranchTrueFalseTotal
unless builtin::blessed($x) and builtin::blessed($y) and $x->isa($class) and $y->isa($class) 0 2 2
Condition33%3/9
builtin::blessed($x) and builtin::blessed($y) and $x->isa($class) and $y->isa($class)
!ll&&!rl&&r
002
builtin::blessed($x) and builtin::blessed($y) and $x->isa($class)
!ll&&!rl&&r
002
builtin::blessed($x) and builtin::blessed($y)
!ll&&!rl&&r
002
MC/DC0%0/4
builtin::blessed($x) and builtin::blessed($y) and $x->isa($class) and $y->isa($class)
builtin::blessed($x) builtin::blessed($y) $x->isa($class) $y->isa($class)
Truth table20%1/5
A and B and C and D
A= builtin::blessed($x)B= builtin::blessed($y)C= $x->isa($class)D= $y->isa($class)
ABCDresult
0XXX0
10XX0
110X0
11100
11111
139 unless blessed( $x )
140 && blessed( $y )
141 && $x->isa( $class )
142 && $y->isa( $class );
143
144 2 ▶ ( $y, $x ) = ( $x, $y ) if $swap;
Branch: 1 branch
BranchTrueFalseTotal
if $swap 0 2 2
145
146 2 my %opts;
147 2 ▶ if ( $x->has_type_constraint
Branch: 2 branches
BranchTrueFalseTotal
if ($x->has_type_constraint and $y->has_type_constraint and $x->type_constraint == $y->type_constraint) { } 2 0 2
elsif ($x->has_type_constraint and $y->has_type_constraint) { } 0 0 0
Condition33%2/6
$x->has_type_constraint and $y->has_type_constraint and $x->type_constraint == $y->type_constraint
!ll&&!rl&&r
002
$x->has_type_constraint and $y->has_type_constraint
!ll&&!rl&&r
002
MC/DC0%0/3
$x->has_type_constraint and $y->has_type_constraint and $x->type_constraint == $y->type_constraint
$x->has_type_constraint $y->has_type_constraint $x->type_constraint == $y->type_constraint
Truth table25%1/4
A and B and C
A= $x->has_type_constraintB= $y->has_type_constraintC= $x->type_constraint == $y->type_constraint
ABCresult
0XX0
10X0
1100
1111
148 and $y->has_type_constraint
149 and $x->type_constraint == $y->type_constraint )
150 {
151 2 $opts{type_constraint} = $x->type_constraint;
152 }
153 ▶ elsif ( $x->has_type_constraint and $y->has_type_constraint ) {
Condition0%0/3
$x->has_type_constraint and $y->has_type_constraint
!ll&&!rl&&r
000
MC/DC0%0/2
$x->has_type_constraint and $y->has_type_constraint
$x->has_type_constraint $y->has_type_constraint
Truth table0%0/3
A and B
A= $x->has_type_constraintB= $y->has_type_constraint
ABresult
0X0
100
111
154
155 # require Type::Tiny::Union;
156 # $opts{type_constraint} = "Type::Tiny::Union"->new(
157 # type_constraints => [ $x->type_constraint, $y->type_constraint ],
158 # );
159 }
160 2 ▶ $opts{display_name} ||= "$x+$y";
Condition50%1/2
$opts{"display_name"} ||= "$x+$y"
l!l
02
MC/DC0%0/1
$opts{"display_name"} ||= "$x+$y"
$opts{"display_name"}
Truth table50%1/2
A
A= $opts{"display_name"}
Aresult
11
00
161 2 ▶ delete $opts{display_name} if $opts{display_name} eq '__ANON__+__ANON__';
Branch: 1 branch
BranchTrueFalseTotal
if $opts{"display_name"} eq "__ANON__+__ANON__" 0 2 2
162
163 2 my $new = $class->new( %opts );
164 2 $new->add_type_coercions( @{ $x->type_coercion_map } );
165 2 $new->add_type_coercions( @{ $y->type_coercion_map } );
166 2 return $new;
167 } #/ sub add
168  
169 100 ▶sub _build_display_name {
Subroutine _build_display_name: called CC=1 SCAR=0.0
170 100 shift->name;
171 }
172  
173 988 ▶sub qualified_name {
Subroutine qualified_name: called CC=3 SCAR=11.0
Pod documented
174 988 my $self = shift;
175
176 988 ▶ if ( $self->has_library and not $self->is_anon ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_library and not $self->is_anon) 31 957 988
Condition66%2/3
$self->has_library and not $self->is_anon
!ll&&!rl&&r
957031
MC/DC50%1/2
$self->has_library and not $self->is_anon
$self->has_library not $self->is_anon
Truth table66%2/3
A and not(B)
A= $self->has_libraryB= not $self->is_anon
ABresult
0X0
100
111
177 31 return sprintf( "%s::%s", $self->library, $self->name );
178 }
179
180 957 return $self->name;
181 }
182  
183 14668 ▶sub is_anon {
Subroutine is_anon: called CC=1 SCAR=0.0
Pod documented
184 14668 my $self = shift;
185 14668 $self->name eq "__ANON__";
186 }
187  
188 1275 ▶sub _clear_compiled_coercion {
Subroutine _clear_compiled_coercion: called CC=1 SCAR=0.0
189 1275 delete $_[0]{_overload_coderef};
190 1275 delete $_[0]{compiled_coercion};
191 }
192  
193 14279 ▶sub freeze { $_[0]{frozen} = 1; $_[0] }
Subroutine freeze: called CC=1 SCAR=0.0
Pod documented
194 0 ▶sub i_really_want_to_unfreeze { $_[0]{frozen} = 0; $_[0] }
Subroutine i_really_want_to_unfreeze: not called CC=1 SCAR=6.9
Pod documented
195  
196 676 ▶sub coerce {
Subroutine coerce: called CC=1 SCAR=0.0
Pod documented
197 676 my $self = shift;
198 676 return $self->compiled_coercion->( @_ );
199 }
200  
201 8 ▶sub check_coerce {
Subroutine check_coerce: called CC=3 SCAR=11.2
Pod documented
202 8 my $self = shift;
203 8 my $r = $self->coerce( @_ );
204
205 8 ▶ if ( $self->has_type_constraint ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_type_constraint) { } 8 0 8
206 8 my $tc = $self->type_constraint;
207 8 ▶ return $tc->check( $r ) ? $r : undef;
Branch: 1 branch
BranchTrueFalseTotal
$tc->check($r) ? : 4 4 8
208 }
209 else {
210 0 return $r;
211 }
212 }
213  
214 64 ▶sub assert_coerce {
Subroutine assert_coerce: called CC=2 SCAR=7.0
Pod documented
215 64 my $self = shift;
216 64 my $r = $self->coerce( @_ );
217 64 ▶ $self->type_constraint->assert_valid( $r )
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_type_constraint 64 0 64
218 if $self->has_type_constraint;
219 63 return $r;
220 }
221  
222 17 ▶sub has_coercion_for_type {
Subroutine has_coercion_for_type: called CC=5 SCAR=16.1
Pod documented
223 17 my $self = shift;
224 17 my $type = Types::TypeTiny::to_TypeTiny( $_[0] );
225
226 17 ▶ return "0 but true"
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_type_constraint and $type->is_a_type_of($self->type_constraint) 2 15 17
Condition100%3/3
$self->has_type_constraint and $type->is_a_type_of($self->type_constraint)
!ll&&!rl&&r
2132
MC/DC100%2/2
$self->has_type_constraint and $type->is_a_type_of($self->type_constraint)
$self->has_type_constraint $type->is_a_type_of($self->type_constraint)
Truth table100%3/3
A and B
A= $self->has_type_constraintB= $type->is_a_type_of($self->type_constraint)
ABresult
0X0
100
111
227 if $self->has_type_constraint
228 && $type->is_a_type_of( $self->type_constraint );
229
230 15 my $c = $self->type_coercion_map;
231 15 ▶ for ( my $i = 0 ; $i <= $#$c ; $i += 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $c->$#*) 19 4 23
232 19 ▶ return !!1 if $type->is_a_type_of( $c->[$i] );
Branch: 1 branch
BranchTrueFalseTotal
if $type->is_a_type_of($c->[$i]) 11 8 19
233 }
234 4 return;
235 } #/ sub has_coercion_for_type
236  
237 4 ▶sub has_coercion_for_value {
Subroutine has_coercion_for_value: called CC=5 SCAR=16.1
Pod documented
238 4 my $self = shift;
239 4 local $_ = $_[0];
240
241 4 ▶ return "0 but true"
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_type_constraint and $self->type_constraint->check(@_) 1 3 4
Condition66%2/3
$self->has_type_constraint and $self->type_constraint->check(@_)
!ll&&!rl&&r
031
MC/DC50%1/2
$self->has_type_constraint and $self->type_constraint->check(@_)
$self->has_type_constraint $self->type_constraint->check(@_)
Truth table66%2/3
A and B
A= $self->has_type_constraintB= $self->type_constraint->check(@_)
ABresult
0X0
100
111
242 if $self->has_type_constraint
243 && $self->type_constraint->check( @_ );
244
245 3 my $c = $self->type_coercion_map;
246 3 ▶ for ( my $i = 0 ; $i <= $#$c ; $i += 2 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i <= $c->$#*) 5 1 6
247 5 ▶ return !!1 if $c->[$i]->check( @_ );
Branch: 1 branch
BranchTrueFalseTotal
if $c->[$i]->check(@_) 2 3 5
248 }
249 1 return;
250 } #/ sub has_coercion_for_value
251  
252 1278 ▶sub add_type_coercions {
Subroutine add_type_coercions: called CC=8 SCAR=20.9
Pod documented
253 1278 my $self = shift;
254 1278 my @args = @_;
255
256 1278 ▶ _croak "Attempt to add coercion code to a Type::Coercion which has been frozen"
Branch: 1 branch
BranchTrueFalseTotal
if $self->frozen 3 1275 1278
257 if $self->frozen;
258
259 1275 ▶ while ( @args ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@args) 1874 1275 3149
260 1874 my $type = Types::TypeTiny::to_TypeTiny( shift @args );
261
262 1874 ▶ if ( blessed $type and my $method = $type->can( 'type_coercion_map' ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (builtin::blessed($type) and my $method = $type->can('type_coercion_map')) { } 1 1873 1874
Condition66%2/3
builtin::blessed($type) and my $method = $type->can("type_coercion_map")
!ll&&!rl&&r
018731
MC/DC50%1/2
builtin::blessed($type) and my $method = $type->can("type_coercion_map")
builtin::blessed($type) my $method = $type->can("type_coercion_map")
Truth table66%2/3
A and B
A= builtin::blessed($type)B= my $method = $type->can("type_coercion_map")
ABresult
0X0
100
111
263 1 push @{ $self->type_coercion_map }, @{ $method->( $type ) };
264 }
265 else {
266 1873 my $coercion = shift @args;
267 1873 ▶ _croak "Types must be blessed Type::Tiny objects"
Branch: 1 branch
BranchTrueFalseTotal
unless Types::TypeTiny::is_TypeTiny($type) 0 1873 1873
268 unless Types::TypeTiny::is_TypeTiny( $type );
269 1873 ▶ _croak "Coercions must be code references or strings"
Branch: 1 branch
BranchTrueFalseTotal
unless Types::TypeTiny::is_StringLike($coercion) or Types::TypeTiny::is_CodeLike($coercion) 0 1873 1873
Condition66%2/3
Types::TypeTiny::is_StringLike($coercion) or Types::TypeTiny::is_CodeLike($coercion)
l!l&&r!l&&!r
16142590
MC/DC0%0/2
Types::TypeTiny::is_StringLike($coercion) or Types::TypeTiny::is_CodeLike($coercion)
Types::TypeTiny::is_StringLike($coercion) Types::TypeTiny::is_CodeLike($coercion)
Truth table66%2/3
A or B
A= Types::TypeTiny::is_StringLike($coercion)B= Types::TypeTiny::is_CodeLike($coercion)
ABresult
1X1
011
000
270 unless Types::TypeTiny::is_StringLike( $coercion )
271 || Types::TypeTiny::is_CodeLike( $coercion );
272 1873 push @{ $self->type_coercion_map }, $type, $coercion;
273 }
274 } #/ while ( @args )
275
276 1275 $self->_clear_compiled_coercion;
277 1275 return $self;
278 } #/ sub add_type_coercions
279  
280 711 ▶sub _build_compiled_coercion {
Subroutine _build_compiled_coercion: called CC=9 SCAR=22.0
281 711 my $self = shift;
282
283 711 my @mishmash = @{ $self->type_coercion_map };
284 1 ▶ return sub { $_[0] }
Subroutine __ANON__: called CC=1 SCAR=0.0
285 711 ▶ unless @mishmash;
Branch: 1 branch
BranchTrueFalseTotal
unless @mishmash 1 710 711
286
287 710 ▶ if ( $self->can_be_inlined ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can_be_inlined) 579 131 710
288 579 return Eval::TypeTiny::eval_closure(
289 source => sprintf( 'sub ($) { %s }', $self->inline_coercion( '$_[0]' ) ),
290 description => sprintf( "compiled coercion '%s'", $self ),
291 );
292 }
293
294 # These arrays will be closed over.
295 131 my ( @types, @codes );
296 131 ▶ while ( @mishmash ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@mishmash) 153 131 284
297 153 push @types, shift @mishmash;
298 153 push @codes, shift @mishmash;
299 }
300 131 ▶ if ( $self->has_type_constraint ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_type_constraint) 131 0 131
301 131 unshift @types, $self->type_constraint;
302 131 unshift @codes, undef;
303 }
304
305 131 my @sub;
306
307 131 for my $i ( 0 .. $#types ) {
308 284 ▶ push @sub,
Branch: 1 branch
BranchTrueFalseTotal
$types[$i]->can_be_inlined ? : 240 44 284
309 $types[$i]->can_be_inlined
310 ? sprintf( 'if (%s)', $types[$i]->inline_check( '$_[0]' ) )
311 : sprintf( 'if ($checks[%d]->(@_))', $i );
312 284 ▶ push @sub,
Branch: 2 branches
BranchTrueFalseTotal
!defined($codes[$i]) ? : 131 153 284
Types::TypeTiny::is_StringLike($codes[$i]) ? : 27 126 153
313 !defined( $codes[$i] )
314 ? sprintf( ' { return $_[0] }' )
315 : Types::TypeTiny::is_StringLike( $codes[$i] ) ? sprintf(
316 ' { local $_ = $_[0]; return scalar(%s); }',
317 $codes[$i]
318 )
319 : sprintf( ' { local $_ = $_[0]; return scalar($codes[%d]->(@_)) }', $i );
320 } #/ for my $i ( 0 .. $#types)
321
322 131 push @sub, 'return $_[0];';
323
324 131 return Eval::TypeTiny::eval_closure(
325 source => sprintf( 'sub ($) { %s }', join qq[\n], @sub ),
326 description => sprintf( "compiled coercion '%s'", $self ),
327 environment => {
328 '@checks' => [ map $_->compiled_check, @types ],
329 '@codes' => \@codes,
330 },
331 );
332 } #/ sub _build_compiled_coercion
333  
334 1738 ▶sub can_be_inlined {
Subroutine can_be_inlined: called CC=7 SCAR=19.5
Pod documented
335 1738 my $self = shift;
336
337 1738 ▶ return unless $self->frozen;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->frozen 47 1691 1738
338
339 return
340 1691 ▶ if $self->has_type_constraint
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_type_constraint and not $self->type_constraint->can_be_inlined 80 1611 1691
Condition66%2/3
$self->has_type_constraint and not $self->type_constraint->can_be_inlined
!ll&&!rl&&r
0161180
MC/DC50%1/2
$self->has_type_constraint and not $self->type_constraint->can_be_inlined
$self->has_type_constraint not $self->type_constraint->can_be_inlined
Truth table66%2/3
A and not(B)
A= $self->has_type_constraintB= not $self->type_constraint->can_be_inlined
ABresult
0X0
100
111
341 && !$self->type_constraint->can_be_inlined;
342
343 1611 my @mishmash = @{ $self->type_coercion_map };
344 1611 ▶ while ( @mishmash ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@mishmash) 1639 1461 3100
345 1639 my ( $type, $converter ) = splice( @mishmash, 0, 2 );
346 1639 ▶ return unless $type->can_be_inlined;
Branch: 1 branch
BranchTrueFalseTotal
unless $type->can_be_inlined 2 1637 1639
347 1637 ▶ return unless Types::TypeTiny::is_StringLike( $converter );
Branch: 1 branch
BranchTrueFalseTotal
unless Types::TypeTiny::is_StringLike($converter) 148 1489 1637
348 }
349 1461 return !!1;
350 } #/ sub can_be_inlined
351  
352 58 ▶sub _source_type_union {
Subroutine _source_type_union: called CC=3 SCAR=11.0
353 58 my $self = shift;
354
355 58 my @r;
356 58 ▶ push @r, $self->type_constraint if $self->has_type_constraint;
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_type_constraint 58 0 58
357
358 58 my @mishmash = @{ $self->type_coercion_map };
359 58 ▶ while ( @mishmash ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@mishmash) 58 58 116
360 58 my ( $type ) = splice( @mishmash, 0, 2 );
361 58 push @r, $type;
362 }
363
364 58 require Type::Tiny::Union;
365 58 return "Type::Tiny::Union"->new( type_constraints => \@r, tmp => 1 );
366 } #/ sub _source_type_union
367  
368 723 ▶sub inline_coercion {
Subroutine inline_coercion: called CC=9 SCAR=22.0
Pod documented
369 723 my $self = shift;
370 723 my $varname = $_[0];
371
372 723 ▶ _croak "This coercion cannot be inlined" unless $self->can_be_inlined;
Branch: 1 branch
BranchTrueFalseTotal
unless $self->can_be_inlined 0 723 723
373
374 723 my @mishmash = @{ $self->type_coercion_map };
375 723 ▶ return "($varname)" unless @mishmash;
Branch: 1 branch
BranchTrueFalseTotal
unless @mishmash 0 723 723
376
377 723 my ( @types, @codes );
378 723 ▶ while ( @mishmash ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@mishmash) 737 723 1460
379 737 push @types, shift @mishmash;
380 737 push @codes, shift @mishmash;
381 }
382 723 ▶ if ( $self->has_type_constraint ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_type_constraint) 723 0 723
383 723 unshift @types, $self->type_constraint;
384 723 unshift @codes, undef;
385 }
386
387 723 my @sub;
388
389 723 for my $i ( 0 .. $#types ) {
390 1460 push @sub, sprintf( '(%s) ?', $types[$i]->inline_check( $varname ) );
391 1460 ▶ push @sub,
Branch: 2 branches
BranchTrueFalseTotal
defined $codes[$i] && $varname eq '$_' ? : 18 1442 1460
defined $codes[$i] ? : 719 723 1442
Condition100%3/3
defined $codes[$i] and $varname eq "\$_"
!ll&&!rl&&r
72371918
MC/DC100%2/2
defined $codes[$i] and $varname eq "\$_"
defined $codes[$i] $varname eq "\$_"
Truth table100%3/3
A and B
A= defined $codes[$i]B= $varname eq "\$_"
ABresult
0X0
100
111
392 ( defined( $codes[$i] ) && ( $varname eq '$_' ) )
393 ? sprintf( 'scalar(do { %s }) :', $codes[$i] )
394 : defined( $codes[$i] ) ? sprintf(
395 'scalar(do { local $_ = %s; %s }) :', $varname,
396 $codes[$i]
397 )
398 : sprintf( '%s :', $varname );
399 } #/ for my $i ( 0 .. $#types)
400
401 723 push @sub, "$varname";
402
403 723 return join q[ ], @sub;
404 } #/ sub inline_coercion
405  
406 0 ▶sub _build_moose_coercion {
Subroutine _build_moose_coercion: not called CC=2 SCAR=17.9
407 0 my $self = shift;
408
409 0 my %options = ();
410 $options{type_coercion_map} =
411 0 [ $self->freeze->_codelike_type_coercion_map( 'moose_type' ) ];
412 0 ▶ $options{type_constraint} = $self->type_constraint
Branch: 1 branch
BranchTrueFalseTotal
if $self->has_type_constraint 0 0 0
413 if $self->has_type_constraint;
414
415 0 require Moose::Meta::TypeCoercion;
416 0 my $r = "Moose::Meta::TypeCoercion"->new( %options );
417
418 0 return $r;
419 } #/ sub _build_moose_coercion
420  
421 0 ▶sub _codelike_type_coercion_map {
Subroutine _codelike_type_coercion_map: not called CC=4 SCAR=30.0
422 0 my $self = shift;
423 0 my $modifier = $_[0];
424
425 0 my @orig = @{ $self->type_coercion_map };
426 0 my @new;
427
428 0 ▶ while ( @orig ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@orig) 0 0 0
429 0 my ( $type, $converter ) = splice( @orig, 0, 2 );
430
431 0 ▶ push @new, $modifier ? $type->$modifier : $type;
Branch: 1 branch
BranchTrueFalseTotal
$modifier ? : 0 0 0
432
433 0 ▶ if ( Types::TypeTiny::is_CodeLike( $converter ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if (Types::TypeTiny::is_CodeLike($converter)) { } 0 0 0
434 0 push @new, $converter;
435 }
436 else {
437 0 push @new, Eval::TypeTiny::eval_closure(
438 source => sprintf( 'sub { local $_ = $_[0]; %s }', $converter ),
439 description => sprintf( "temporary compiled converter from '%s'", $type ),
440 );
441 }
442 } #/ while ( @orig )
443
444 0 return @new;
445 } #/ sub _codelike_type_coercion_map
446  
447 995 ▶sub is_parameterizable {
Subroutine is_parameterizable: called CC=1 SCAR=0.0
Pod documented
448 995 shift->has_coercion_generator;
449 }
450  
451 23 ▶sub is_parameterized {
Subroutine is_parameterized: called CC=1 SCAR=0.0
Pod documented
452 23 shift->has_parameters;
453 }
454  
455 7 ▶sub parameterize {
Subroutine parameterize: called CC=3 SCAR=11.3
Pod documented
456 7 my $self = shift;
457 7 ▶ return $self unless @_;
Branch: 1 branch
BranchTrueFalseTotal
unless @_ 0 7 7
458 7 ▶ $self->is_parameterizable
Branch: 1 branch
BranchTrueFalseTotal
$self->is_parameterizable or &_croak("Constraint '%s' does not accept parameters", "$self") 7 0 7
459 or _croak "Constraint '%s' does not accept parameters", "$self";
460
461 7 @_ = map Types::TypeTiny::to_TypeTiny( $_ ), @_;
462
463 7 return ref( $self )->new(
464 type_constraint => $self->type_constraint,
465 type_coercion_map =>
466 [ $self->coercion_generator->( $self, $self->type_constraint, @_ ) ],
467 parameters => \@_,
468 frozen => 1,
469 parameterized_from => $self,
470 );
471 } #/ sub parameterize
472  
473 7 ▶sub _reparameterize {
Subroutine _reparameterize: called CC=2 SCAR=7.0
474 7 my $self = shift;
475 7 my ( $target_type ) = @_;
476
477 7 ▶ $self->is_parameterized or return $self;
Branch: 1 branch
BranchTrueFalseTotal
$self->is_parameterized or return $self 7 0 7
478 7 my $parent = $self->parameterized_from;
479
480 return ref( $self )->new(
481 type_constraint => $target_type,
482 type_coercion_map => [
483 7 $parent->coercion_generator->( $parent, $target_type, @{ $self->parameters } )
484 ],
485 parameters => \@_,
486 frozen => 1,
487 parameterized_from => $parent,
488 );
489 } #/ sub _reparameterize
490  
491 35 ▶sub isa {
Subroutine isa: called CC=8 SCAR=30.8
Pod documented
492 35 my $self = shift;
493
494 35 ▶ if ( $INC{"Moose/Meta/TypeCoercion.pm"}
Branch: 1 branch
BranchTrueFalseTotal
if ($INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self) and $_[0] eq "Moose::Meta::TypeCoercion") 0 35 35
Condition33%2/6
$INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self) and $_[0] eq "Moose::Meta::TypeCoercion"
!ll&&!rl&&r
3500
$INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self)
!ll&&!rl&&r
3500
MC/DC0%0/3
$INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self) and $_[0] eq "Moose::Meta::TypeCoercion"
$INC{"Moose/Meta/TypeCoercion.pm"} builtin::blessed($self) $_[0] eq "Moose::Meta::TypeCoercion"
Truth table25%1/4
A and B and C
A= $INC{"Moose/Meta/TypeCoercion.pm"}B= builtin::blessed($self)C= $_[0] eq "Moose::Meta::TypeCoercion"
ABCresult
0XX0
10X0
1100
1111
495 and blessed( $self )
496 and $_[0] eq 'Moose::Meta::TypeCoercion' )
497 {
498 0 return !!1;
499 }
500
501 35 ▶ if ( $INC{"Moose/Meta/TypeCoercion.pm"}
Branch: 1 branch
BranchTrueFalseTotal
if ($INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self) and $_[0] =~ /^(Class::MOP|MooseX?)::/) 0 35 35
Condition33%2/6
$INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self) and $_[0] =~ /^(Class::MOP|MooseX?)::/
!ll&&!rl&&r
3500
$INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self)
!ll&&!rl&&r
3500
MC/DC0%0/3
$INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self) and $_[0] =~ /^(Class::MOP|MooseX?)::/
$INC{"Moose/Meta/TypeCoercion.pm"} builtin::blessed($self) $_[0] =~ /^(Class::MOP|MooseX?)::/
Truth table25%1/4
A and B and C
A= $INC{"Moose/Meta/TypeCoercion.pm"}B= builtin::blessed($self)C= $_[0] =~ /^(Class::MOP|MooseX?)::/
ABCresult
0XX0
10X0
1100
1111
502 and blessed( $self )
503 and $_[0] =~ /^(Class::MOP|MooseX?)::/ )
504 {
505 0 my $r = $self->moose_coercion->isa( @_ );
506 0 ▶ return $r if $r;
Branch: 1 branch
BranchTrueFalseTotal
if $r 0 0 0
507 }
508
509 35 $self->SUPER::isa( @_ );
510 } #/ sub isa
511  
512 20 ▶sub can {
Subroutine can: called CC=5 SCAR=19.1
Pod documented
513 20 my $self = shift;
514
515 20 my $can = $self->SUPER::can( @_ );
516 20 ▶ return $can if $can;
Branch: 1 branch
BranchTrueFalseTotal
if $can 19 1 20
517
518 1 ▶ if ( $INC{"Moose/Meta/TypeCoercion.pm"}
Branch: 1 branch
BranchTrueFalseTotal
if ($INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self) and my $method = $self->moose_coercion->can(@_)) 0 1 1
Condition33%2/6
$INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self) and my $method = $self->moose_coercion->can(@_)
!ll&&!rl&&r
100
$INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self)
!ll&&!rl&&r
100
MC/DC0%0/3
$INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self) and my $method = $self->moose_coercion->can(@_)
$INC{"Moose/Meta/TypeCoercion.pm"} builtin::blessed($self) my $method = $self->moose_coercion->can(@_)
Truth table25%1/4
A and B and C
A= $INC{"Moose/Meta/TypeCoercion.pm"}B= builtin::blessed($self)C= my $method = $self->moose_coercion->can(@_)
ABCresult
0XX0
10X0
1100
1111
519 and blessed( $self )
520 and my $method = $self->moose_coercion->can( @_ ) )
521 {
522 0 ▶ return sub { $method->( shift->moose_coercion, @_ ) };
Subroutine __ANON__: not called CC=1 SCAR=6.9
523 }
524
525 1 return;
526 } #/ sub can
527  
528 803 ▶sub AUTOLOAD {
Subroutine AUTOLOAD: called CC=6 SCAR=31.7
529 803 my $self = shift;
530 803 my ( $m ) = ( our $AUTOLOAD =~ /::(\w+)$/ );
531 803 ▶ return if $m eq 'DESTROY';
Branch: 1 branch
BranchTrueFalseTotal
if $m eq "DESTROY" 803 0 803
532
533 0 ▶ if ( $INC{"Moose/Meta/TypeCoercion.pm"}
Branch: 1 branch
BranchTrueFalseTotal
if ($INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self) and my $method = $self->moose_coercion->can($m)) 0 0 0
Condition0%0/6
$INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self) and my $method = $self->moose_coercion->can($m)
!ll&&!rl&&r
000
$INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self)
!ll&&!rl&&r
000
MC/DC0%0/3
$INC{"Moose/Meta/TypeCoercion.pm"} and builtin::blessed($self) and my $method = $self->moose_coercion->can($m)
$INC{"Moose/Meta/TypeCoercion.pm"} builtin::blessed($self) my $method = $self->moose_coercion->can($m)
Truth table0%0/4
A and B and C
A= $INC{"Moose/Meta/TypeCoercion.pm"}B= builtin::blessed($self)C= my $method = $self->moose_coercion->can($m)
ABCresult
0XX0
10X0
1100
1111
534 and blessed( $self )
535 and my $method = $self->moose_coercion->can( $m ) )
536 {
537 0 return $method->( $self->moose_coercion, @_ );
538 }
539
540 0 ▶ _croak q[Can't locate object method "%s" via package "%s"], $m,
Condition0%0/3
ref $self || $self
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $self || $self
ref $self $self
Truth table0%0/3
A || B
A= ref $selfB= $self
ABresult
1X1
011
000
541 ref( $self ) || $self;
542 } #/ sub AUTOLOAD
543  
544 # Private Moose method, but Moo uses this...
545 2 ▶sub _compiled_type_coercion {
Subroutine _compiled_type_coercion: called CC=5 SCAR=16.3
546 2 my $self = shift;
547 2 ▶ if ( @_ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 2 0 2
548 2 my $thing = $_[0];
549 2 ▶ if ( blessed( $thing ) and $thing->isa( "Type::Coercion" ) ) {
Branch: 2 branches
BranchTrueFalseTotal
if (builtin::blessed($thing) and $thing->isa('Type::Coercion')) { } 1 1 2
elsif (Types::TypeTiny::is_CodeLike($thing)) { } 1 0 1
Condition66%2/3
builtin::blessed($thing) and $thing->isa("Type::Coercion")
!ll&&!rl&&r
101
MC/DC50%1/2
builtin::blessed($thing) and $thing->isa("Type::Coercion")
builtin::blessed($thing) $thing->isa("Type::Coercion")
Truth table66%2/3
A and B
A= builtin::blessed($thing)B= $thing->isa("Type::Coercion")
ABresult
0X0
100
111
550 1 $self->add_type_coercions( @{ $thing->type_coercion_map } );
551 }
552 elsif ( Types::TypeTiny::is_CodeLike( $thing ) ) {
553 1 require Types::Standard;
554 1 $self->add_type_coercions( Types::Standard::Any(), $thing );
555 }
556 } #/ if ( @_ )
557 2 $self->compiled_coercion;
558 } #/ sub _compiled_type_coercion
559  
560 277 *compile_type_coercion = \&compiled_coercion;
561 1 ▶sub meta { _croak( "Not really a Moose::Meta::TypeCoercion. Sorry!" ) }
Subroutine meta: called CC=1 SCAR=0.0
Pod documented
562  
563 277 1;
564  
565 __END__
« blib/lib/Type/Params/Signature.pm ↑ Summary blib/lib/Type/Params.pm »