| 1 | 25 | ▶ | use v5.44; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 25 | ▶ | use utf8; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 25 | ▶ | use experimental qw(class keyword_any); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | # How a girl transforms with her buddies: what she checks first, what the team says before and after, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | # and how the buddies transform. This is the girl transforming on her own; the girls of a series | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | # transform as `transform` of the series in Acme::PrettyCure::Data says, with the subclasses below: | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | # | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | # futari Acme::PrettyCure::Team::Futari | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | # each Acme::PrettyCure::Team::Each | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | # chain Acme::PrettyCure::Team::Chain | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | class Acme::PrettyCure::Team; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | 25 | ▶ | use Acme::PrettyCure::Data; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | # `transform` of the series (the calls, the finale), or empty for a girl on her own. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 25 | field $how :param :reader = {}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | # The team of a girl: how her series transforms, unless she transforms on her own. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 270 | ▶ | sub for_girl ($class, $girl) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
for_girl: called CC=5 SCAR=16.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 270 | ▶ | return Acme::PrettyCure::Team->new if ($girl->transform_style // '') eq 'alone'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%2/2
$girl->transform_style // ""
MC/DC100%1/1
$girl->transform_style // ""
$girl->transform_style
Truth table100%2/2
A
A= $girl->transform_style
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 256 | ▶ | my $series = Acme::PrettyCure::Data->series($girl->series_name // '') | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition50%1/2
$girl->series_name // ""
MC/DC0%0/1
$girl->series_name // ""
$girl->series_name
Truth table50%1/2
A
A= $girl->series_name
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | or return Acme::PrettyCure::Team->new; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 256 | my $how = $series->{transform}; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 256 | return "Acme::PrettyCure::Team::\u$how->{style}"->new(how => $how); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | 270 | ▶ | method transform ($leader, @buddies) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
transform: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | 270 | $self->check_needs($leader, @buddies); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | 238 | $self->before($leader, @buddies); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 238 | $leader->transform_alone; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | 237 | $self->after($leader, @buddies); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | 237 | return $leader; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | # The buddy the leader cannot transform without (`needs`): one of the buddies. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 225 | ▶ | method check_needs ($leader, @buddies) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_needs: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 225 | ▶ | my $needs = $leader->needs or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 20 | my $buddy = "Acme::PrettyCure::Girl::$needs->{buddy}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 20 | ▶ | die "$needs->{message}\n" unless any { $_ isa $buddy } @buddies; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | # The name of the user, to call out to: of the account, or else of USER, LOGNAME or USERNAME (a uid | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | # with no entry in /etc/passwd, as in a container; Windows, which has no getpwuid), or else someone. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 45 | 9 | ▶ | sub user_name ($account = account_name()) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
user_name: called CC=6 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 46 | 9 | ▶ | $account // $ENV{USER} // $ENV{LOGNAME} // $ENV{USERNAME} // 'だれか'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%11/11
((($account // $ENV{"USER"}) // $ENV{"LOGNAME"}) // $ENV{"USERNAME"}) // "\x{3060}\x{308c}\x{304b}"
(($account // $ENV{"USER"}) // $ENV{"LOGNAME"}) // $ENV{"USERNAME"}
($account // $ENV{"USER"}) // $ENV{"LOGNAME"}
$account // $ENV{"USER"}
MC/DC100%4/4
((($account // $ENV{"USER"}) // $ENV{"LOGNAME"}) // $ENV{"USERNAME"}) // "\x{3060}\x{308c}\x{304b}"
$account
$ENV{"USER"}
$ENV{"LOGNAME"}
$ENV{"USERNAME"}
Truth table100%5/5
A // B // C // D
A= $accountB= $ENV{"USER"}C= $ENV{"LOGNAME"}D= $ENV{"USERNAME"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 49 | # The name of the account of the user, or undef. getpwuid dies on Windows ("unimplemented"). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 50 | 4 | ▶ | sub account_name () { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
account_name: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 51 | 4 | eval { scalar getpwuid $> } | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 54 | # Nothing, unless a subclass says. Not an empty block: B::Deparse of Perl 5.44.0 (and Devel::Cover, | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 55 | # which uses it) dies on a method with a signature and an empty body (t/90_perl_features.t). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 114 | ▶ | method before ($leader, @buddies) { return } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
before: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 57 | 14 | ▶ | method after ($leader, @buddies) { return } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 59 | # Whether the leader starts the transform of her team: the first buddy has not transformed yet. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 60 | 248 | ▶ | method is_first (@buddies) { !($buddies[0] && $buddies[0]->is_precure) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_first: called CC=2 SCAR=6.9
Pod
undocumented
Condition100%3/3
$buddies[0] && $buddies[0]->is_precure
MC/DC100%2/2
$buddies[0] && $buddies[0]->is_precure
$buddies[0]
$buddies[0]->is_precure
Truth table100%3/3
A && B
A= $buddies[0]B= $buddies[0]->is_precure
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 62 | # Says the lines with the placeholders filled in for this many buddies ({!}, {count}). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 63 | 108 | ▶ | method say_lines ($leader, $lines, @buddies) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
say_lines: called CC=4 SCAR=13.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 108 | my $excla = '!' x (@buddies + 1); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 108 | ▶ | my $count = ($how->{count} // [])->[ scalar @buddies ] // ''; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%4/4
($how->{"count"} // [])->[scalar @buddies] // ""
$how->{"count"} // []
MC/DC100%1/1
($how->{"count"} // [])->[scalar @buddies] // ""
$how->{"count"}
Truth table100%2/2
A
A= $how->{"count"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 66 | 108 | for my $line (@$lines) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 67 | 130 | $leader->say($line =~ s/\{!\}/$excla/gr =~ s/\{count\}/$count/gr); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # A pair: the leader needs her partner as the first buddy, who transforms with her without a word. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 72 | class Acme::PrettyCure::Team::Futari :isa(Acme::PrettyCure::Team); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 45 | ▶ | method check_needs ($leader, @buddies) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
check_needs: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 45 | ▶ | my $needs = $leader->needs or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 76 | 45 | my $buddy = "Acme::PrettyCure::Girl::$needs->{buddy}"; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 77 | 45 | ▶ | die "$needs->{message}\n" unless $buddies[0] && $buddies[0] isa $buddy; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$buddies[0] and $buddies[0] isa $buddy
MC/DC100%2/2
$buddies[0] and $buddies[0] isa $buddy
$buddies[0]
$buddies[0] isa $buddy
Truth table100%3/3
A and B
A= $buddies[0]B= $buddies[0] isa $buddy
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 79 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 21 | ▶ | method after ($leader, @buddies) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after: called CC=3 SCAR=12.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 21 | ▶ | my $buddy = $buddies[0] or return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 82 | 21 | ▶ | $buddy->is_precure(true) unless $buddy->is_precure; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 85 | # Each girl transforms on her own; the whole team (`finale_with` buddies) says the finale. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 86 | class Acme::PrettyCure::Team::Each :isa(Acme::PrettyCure::Team); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 78 | ▶ | method after ($leader, @buddies) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after: called CC=3 SCAR=11.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 78 | $_->transform for @buddies; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 90 | $self->say_lines($leader, $self->how->{finale}, @buddies) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 91 | 78 | ▶ | if @buddies == $self->how->{finale_with}; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 94 | # The leader calls, the buddies transform after her, and she says the finale. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 95 | class Acme::PrettyCure::Team::Chain :isa(Acme::PrettyCure::Team); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 97 | 124 | ▶ | method before ($leader, @buddies) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
before: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 98 | 124 | ▶ | return unless $self->is_first(@buddies); | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 60 | ▶ | my $call = $leader->call // $self->how->{call} // return; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%5/5
($leader->call // $self->how->{"call"}) // (return)
$leader->call // $self->how->{"call"}
MC/DC100%2/2
($leader->call // $self->how->{"call"}) // (return)
$leader->call
$self->how->{"call"}
Truth table100%3/3
A // B
A= $leader->callB= $self->how->{"call"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 100 | 55 | $self->say_lines($leader, [$call], @buddies); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 103 | 124 | ▶ | method after ($leader, @buddies) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
after: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 104 | 124 | my $first = $self->is_first(@buddies); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 124 | for my $buddy (@buddies) { | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 128 | ▶ | $buddy->transform($leader) unless $buddy->is_precure; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 124 | ▶ | if (!@buddies && ($self->how->{alone} // '') eq 'message') { | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition100%5/5
not @buddies and ($self->how->{"alone"} // "") eq "message"
$self->how->{"alone"} // ""
MC/DC100%2/2
not @buddies and ($self->how->{"alone"} // "") eq "message"
not @buddies
$self->how->{"alone"}
Truth table100%3/3
not(A) and B
A= not @buddiesB= $self->how->{"alone"}
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 110 | # Some of the messages call out to the user by name (%s). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 15 | my $message = $leader->message; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 112 | 15 | ▶ | $message = sprintf $message, Acme::PrettyCure::Team::user_name() if $message =~ /%s/; | ||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 15 | $leader->say($message); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 114 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 115 | elsif ($first) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 116 | 45 | $self->say_lines($leader, $self->how->{finale}, @buddies); | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 25 | 1; | |||||||||||||||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 122 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||