Pad/Result.pm

filter: Statementstmt 91.3% 42 / 46 Branchbran 80.0% 8 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 8 / 8 Podpod 80.0% 4 / 5 totaltotal 89.8% 62 / 69 CC 6 SCAR 8.3
CC
6
Cov
89%
reservesReader
4.0
help
2.2
version
2.2
CRAP 2.3
« Pad/Type/Path.pm ↑ Summary Pad/Type.pm »
1 11 ▶use v5.26;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 11 ▶use Object::Pad qw(:experimental(mop));
Subroutine BEGIN: called CC=1 SCAR=0.0
3  
4 class Getopt::Pad::Result {
5 11 ▶ use Carp qw(croak);
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 11 our $VERSION = '0.04';
8  
9 # Names Perl looks up on an object by itself; a Reader by one of these
10 # would run at the wrong time with the wrong arguments.
11 11 my %isPerlHook = map { $_ => 1 } qw(DESTROY AUTOLOAD);
12  
13 field $command :param :reader = undef;
14 6 ▶ field $subcommand :param :reader = undef;
Subroutine command: called CC=1 SCAR=0.0
Pod documented
15 30 ▶ field $helper :param = undef;
Subroutine subcommand: called CC=1 SCAR=0.0
Pod documented
16  
17 # Whether a Reader named $name would clash with what every Result
18 # already answers to: a method (including the ones Object::Pad and
19 # UNIVERSAL provide), a constructor param, or a Perl hook. Derived from
20 # the class itself, so nothing here can drift from it.
21 541 ▶ method reservesReader :common ($name) {
Subroutine reservesReader: called CC=4 SCAR=13.9
Pod undocumented
22 541 ▶ return 1 if $isPerlHook{$name};
Branch: 1 branch
BranchTrueFalseTotal
if $isPerlHook{$name} 3 538 541
23 538 ▶ return 1 if $class->can($name);
Branch: 1 branch
BranchTrueFalseTotal
if $class->can($name) 11 527 538
24 527 my @params = map { $_->get_attribute_value('param') } grep { $_->has_attribute('param') } Object::Pad::MOP::Class->for_class($class)->fields;
25 527 ▶ return (grep { $_ eq $name } @params) ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
grep({$_ eq $name;} @params) ? : 2 525 527
26 11 }
27  
28 1 ▶ method help() {
Subroutine help: called CC=2 SCAR=7.9
Pod documented
29 1 ▶ croak 'Getopt::Pad: no help renderer attached to this result' unless defined $helper;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $helper 1 0 1
30 0 $helper->printHelp;
31 0 exit 0;
32 11 }
33  
34 1 ▶ method version() {
Subroutine version: called CC=2 SCAR=7.9
Pod documented
35 1 ▶ croak 'Getopt::Pad: no help renderer attached to this result' unless defined $helper;
Branch: 1 branch
BranchTrueFalseTotal
unless defined $helper 1 0 1
36 0 $helper->printVersion;
37 0 exit 0;
38 11 }
39 }
40  
41 11 1;
42  
43 __END__
« Pad/Type/Path.pm ↑ Summary Pad/Type.pm »