| 1 | package Text::Xslate::PP::State; # implement tx_state_t | ||||||||||||||||||||||||||||||||||||||||||||||
| 2 | 190 | ▶ | use Mouse; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||||||
| 4 | 190 | ▶ | use Text::Xslate::Util qw(neat p $DEBUG); | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 5 | 190 | ▶ | use Text::Xslate::PP; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 6 | 190 | ▶ | use Text::Xslate::PP::Const qw( | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 7 | TXframe_NAME TXframe_RETADDR TXframe_OUTPUT | ||||||||||||||||||||||||||||||||||||||||||||||
| 8 | 190 | TX_VERBOSE_DEFAULT); | |||||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||||||
| 10 | 190 | if(!Text::Xslate::PP::_PP_ERROR_VERBOSE()) { | |||||||||||||||||||||||||||||||||||||||||||||
| 11 | 190 | our @CARP_NOT = qw( | |||||||||||||||||||||||||||||||||||||||||||||
| 12 | Text::Xslate::PP::Opcode | ||||||||||||||||||||||||||||||||||||||||||||||
| 13 | Text::Xslate::PP::Booter | ||||||||||||||||||||||||||||||||||||||||||||||
| 14 | Text::Xslate::PP::Method | ||||||||||||||||||||||||||||||||||||||||||||||
| 15 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 16 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||||||
| 18 | 190 | has vars => ( | |||||||||||||||||||||||||||||||||||||||||||||
| 19 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||
| 20 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||||||
| 22 | 190 | has tmpl => ( | |||||||||||||||||||||||||||||||||||||||||||||
| 23 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||
| 24 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||||||
| 26 | 190 | has engine => ( | |||||||||||||||||||||||||||||||||||||||||||||
| 27 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||
| 28 | weak_ref => 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 29 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||||||
| 31 | 190 | has frame => ( | |||||||||||||||||||||||||||||||||||||||||||||
| 32 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||
| 33 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||||||
| 35 | 190 | has current_frame => ( | |||||||||||||||||||||||||||||||||||||||||||||
| 36 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||
| 37 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||||||
| 39 | # opinfo is integrated into code | ||||||||||||||||||||||||||||||||||||||||||||||
| 40 | #has info => ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 41 | # is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||
| 42 | #); | ||||||||||||||||||||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||||||||||||||||||||
| 44 | 190 | has code => ( | |||||||||||||||||||||||||||||||||||||||||||||
| 45 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||
| 46 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 47 | |||||||||||||||||||||||||||||||||||||||||||||||
| 48 | 190 | has code_len => ( | |||||||||||||||||||||||||||||||||||||||||||||
| 49 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||
| 50 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||||||
| 52 | 190 | has symbol => ( | |||||||||||||||||||||||||||||||||||||||||||||
| 53 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||
| 54 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||||||
| 56 | 190 | has local_stack => ( | |||||||||||||||||||||||||||||||||||||||||||||
| 57 | is => 'rw', | ||||||||||||||||||||||||||||||||||||||||||||||
| 58 | ); | ||||||||||||||||||||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||||||||||||||||||||
| 60 | has encoding => ( | ||||||||||||||||||||||||||||||||||||||||||||||
| 61 | is => 'ro', | ||||||||||||||||||||||||||||||||||||||||||||||
| 62 | init_arg => undef, | ||||||||||||||||||||||||||||||||||||||||||||||
| 63 | lazy => 1, | ||||||||||||||||||||||||||||||||||||||||||||||
| 64 | 743 | ▶ | default => sub { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 65 | 743 | require Encode; | |||||||||||||||||||||||||||||||||||||||||||||
| 66 | 743 | return Encode::find_encoding('UTF-8'); | |||||||||||||||||||||||||||||||||||||||||||||
| 67 | }, | ||||||||||||||||||||||||||||||||||||||||||||||
| 68 | 190 | ); | |||||||||||||||||||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||||||||||||||||||||
| 70 | 1169 | ▶ | sub fetch { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch: called CC=8 SCAR=20.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 71 | # my ( $st, $var, $key, $frame, $line ) = @_; | ||||||||||||||||||||||||||||||||||||||||||||||
| 72 | 1169 | my $ret; | |||||||||||||||||||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||||||||||||||||||||
| 74 | 1169 | ▶ | if ( Scalar::Util::blessed($_[1]) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 75 | 701 | my $key = $_[2]; | |||||||||||||||||||||||||||||||||||||||||||||
| 76 | 701 | $ret = eval { $_[1]->$key() }; | |||||||||||||||||||||||||||||||||||||||||||||
| 77 | 701 | ▶ | $_[0]->error( [ $_[3], $_[4] ], "%s", $@ ) if $@; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 78 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 79 | elsif ( ref $_[1] eq 'HASH' ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 80 | 394 | ▶ | if ( defined $_[2] ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 81 | 392 | $ret = $_[1]->{ $_[2] }; | |||||||||||||||||||||||||||||||||||||||||||||
| 82 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 83 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 84 | 2 | $_[0]->warn( [ $_[3], $_[4] ], "Use of nil as a field key" ); | |||||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 87 | elsif ( ref $_[1] eq 'ARRAY' ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 88 | 71 | ▶ | if ( Scalar::Util::looks_like_number($_[2]) ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 89 | 69 | $ret = $_[1]->[ $_[2] ]; | |||||||||||||||||||||||||||||||||||||||||||||
| 90 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 91 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 92 | 2 | $_[0]->warn( [ $_[3], $_[4] ], "Use of %s as an array index", neat( $_[2] ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 93 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 95 | elsif ( $_[1] ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 96 | 1 | $_[0]->error( [ $_[3], $_[4] ], "Cannot access %s (%s is not a container)", neat($_[2]), neat($_[1]) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 98 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 99 | 2 | $_[0]->warn( [ $_[3], $_[4] ], "Use of nil to access %s", neat( $_[2] ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 101 | |||||||||||||||||||||||||||||||||||||||||||||||
| 102 | 1169 | return $ret; | |||||||||||||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||||||
| 105 | 880 | ▶ | sub fetch_symbol { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fetch_symbol: called CC=4 SCAR=17.3
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 106 | 880 | my ( $st, $name, $context ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 107 | |||||||||||||||||||||||||||||||||||||||||||||||
| 108 | 880 | my $symbol_table = $st->symbol; | |||||||||||||||||||||||||||||||||||||||||||||
| 109 | 880 | ▶ | if ( !exists $symbol_table->{ $name } ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 110 | 7 | ▶ | if(defined $context) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 111 | 0 | my($frame, $line) = @{$context}; | |||||||||||||||||||||||||||||||||||||||||||||
| 112 | 0 | ▶ | if ( defined $line ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 113 | 0 | $st->{ pc } = $line; | |||||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | $st->frame->[ $st->current_frame ]->[ TXframe_NAME ] = $frame; | |||||||||||||||||||||||||||||||||||||||||||||
| 115 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 117 | 7 | Carp::croak( sprintf( "Undefined symbol %s", $name ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 118 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||||||
| 120 | 873 | return $symbol_table->{ $name }; | |||||||||||||||||||||||||||||||||||||||||||||
| 121 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||||||||||||
| 123 | 39 | ▶ | sub localize { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
localize: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 124 | 39 | my($st, $key, $newval) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 125 | 39 | my $vars = $st->vars; | |||||||||||||||||||||||||||||||||||||||||||||
| 126 | 39 | my $preeminent = exists $vars->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||
| 127 | 39 | my $oldval = delete $vars->{$key}; | |||||||||||||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||||||||||||
| 129 | my $cleanup = $preeminent | ||||||||||||||||||||||||||||||||||||||||||||||
| 130 | 21 | ▶ | ? sub { $vars->{$key} = $oldval; return } | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 131 | 39 | ▶ | : sub { delete $vars->{$key}; return }; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 132 | |||||||||||||||||||||||||||||||||||||||||||||||
| 133 | 39 | ▶ | push @{ $st->{local_stack} ||= [] }, | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$st->{"local_stack"} ||= []
MC/DC100%1/1
$st->{"local_stack"} ||= []
$st->{"local_stack"}
Truth table100%2/2
A
A= $st->{"local_stack"}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 134 | bless($cleanup, 'Text::Xslate::PP::Guard'); | ||||||||||||||||||||||||||||||||||||||||||||||
| 135 | |||||||||||||||||||||||||||||||||||||||||||||||
| 136 | 39 | $vars->{$key} = $newval; | |||||||||||||||||||||||||||||||||||||||||||||
| 137 | 39 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||||||
| 140 | 6252 | ▶ | sub push_frame { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
push_frame: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 141 | 6252 | my ( $st, $name, $retaddr ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 142 | |||||||||||||||||||||||||||||||||||||||||||||||
| 143 | 6252 | ▶ | if ( $st->current_frame > 100 ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 144 | 2 | Carp::croak("Macro call is too deep (> 100)"); | |||||||||||||||||||||||||||||||||||||||||||||
| 145 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 146 | |||||||||||||||||||||||||||||||||||||||||||||||
| 147 | 6250 | ▶ | my $new = $st->frame->[ $st->current_frame( $st->current_frame + 1 ) ] | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$st->frame->[$st->current_frame($st->current_frame + 1)] ||= []
MC/DC100%1/1
$st->frame->[$st->current_frame($st->current_frame + 1)] ||= []
$st->frame->[$st->current_frame($st->current_frame + 1)]
Truth table100%2/2
A
A= $st->frame->[$st->current_frame($st->current_frame + 1)]
| |||||||||||||||||||||||||||||||||||||||||||||||
| 148 | ||= []; | ||||||||||||||||||||||||||||||||||||||||||||||
| 149 | 6250 | $new->[ TXframe_NAME ] = $name; | |||||||||||||||||||||||||||||||||||||||||||||
| 150 | 6250 | $new->[ TXframe_RETADDR ] = $retaddr; | |||||||||||||||||||||||||||||||||||||||||||||
| 151 | 6250 | return $new; | |||||||||||||||||||||||||||||||||||||||||||||
| 152 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 153 | |||||||||||||||||||||||||||||||||||||||||||||||
| 154 | 2070 | ▶ | sub pop_frame { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pop_frame: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 155 | 2070 | my( $st, $replace_output ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 156 | 2070 | $st->current_frame( $st->current_frame - 1 ); | |||||||||||||||||||||||||||||||||||||||||||||
| 157 | 2070 | ▶ | if($replace_output) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 158 | 1233 | my $top = $st->frame->[ $st->current_frame + 1]; | |||||||||||||||||||||||||||||||||||||||||||||
| 159 | ($st->{output}, $top->[ TXframe_OUTPUT ]) | ||||||||||||||||||||||||||||||||||||||||||||||
| 160 | 1233 | = ($top->[ TXframe_OUTPUT ], $st->{output}); | |||||||||||||||||||||||||||||||||||||||||||||
| 161 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 162 | |||||||||||||||||||||||||||||||||||||||||||||||
| 163 | 2070 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 164 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||||||
| 166 | 8676 | ▶ | sub pad { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
pad: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 167 | 8676 | return $_[0]->{frame}->[ $_[0]->{current_frame} ]; | |||||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||||||
| 170 | 621302 | ▶ | sub op_arg { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
op_arg: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 171 | 621302 | $_[0]->{ code }->[ $_[0]->{ pc } ]->{ arg }; | |||||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||||||
| 174 | 4142 | ▶ | sub print { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print: called CC=10 SCAR=23.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 175 | 4142 | my($st, $sv, $frame_and_line) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 176 | 4142 | ▶ | if ( ref( $sv ) eq Text::Xslate::PP::TXt_RAW ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||||||
| 177 | 494 | ▶ | if(defined ${$sv}) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 178 | $st->{output} .= | ||||||||||||||||||||||||||||||||||||||||||||||
| 179 | 78 | ▶ | (utf8::is_utf8($st->{output}) && !utf8::is_utf8(${$sv})) | ||||||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
eval {
do {
$st->encoding->decode(${$sv;}, &Encode::FB_CROAK())
}
} or ${$sv;}
MC/DC0%0/2
eval {
do {
$st->encoding->decode(${$sv;}, &Encode::FB_CROAK())
}
} or ${$sv;}
eval {
do {
$st->encoding->decode(${$sv;}, &Encode::FB_CROAK())
}
}
${$sv;}
Truth table66%2/3
A or B
A= eval {
do {
$st->encoding->decode(${$sv;}, &Encode::FB_CROAK())
}
}B= ${$sv;}
| |||||||||||||||||||||||||||||||||||||||||||||||
| 180 | 13 | ? eval {$st->encoding->decode(${$sv}, Encode::FB_CROAK())} || ${$sv} | |||||||||||||||||||||||||||||||||||||||||||||
| 181 | 494 | ▶ | : ${$sv}; | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
utf8::is_utf8($st->{"output"}) and not utf8::is_utf8(${$sv;})
MC/DC100%2/2
utf8::is_utf8($st->{"output"}) and not utf8::is_utf8(${$sv;})
utf8::is_utf8($st->{"output"})
not utf8::is_utf8(${$sv;})
Truth table100%3/3
A and not(B)
A= utf8::is_utf8($st->{"output"})B= not utf8::is_utf8(${$sv;})
| |||||||||||||||||||||||||||||||||||||||||||||||
| 182 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 183 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | $st->warn($frame_and_line, "Use of nil to print" ); | |||||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 187 | elsif ( defined $sv ) { | ||||||||||||||||||||||||||||||||||||||||||||||
| 188 | 3587 | $sv =~ s/($Text::Xslate::PP::html_metachars)/$Text::Xslate::PP::html_escape{$1}/xmsgeo; | |||||||||||||||||||||||||||||||||||||||||||||
| 189 | $st->{output} .= | ||||||||||||||||||||||||||||||||||||||||||||||
| 190 | (utf8::is_utf8($st->{output}) && !utf8::is_utf8($sv)) | ||||||||||||||||||||||||||||||||||||||||||||||
| 191 | 3587 | ▶ | ? eval {$st->encoding->decode($sv, Encode::FB_CROAK())} || $sv | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
utf8::is_utf8($st->{"output"}) and not utf8::is_utf8($sv)
eval {
do {
$st->encoding->decode($sv, &Encode::FB_CROAK())
}
} or $sv
MC/DC100%2/2
utf8::is_utf8($st->{"output"}) and not utf8::is_utf8($sv)
utf8::is_utf8($st->{"output"})
not utf8::is_utf8($sv)
MC/DC0%0/2
eval {
do {
$st->encoding->decode($sv, &Encode::FB_CROAK())
}
} or $sv
eval {
do {
$st->encoding->decode($sv, &Encode::FB_CROAK())
}
}
$sv
Truth table100%3/3
A and not(B)
A= utf8::is_utf8($st->{"output"})B= not utf8::is_utf8($sv)
Truth table66%2/3
A or B
A= eval {
do {
$st->encoding->decode($sv, &Encode::FB_CROAK())
}
}B= $sv
| |||||||||||||||||||||||||||||||||||||||||||||||
| 192 | : $sv; | ||||||||||||||||||||||||||||||||||||||||||||||
| 193 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 194 | else { | ||||||||||||||||||||||||||||||||||||||||||||||
| 195 | 61 | $st->warn( $frame_and_line, "Use of nil to print" ); | |||||||||||||||||||||||||||||||||||||||||||||
| 196 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 197 | 4141 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||||||
| 200 | 59 | ▶ | sub _doerror { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_doerror: called CC=3 SCAR=11.3
| |||||||||||||||||||||||||||||||||||||||||||||||
| 201 | 59 | my ( $st, $context, $fmt, @args ) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 202 | 59 | ▶ | if(defined $context) { # hack to share it with PP::Booster and PP::Opcode | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 203 | 8 | my($frame, $line) = @{$context}; | |||||||||||||||||||||||||||||||||||||||||||||
| 204 | 8 | ▶ | if ( defined $line ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | $st->{ pc } = $line; | |||||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | $st->frame->[ $st->current_frame ]->[ TXframe_NAME ] = $frame; | |||||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 208 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 209 | 59 | Carp::carp( sprintf( $fmt, @args ) ); | |||||||||||||||||||||||||||||||||||||||||||||
| 210 | 53 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||||||
| 213 | 78 | ▶ | sub warn :method { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
warn: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 214 | 78 | my $st = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 215 | 78 | ▶ | if( $st->engine->{verbose} > TX_VERBOSE_DEFAULT ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 216 | 37 | $st->_doerror(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 217 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 218 | 76 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 219 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 220 | |||||||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||||||
| 222 | 29 | ▶ | sub error :method { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 223 | 29 | my $st = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 224 | 29 | ▶ | if( $st->engine->{verbose} >= TX_VERBOSE_DEFAULT ) { | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 225 | 22 | $st->_doerror(@_); | |||||||||||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 227 | 25 | return; | |||||||||||||||||||||||||||||||||||||||||||||
| 228 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 229 | |||||||||||||||||||||||||||||||||||||||||||||||
| 230 | 1 | ▶ | sub bad_arg { | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
bad_arg: called CC=2 SCAR=7.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||||||
| 231 | 1 | my $st = shift; | |||||||||||||||||||||||||||||||||||||||||||||
| 232 | 1 | ▶ | unshift @_, undef if @_ == 1; # hack to share it with PP::Booster and PP::Opcode | ||||||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||||||
| 233 | 1 | my($context, $name) = @_; | |||||||||||||||||||||||||||||||||||||||||||||
| 234 | 1 | return $st->error($context, "Wrong number of arguments for %s", $name); | |||||||||||||||||||||||||||||||||||||||||||||
| 235 | } | ||||||||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||||||
| 237 | 190 | ▶ | no Mouse; | ||||||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||||||
| 238 | 190 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||||||||||||||||||||||||||||
| 239 | 190 | 1; | |||||||||||||||||||||||||||||||||||||||||||||
| 240 | __END__ | ||||||||||||||||||||||||||||||||||||||||||||||