line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Locale::Maketext::Utils::Phrase::Norm::Compiles; |
2
|
|
|
|
|
|
|
|
3
|
4
|
|
|
4
|
|
4197
|
use strict; |
|
4
|
|
|
|
|
138
|
|
|
4
|
|
|
|
|
295
|
|
4
|
4
|
|
|
4
|
|
22
|
use warnings; |
|
4
|
|
|
|
|
7
|
|
|
4
|
|
|
|
|
308
|
|
5
|
4
|
|
|
4
|
|
1948
|
use Locale::Maketext::Utils (); |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
77
|
|
6
|
4
|
|
|
4
|
|
604
|
use Locale::Maketext::Utils::Phrase (); |
|
4
|
|
|
|
|
46
|
|
|
4
|
|
|
|
|
1768
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub normalize_maketext_string { |
9
|
89
|
|
|
89
|
0
|
183
|
my ($filter) = @_; |
10
|
|
|
|
|
|
|
|
11
|
89
|
|
|
|
|
753
|
my $string = $filter->get_orig_str(); |
12
|
89
|
|
|
|
|
388
|
my $mt_obj = $filter->get_maketext_object(); |
13
|
89
|
|
|
|
|
516
|
my $bn_regexp = Locale::Maketext::Utils::Phrase::get_bn_var_regexp(); |
14
|
|
|
|
|
|
|
|
15
|
89
|
|
|
|
|
6478
|
local $SIG{'__DIE__'}; # cpanel specific: ensure a benign eval does not trigger cpsrvd's DIE handler (may be made moot by internal case 50857) |
16
|
89
|
|
|
|
|
150
|
eval { |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# TODO: when we have a phrase class we can pass in proper args to each BN method, for now pass in a bunch of numbers tpo avoid warnings |
19
|
89
|
|
|
|
|
125
|
my $n = 0; |
20
|
89
|
|
|
|
|
804
|
my @args = map { $n++ } ( $string =~ m/($bn_regexp)/g ); |
|
72
|
|
|
|
|
319
|
|
21
|
|
|
|
|
|
|
|
22
|
89
|
|
|
|
|
714
|
$mt_obj->makethis( $string, @args ); |
23
|
|
|
|
|
|
|
}; |
24
|
|
|
|
|
|
|
|
25
|
89
|
100
|
|
|
|
5330
|
if ($@) { |
26
|
26
|
|
|
|
|
60
|
my $error = $@; |
27
|
|
|
|
|
|
|
|
28
|
26
|
|
|
|
|
239
|
$error =~ s/([\[\]])/~$1/g; |
29
|
26
|
|
|
|
|
178
|
$error =~ s/[\n\r]+/ /g; |
30
|
|
|
|
|
|
|
|
31
|
26
|
|
|
|
|
156
|
$string =~ s/([\[\]])/~$1/g; |
32
|
26
|
|
|
|
|
291
|
$error =~ s/\Q$string\E.*$/$string/; |
33
|
26
|
|
|
|
|
102
|
my $string_sr = $filter->get_string_sr(); |
34
|
26
|
100
|
|
|
|
174
|
if ( $error =~ m/Can't locate object method "(.*)" via package "(.*)"/i ) { |
|
|
50
|
|
|
|
|
|
35
|
10
|
|
|
|
|
41
|
$error = "“$2” does not have a method “$1” in: $string"; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
elsif ( $error =~ m/Undefined subroutine (\S+)/i ) { # odd but theoretically possible |
38
|
0
|
|
|
|
|
0
|
my $full_func = $1; |
39
|
0
|
|
|
|
|
0
|
my ( $f, @c ) = reverse( split( /::/, $full_func ) ); |
40
|
0
|
|
|
|
|
0
|
my $c = join( '::', reverse(@c) ); |
41
|
0
|
|
|
|
|
0
|
$error = "“$2” does not have a function “$1” in: $string"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
26
|
|
|
|
|
67
|
${$string_sr} = "[comment,Bracket Notation Error: $error]"; |
|
26
|
|
|
|
|
47
|
|
45
|
|
|
|
|
|
|
|
46
|
26
|
|
|
|
|
92
|
$filter->add_violation('Bracket Notation Error'); |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
89
|
|
|
|
|
374
|
return $filter->return_value; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
1; |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
__END__ |