| 1 | package Salvation::TC::Parser; | ||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||
| 3 | 4 | ▶ | use strict; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 4 | 4 | ▶ | use warnings; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||
| 6 | 4 | ▶ | use Module::Load (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 7 | 4 | ▶ | use Class::Inspector (); | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||||||
| 9 | 4 | our $VERSION = 0.06; | |||||||||||||||||||||||||||||||
| 10 | 4 | our $BACKEND; | |||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||
| 12 | { | ||||||||||||||||||||||||||||||||
| 13 | 4 | my $loaded; | |||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||
| 15 | sub detect { | ||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||
| 17 | 4 | ▶ | $_[ 0 ] -> load_backend(); | ||||||||||||||||||||||||||||||
|
Subroutine
detect: called CC=3 SCAR=12.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 18 | 4 | ▶ | return $BACKEND if defined $BACKEND; | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||
| 20 | 4 | ▶ | if( eval { require Salvation::TC::Parser::XS; 1 } ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||
| 22 | 0 | $BACKEND = 'Salvation::TC::Parser::XS'; | |||||||||||||||||||||||||||||||
| 23 | 0 | $loaded = 1; | |||||||||||||||||||||||||||||||
| 24 | |||||||||||||||||||||||||||||||||
| 25 | } else { | ||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||
| 27 | 4 | $BACKEND = 'Salvation::TC::Parser::PP'; | |||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||
| 30 | 4 | $_[ 0 ] -> load_backend(); | |||||||||||||||||||||||||||||||
| 31 | 4 | return $BACKEND; | |||||||||||||||||||||||||||||||
| 32 | } | ||||||||||||||||||||||||||||||||
| 33 | |||||||||||||||||||||||||||||||||
| 34 | sub load_backend { | ||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||
| 36 | 8 | ▶ | return unless defined $BACKEND; | ||||||||||||||||||||||||||||||
|
Subroutine
load_backend: called CC=3 SCAR=11.0
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||||||
| 38 | 4 | ▶ | unless( $loaded ) { | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||||||
| 40 | 4 | $loaded = 1; | |||||||||||||||||||||||||||||||
| 41 | |||||||||||||||||||||||||||||||||
| 42 | 4 | Module::Load::load( $BACKEND ); | |||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||
| 45 | 4 | return; | |||||||||||||||||||||||||||||||
| 46 | } | ||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||
| 49 | { | ||||||||||||||||||||||||||||||||
| 50 | 4 | my $code; | |||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||
| 52 | sub tokenize_type_str { | ||||||||||||||||||||||||||||||||
| 53 | |||||||||||||||||||||||||||||||||
| 54 | 137 | ▶ | goto $code if defined $code; | ||||||||||||||||||||||||||||||
|
Subroutine
tokenize_type_str: called CC=2 SCAR=6.9
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||
| 56 | 4 | $_[ 0 ] -> detect(); | |||||||||||||||||||||||||||||||
| 57 | 4 | my $name = "${BACKEND}::tokenize_type_str_impl"; | |||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||
| 59 | 4 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||
| 61 | 4 | goto $code = *$name{ 'CODE' }; | |||||||||||||||||||||||||||||||
| 62 | } | ||||||||||||||||||||||||||||||||
| 63 | } | ||||||||||||||||||||||||||||||||
| 64 | |||||||||||||||||||||||||||||||||
| 65 | { | ||||||||||||||||||||||||||||||||
| 66 | 4 | my $code; | |||||||||||||||||||||||||||||||
| 67 | |||||||||||||||||||||||||||||||||
| 68 | sub tokenize_signature_str { | ||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||
| 70 | 0 | ▶ | goto $code if defined $code; | ||||||||||||||||||||||||||||||
|
Subroutine
tokenize_signature_str: not called CC=2 SCAR=11.6
Pod
undocumented
Branch: 1 branch
| |||||||||||||||||||||||||||||||||
| 71 | |||||||||||||||||||||||||||||||||
| 72 | 0 | $_[ 0 ] -> detect(); | |||||||||||||||||||||||||||||||
| 73 | 0 | my $name = "${BACKEND}::tokenize_signature_str_impl"; | |||||||||||||||||||||||||||||||
| 74 | |||||||||||||||||||||||||||||||||
| 75 | 4 | ▶ | no strict 'refs'; | ||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||
| 77 | 0 | goto $code = *$name{ 'CODE' }; | |||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||
| 79 | } | ||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||
| 81 | 4 | sub parameterizable_type_class_ns { | |||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||
| 83 | 51 | ▶ | return 'Salvation::TC::Meta::Type::Parameterized'; | ||||||||||||||||||||||||||||||
|
Subroutine
parameterizable_type_class_ns: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||||||
| 86 | { | ||||||||||||||||||||||||||||||||
| 87 | 4 | my $re = qr/^Salvation::TC::Type::(.+?)$/; | |||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||
| 89 | sub look_for_type_short_name { | ||||||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | my ( $self, $full_name ) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
look_for_type_short_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 92 | |||||||||||||||||||||||||||||||||
| 93 | 0 | return ( $full_name =~ $re )[ 0 ]; | |||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||
| 95 | } | ||||||||||||||||||||||||||||||||
| 96 | |||||||||||||||||||||||||||||||||
| 97 | 4 | sub load_parameterizable_type_class { | |||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||
| 99 | 51 | ▶ | my ( $self, $word ) = @_; | ||||||||||||||||||||||||||||||
|
Subroutine
load_parameterizable_type_class: called CC=6 SCAR=24.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||
| 101 | 51 | my $ns = $self -> parameterizable_type_class_ns(); | |||||||||||||||||||||||||||||||
| 102 | 51 | my $class = "${ns}::${word}"; | |||||||||||||||||||||||||||||||
| 103 | 51 | my $parameterizable_type = ''; | |||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||
| 105 | 51 | ▶ | if( | ||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition66%2/3
"Class::Inspector"->loaded($class) or eval {
do {
&Module::Load::load($class);
1
}
}
MC/DC0%0/2
"Class::Inspector"->loaded($class) or eval {
do {
&Module::Load::load($class);
1
}
}
"Class::Inspector"->loaded($class)
eval {
do {
&Module::Load::load($class);
1
}
}
Truth table66%2/3
A or B
A= "Class::Inspector"->loaded($class)B= eval {
do {
&Module::Load::load($class);
1
}
}
| |||||||||||||||||||||||||||||||||
| 106 | Class::Inspector -> loaded( $class ) | ||||||||||||||||||||||||||||||||
| 107 | 8 | || eval{ Module::Load::load( $class ); 1 } | |||||||||||||||||||||||||||||||
| 108 | ) { | ||||||||||||||||||||||||||||||||
| 109 | |||||||||||||||||||||||||||||||||
| 110 | 51 | $parameterizable_type = $class; | |||||||||||||||||||||||||||||||
| 111 | |||||||||||||||||||||||||||||||||
| 112 | } elsif( defined( $word = $self -> look_for_type_short_name( $word ) ) ) { | ||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||
| 114 | 0 | $class = "${ns}::${word}"; | |||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||
| 116 | 0 | ▶ | if( | ||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
"Class::Inspector"->loaded($class) or eval {
do {
&Module::Load::load($class);
1
}
}
MC/DC0%0/2
"Class::Inspector"->loaded($class) or eval {
do {
&Module::Load::load($class);
1
}
}
"Class::Inspector"->loaded($class)
eval {
do {
&Module::Load::load($class);
1
}
}
Truth table0%0/3
A or B
A= "Class::Inspector"->loaded($class)B= eval {
do {
&Module::Load::load($class);
1
}
}
| |||||||||||||||||||||||||||||||||
| 117 | Class::Inspector -> loaded( $class ) | ||||||||||||||||||||||||||||||||
| 118 | 0 | || eval{ Module::Load::load( $class ); 1 } | |||||||||||||||||||||||||||||||
| 119 | ) { | ||||||||||||||||||||||||||||||||
| 120 | |||||||||||||||||||||||||||||||||
| 121 | 0 | $parameterizable_type = $class; | |||||||||||||||||||||||||||||||
| 122 | } | ||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||
| 124 | |||||||||||||||||||||||||||||||||
| 125 | 51 | return $parameterizable_type; | |||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||
| 128 | 4 | 1; | |||||||||||||||||||||||||||||||
| 129 | |||||||||||||||||||||||||||||||||
| 130 | __END__ | ||||||||||||||||||||||||||||||||