| 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)
MC/DC0%0/2
$classForReaders{$cacheKey} //= mintClass(@readers)
$classForReaders{$cacheKey}
mintClass(@readers)
Truth table66%2/3
A //= B
A= $classForReaders{$cacheKey}B= mintClass(@readers)
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||