lib/Type/Tiny/_DeclaredType.pm

filter: Statementstmt 96.9% 32 / 33 Branchbran 50.0% 5 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 100% 1 / 1 totaltotal 88.6% 47 / 53 CC 6 SCAR 6.4
CC
6
Cov
86%
new
3.1
__ANON__
2.1
__ANON__
2.1
CRAP 1.9
« blib/lib/Type/Tiny/_HalfOp.pm ↑ Summary blib/lib/Test/TypeTiny.pm »
1 package Type::Tiny::_DeclaredType;
2  
3 54 ▶use 5.008001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 54 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 54 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 54 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
8 54 $Type::Tiny::_DeclaredType::AUTHORITY = 'cpan:TOBYINK';
9 54 $Type::Tiny::_DeclaredType::VERSION = '2.010001';
10 }
11  
12 54 $Type::Tiny::_DeclaredType::VERSION =~ tr/_//d;
13  
14 54 ▶use Type::Tiny ();
Subroutine BEGIN: called CC=1 SCAR=0.0
15 54 our @ISA = qw( Type::Tiny );
16  
17 541 ▶sub new {
Subroutine new: called CC=3 SCAR=11.3
Pod documented
18 541 my $class = shift;
19 0 ▶ my %opts = @_ == 1 ? %{ +shift } : @_;
Branch: 1 branch
BranchTrueFalseTotal
@_ == 1 ? : 0 541 541
20
21 541 my $library = delete $opts{library};
22 541 my $name = delete $opts{name};
23
24 541 ▶ $library->can( 'get_type' )
Branch: 1 branch
BranchTrueFalseTotal
$library->can("get_type") or &Type::Tiny::_croak("Expected $library to be a type library, but it doesn't seem to be") 541 0 541
25 or Type::Tiny::_croak( "Expected $library to be a type library, but it doesn't seem to be" );
26
27 541 $opts{display_name} = $name;
28 2 ▶ $opts{constraint} = sub {
Subroutine __ANON__: called CC=2 SCAR=7.2
29 2 ▶ my $val = @_ ? pop : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 2 0 2
30 2 $library->get_type( $name )->check( $val );
31 541 };
32 135 ▶ $opts{inlined} = sub {
Subroutine __ANON__: called CC=2 SCAR=7.2
33 135 ▶ my $val = @_ ? pop : $_;
Branch: 1 branch
BranchTrueFalseTotal
@_ ? : 135 0 135
34 135 sprintf( '%s::is_%s(%s)', $library, $name, $val );
35 541 };
36 7 ▶ $opts{_build_coercion} = sub {
Subroutine __ANON__: called CC=2 SCAR=7.2
37 7 my $realtype = $library->get_type( $name );
38 7 ▶ $_[0] = $realtype->coercion if $realtype;
Branch: 1 branch
BranchTrueFalseTotal
if $realtype 0 7 7
39 541 };
40 541 $class->SUPER::new( %opts );
41 } #/ sub new
42  
43 54 1;
44  
45 __END__
« blib/lib/Type/Tiny/_HalfOp.pm ↑ Summary blib/lib/Test/TypeTiny.pm »