line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package FormValidator::LazyWay::Rule::Japanese; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
26182
|
use strict; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
173
|
|
4
|
5
|
|
|
5
|
|
27
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
140
|
|
5
|
5
|
|
|
5
|
|
7867
|
use Encode (); |
|
5
|
|
|
|
|
95515
|
|
|
5
|
|
|
|
|
942
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
sub hiragana { |
8
|
12
|
|
|
12
|
1
|
37606
|
my $text = shift; |
9
|
12
|
|
|
|
|
31
|
my $args = shift; |
10
|
|
|
|
|
|
|
|
11
|
12
|
100
|
|
|
|
62
|
$text = Encode::decode('utf8', $text) |
12
|
|
|
|
|
|
|
if $args->{bytes}; |
13
|
|
|
|
|
|
|
|
14
|
12
|
100
|
|
|
|
247
|
if ( ref $args->{allow} eq 'ARRAY' ) { |
15
|
4
|
|
|
|
|
7
|
foreach my $allow ( @{$args->{allow}} ) { |
|
4
|
|
|
|
|
11
|
|
16
|
4
|
100
|
|
|
|
25
|
$allow = Encode::decode('utf8', $allow) |
17
|
|
|
|
|
|
|
if $args->{bytes}; |
18
|
4
|
|
|
|
|
101
|
$text =~ s{$allow}{}g; |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
|
22
|
5
|
100
|
|
5
|
|
2077
|
return ( $text =~ m{^\p{InHiragana}+$} ) ? 1 : 0; |
|
5
|
|
|
|
|
29
|
|
|
5
|
|
|
|
|
79
|
|
|
12
|
|
|
|
|
164
|
|
23
|
|
|
|
|
|
|
} |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub hiragana_loose { |
26
|
0
|
|
|
0
|
1
|
0
|
my $text = shift; |
27
|
0
|
|
|
|
|
0
|
my $args = shift; |
28
|
|
|
|
|
|
|
|
29
|
0
|
0
|
|
|
|
0
|
$text = Encode::decode('utf8', $text) |
30
|
|
|
|
|
|
|
if $args->{bytes}; |
31
|
|
|
|
|
|
|
|
32
|
0
|
0
|
|
|
|
0
|
return ( $text =~ m{^(\p{Common}|\p{InHiragana})+$} ) ? 1 : 0; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub katakana { |
36
|
22
|
|
|
22
|
1
|
53711
|
my $text = shift; |
37
|
22
|
|
|
|
|
40
|
my $args = shift; |
38
|
|
|
|
|
|
|
|
39
|
22
|
100
|
|
|
|
98
|
$text = Encode::decode('utf8', $text) |
40
|
|
|
|
|
|
|
if $args->{bytes}; |
41
|
|
|
|
|
|
|
|
42
|
22
|
100
|
|
|
|
341
|
if ( ref $args->{allow} eq 'ARRAY' ) { |
43
|
6
|
|
|
|
|
14
|
foreach my $allow ( @{$args->{allow}} ) { |
|
6
|
|
|
|
|
17
|
|
44
|
6
|
100
|
|
|
|
29
|
$allow = Encode::decode('utf8', $allow) |
45
|
|
|
|
|
|
|
if $args->{bytes}; |
46
|
6
|
|
|
|
|
199
|
$text =~ s{$allow}{}g; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
22
|
100
|
|
|
|
194
|
return ( $text =~ m{^\p{InKatakana}+$} ) ? 1 : 0; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=head1 NAME |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
FormValidator::LazyWay::Rule::Japanese - Japanese Rule |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
=head1 METHOD |
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
=head2 hiragana |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
=head2 hiragana_loose |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
=head2 katakana |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
=cut |
68
|
|
|
|
|
|
|
|