| 1 | package Dispatch::Class; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 2 | our $VERSION = '0.04'; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 2 | ▶ | use Scalar::Util qw(blessed); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 2 | ▶ | use parent 'Exporter::Tiny'; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 11 | 2 | our @EXPORT_OK = qw( | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 12 | class_case | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 13 | dispatch | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 14 | ); | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 15 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 16 | 2 | ▶ | sub class_case { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
class_case: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 17 | 2 | my @prototable = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 16 | ▶ | sub { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=10 SCAR=23.1
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 19 | 16 | my ($x) = @_; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 20 | 16 | my $blessed = blessed $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 21 | 16 | my $ref = ref $x; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 16 | my $DOES; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 23 | 16 | my @table = @prototable; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 24 | 16 | ▶ | while (my ($key, $value) = splice @table, 0, 2) { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 25 | 62 | ▶ | return $value if | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
Condition75%6/8
$blessed and $DOES ||= $x->can("DOES") || "isa", $x->$DOES($key)
$DOES ||= $x->can("DOES") || "isa"
$x->can('DOES') || 'isa'
MC/DC100%2/2
$blessed and $DOES ||= $x->can("DOES") || "isa", $x->$DOES($key)
$blessed
$DOES ||= $x->can("DOES") || "isa", $x->$DOES($key)
MC/DC0%0/2
$DOES ||= $x->can("DOES") || "isa"
$DOES
$x->can('DOES')
Truth table100%3/3
A and B
A= $blessedB= $DOES ||= $x->can("DOES") || "isa", $x->$DOES($key)
Truth table66%2/3
A ||= B
A= $DOESB= $x->can('DOES')
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 26 | !defined $key ? !defined $x : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 27 | $key eq '*' ? 1 : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 28 | $key eq ':str' ? !$ref : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 29 | $key eq $ref ? 1 : | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 30 | $blessed && ($DOES ||= $x->can('DOES') || 'isa', $x->$DOES($key)) | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 31 | ; | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 33 | () | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 34 | 2 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 2 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 37 | 1 | ▶ | sub dispatch { | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dispatch: called CC=1 SCAR=0.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 38 | 1 | my $chk = &class_case; | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 39 | 12 | ▶ | sub { ($chk->($_[0]) || return)->($_[0]) } | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
Condition50%1/2
&$chk($_[0]) || (return)
MC/DC0%0/1
&$chk($_[0]) || (return)
&$chk($_[0])
Truth table50%1/2
A
A= &$chk($_[0])
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 40 | 1 | } | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 42 | 2 | 'ok' | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
| 44 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||