lib/Pod/Coverage/More/Declared/Kavorka.pm

filter: Statementstmt 100% 23 / 23 Branchbran 75.0% 9 / 12 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod 100% 2 / 2 totaltotal 92.8% 39 / 42 CC 9 SCAR 17.1
CC
9
Cov
91%
declarations
8.1
applies_to
2.0
BEGIN
1.0
CRAP 5.5
« lib/Pod/Coverage/More/Declared/FunctionParameters.pm ↑ Summary blib/lib/Pod/Weaver/Section/Blurbs.pm »
1 # ABSTRACT: Declarations of the signatures of Kavorka
2 # PODNAME: Pod::Coverage::More::Declared::Kavorka
3  
4 package Pod::Coverage::More::Declared::Kavorka 0.003;
5  
6 13 ▶use 5.036;
Subroutine BEGIN: called CC=1 SCAR=0.0
7 13 ▶use warnings FATAL => q{all};
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 13 ▶use Package::Stash;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11  
12 # Whether L<Kavorka> is loaded, so that it can have declared subs of C<package>.
13 # @param package Str the name of the package
14 # @returns Bool
15 # @example next if !Pod::Coverage::More::Declared::Kavorka->applies_to('Some::Class');
16 42 ▶sub applies_to {
Subroutine applies_to: called CC=2 SCAR=6.9
Pod documented
17 42 ▶ return $INC{'Kavorka.pm'} ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$INC{'Kavorka.pm'} ? : 4 38 42
18 }
19  
20 # The declarations of the subs of C<package> that C<names> lists, as L<Pod::Coverage::More::Declared> describes them.
21 # @param package Str the name of the package
22 # @param names ArrayRef[Str] the names of the subs
23 # @returns HashRef from the name of each declared sub to its declaration
24 # @example my $declared = Pod::Coverage::More::Declared::Kavorka->declarations( 'Some::Class', ['new'] );
25 4 ▶sub declarations {
Subroutine declarations: called CC=8 SCAR=21.0
Pod documented
26 4 my ( $class, $package, $names ) = @_;
27 4 my $stash = Package::Stash->new($package);
28 4 my %declared;
29 4 foreach my $name (@$names) {
30 9 ▶ my $info = Kavorka->info( $stash->get_symbol("&$name") ) or next;
Branch: 1 branch
BranchTrueFalseTotal
my $info = "Kavorka"->info($stash->get_symbol("&$name")) or next 1 8 9
31 1 my $index = 0;
32 1 my @params;
33 1 foreach my $param ( @{ $info->signature->params } ) {
34 2 ▶ my %where = $param->named ? ( named => $param->named_names->[0] ) : ( index => $index++ );
Branch: 1 branch
BranchTrueFalseTotal
$param->named ? : 0 2 2
35 2 ▶ push @params, {
Branch: 2 branches
BranchTrueFalseTotal
$param->optional ? : 1 1 2
$param->invocant ? : 0 2 2
36 name => $param->name,
37 type => $param->type,
38 optional => $param->optional ? 1 : 0,
39 invocant => $param->invocant ? 1 : 0,
40 %where,
41 };
42 }
43 1 ▶ $declared{$name} = {
Branch: 1 branch
BranchTrueFalseTotal
$info->keyword eq 'method' ? : 0 1 1
44 via => 'Kavorka',
45 role => $info->keyword eq 'method' ? 'method' : 'function',
46 params => \@params,
47 returns => [],
48 };
49 }
50 4 return \%declared;
51 }
52  
53 13 1;
54  
55 __END__
« lib/Pod/Coverage/More/Declared/FunctionParameters.pm ↑ Summary blib/lib/Pod/Weaver/Section/Blurbs.pm »