Types/Wrapper.pm

filter: Statementstmt 100% 23 / 23 Branchbran 66.6% 4 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 94.1% 32 / 34 CC 5 SCAR 11.8
CC
5
Cov
93%
import
5.1
BEGIN
1.0
BEGIN
1.0
CRAP 3.3
« Types/Combine.pm ↑ Summary Types/Util.pm »
1 package MooseX::Types::Wrapper;
2 # ABSTRACT: Wrap exports from a library
3  
4 1 our $VERSION = '0.51';
5  
6 1 ▶use Carp::Clan qw( ^MooseX::Types );
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Module::Runtime 'use_module';
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 ▶use parent 'MooseX::Types';
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 #pod =head1 DESCRIPTION
14 #pod
15 #pod See L<MooseX::Types/SYNOPSIS> for detailed usage.
16 #pod
17 #pod =head1 METHODS
18 #pod
19 #pod =head2 import
20 #pod
21 #pod =cut
22  
23 1 ▶sub import {
Subroutine import: called CC=5 SCAR=16.2
24 1 my ($class, @args) = @_;
25 1 ▶ my %libraries = @args == 1 ? (Moose => $args[0]) : @args;
Branch: 1 branch
BranchTrueFalseTotal
@args == 1 ? : 0 1 1
26  
27 1 for my $l (keys %libraries) {
28  
29 croak qq($class expects an array reference as import spec)
30 2 ▶ unless ref $libraries{ $l } eq 'ARRAY';
Branch: 1 branch
BranchTrueFalseTotal
unless ref $libraries{$l} eq "ARRAY" 0 2 2
31  
32 2 ▶ my $library_class
Branch: 1 branch
BranchTrueFalseTotal
$l eq 'Moose' ? : 1 1 2
33 = ($l eq 'Moose' ? 'MooseX::Types::Moose' : $l );
34 2 use_module($library_class);
35  
36 $library_class->import({
37 -into => scalar(caller),
38 -wrapper => $class,
39 2 }, @{ $libraries{ $l } });
40 }
41 1 return 1;
42 }
43  
44 1 1;
45  
46 __END__
« Types/Combine.pm ↑ Summary Types/Util.pm »