lib/Perlmazing/Perlmazing/Precompile/is_utf8.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 14 | 14 | 100.0 |
branch | 6 | 6 | 100.0 |
condition | 2 | 3 | 66.6 |
subroutine | 3 | 3 | 100.0 |
pod | n/a | ||
total | 25 | 26 | 96.1 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | 32 | 32 | 313 | use Perlmazing qw(is_empty); | |||
32 | 74 | ||||||
32 | 191 | ||||||
2 | 32 | 32 | 19589 | use Encode; | |||
32 | 341948 | ||||||
32 | 5447 | ||||||
3 | |||||||
4 | sub main ($) { | ||||||
5 | 7 | 7 | 3574 | my $str = shift; | |||
6 | 7 | 100 | 21 | return '' unless not is_empty $str; | |||
7 | 5 | 9 | my $str2 = $str; | ||||
8 | 5 | 10 | eval { | ||||
9 | 5 | 15 | $str = Encode::decode('utf8', $str, Encode::FB_CROAK); | ||||
10 | }; | ||||||
11 | 5 | 100 | 209 | return 0 if $@; | |||
12 | 4 | 100 | 66 | 20 | return 1 if defined($str) and $str2 ne $str; | ||
13 | 3 | 8 | return 0; | ||||
14 | } | ||||||
15 |