Pad/Result/Generator.pm

filter: Statementstmt 97.2% 71 / 73 Branchbran n/a Conditioncond 66.6% 2 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 92.0% 23 / 25 Podpod 0.0% 0 / 2 totaltotal 91.4% 96 / 105 CC 3 SCAR 0.7
CC
3
Cov
96%
generate
2.0
mintClass
2.0
city
1.0
CRAP 1.1
« Pad/Spec/Arg.pm ↑ Summary Pad/ExitRequest.pm »
1 package Getopt::Pad::Result::Generator;
2  
3 9 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 9 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 9 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 9 ▶use experimental 'signatures';
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 9 ▶use Object::Pad qw(:experimental(mop));
Subroutine BEGIN: called CC=1 SCAR=0.0
9 9 ▶use Getopt::Pad::Result;
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 6 our $VERSION = '0.06';
12  
13 6 my $classCounter = 0;
14 5 my %classForReaders;
15  
16 95 ▶sub generate($level) {
Subroutine generate: called CC=2 SCAR=7.0
Pod undocumented
17 95 my @readers = sort map { $_->reader } $level->declaredOptions, $level->args;
18 95 my $cacheKey = join("\0", @readers);
19 95 ▶ return $classForReaders{$cacheKey} //= mintClass(@readers);
Condition66%2/3
$classForReaders{$cacheKey} //= mintClass(@readers)
l!l&&r!l&&!r
62330
MC/DC0%0/2
$classForReaders{$cacheKey} //= mintClass(@readers)
$classForReaders{$cacheKey} mintClass(@readers)
Truth table66%2/3
A //= B
A= $classForReaders{$cacheKey}B= mintClass(@readers)
ABresult
1X1
011
000
20 }
21  
22 33 ▶sub mintClass(@readers) {
Subroutine mintClass: called CC=2 SCAR=6.9
Pod undocumented
23 33 my $className = 'Getopt::Pad::Result::_' . ++$classCounter;
24 33 my $meta = Object::Pad::MOP::Class->create_class($className, isa => 'Getopt::Pad::Result');
25  
26 33 foreach my $reader (@readers) {
27 0 ▶ $meta->add_field('$' . $reader, param => $reader, default => undef, reader => $reader);
Subroutine input: called CC=1 SCAR=0.0
Subroutine inputs: called CC=1 SCAR=0.0
Subroutine output: called CC=1 SCAR=0.0
Subroutine owner: called CC=1 SCAR=0.0
Subroutine sourceUrl: called CC=1 SCAR=0.0
Subroutine color: called CC=1 SCAR=0.0
Subroutine format: called CC=1 SCAR=0.0
Subroutine height: called CC=1 SCAR=0.0
Subroutine path: called CC=1 SCAR=0.0
Subroutine tag: called CC=1 SCAR=0.0
Subroutine title: called CC=1 SCAR=0.0
Subroutine title: called CC=1 SCAR=0.0
Subroutine verbose: called CC=1 SCAR=0.0
Subroutine verbose: called CC=1 SCAR=0.0
Subroutine width: called CC=1 SCAR=0.0
Subroutine city: not called CC=1 SCAR=0.0
Subroutine define: not called CC=1 SCAR=0.0
28 }
29  
30 33 $meta->seal;
31 33 return $className;
32 }
33  
34 5 1;
35  
36 __END__
« Pad/Spec/Arg.pm ↑ Summary Pad/ExitRequest.pm »