line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Mock::Person::JP; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
28592
|
use 5.008_001; |
|
3
|
|
|
|
|
9
|
|
|
3
|
|
|
|
|
109
|
|
4
|
3
|
|
|
3
|
|
15
|
use strict; |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
83
|
|
5
|
3
|
|
|
3
|
|
13
|
use warnings; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
77
|
|
6
|
3
|
|
|
3
|
|
14
|
use Carp (); |
|
3
|
|
|
|
|
4
|
|
|
3
|
|
|
|
|
37
|
|
7
|
3
|
|
|
3
|
|
2805
|
use File::ShareDir (); |
|
3
|
|
|
|
|
22576
|
|
|
3
|
|
|
|
|
71
|
|
8
|
3
|
|
|
3
|
|
2675
|
use File::RandomLine (); |
|
3
|
|
|
|
|
12136
|
|
|
3
|
|
|
|
|
72
|
|
9
|
3
|
|
|
3
|
|
10415
|
use Mock::Person::JP::Person (); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
1765
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = "0.07"; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
sub new |
14
|
|
|
|
|
|
|
{ |
15
|
5
|
|
|
5
|
1
|
8949
|
my ($class) = @_; |
16
|
|
|
|
|
|
|
|
17
|
5
|
|
|
|
|
17
|
my $self = bless {}, $class; |
18
|
|
|
|
|
|
|
|
19
|
5
|
|
|
|
|
28
|
$self->{sei} = File::RandomLine->new( File::ShareDir::dist_file('Mock-Person-JP', 'sei.tsv') ); |
20
|
5
|
|
|
|
|
1614
|
$self->{mei}{male} = File::RandomLine->new( File::ShareDir::dist_file('Mock-Person-JP', 'mei_male.tsv') ); |
21
|
5
|
|
|
|
|
1322
|
$self->{mei}{female} = File::RandomLine->new( File::ShareDir::dist_file('Mock-Person-JP', 'mei_female.tsv') ); |
22
|
|
|
|
|
|
|
|
23
|
5
|
|
|
|
|
1310
|
return $self; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub create_person |
27
|
|
|
|
|
|
|
{ |
28
|
8
|
|
|
8
|
1
|
4122
|
my $self = shift; |
29
|
|
|
|
|
|
|
|
30
|
8
|
100
|
|
|
|
43
|
my %arg = (ref $_[0] eq 'HASH') ? %{$_[0]} : @_; |
|
1
|
|
|
|
|
4
|
|
31
|
|
|
|
|
|
|
|
32
|
8
|
100
|
|
|
|
191
|
Carp::croak('sex option required') unless exists $arg{sex}; |
33
|
|
|
|
|
|
|
|
34
|
7
|
|
|
|
|
22
|
for my $key (keys %arg) |
35
|
|
|
|
|
|
|
{ |
36
|
7
|
100
|
|
|
|
21
|
if ($key eq 'sex') |
37
|
|
|
|
|
|
|
{ |
38
|
6
|
100
|
100
|
|
|
157
|
Carp::croak("sex option must be 'male' or 'female'") if $arg{$key} ne 'male' && $arg{$key} ne 'female'; |
39
|
|
|
|
|
|
|
} |
40
|
1
|
|
|
|
|
111
|
else { Carp::croak "Unknown option: '$key'"; } |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
5
|
|
|
|
|
22
|
$arg{name} = $self->_rand_name($arg{sex}); |
44
|
|
|
|
|
|
|
|
45
|
5
|
|
|
|
|
30
|
return Mock::Person::JP::Person->new(\%arg); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub _rand_name |
49
|
|
|
|
|
|
|
{ |
50
|
5
|
|
|
5
|
|
9
|
my ($self, $sex) = @_; |
51
|
|
|
|
|
|
|
|
52
|
5
|
|
|
|
|
27
|
my $sei = $self->{sei}->next; |
53
|
5
|
|
|
|
|
407
|
my $mei = $self->{mei}{$sex}->next; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
# Faster than Encode::decode_utf8 and no need to validate the string |
56
|
5
|
|
|
|
|
245
|
utf8::decode($sei); |
57
|
5
|
|
|
|
|
13
|
utf8::decode($mei); |
58
|
|
|
|
|
|
|
|
59
|
5
|
|
|
|
|
55
|
my %name; |
60
|
5
|
|
|
|
|
39
|
($name{sei_yomi}, $name{sei}) = split(/\t/, $sei); |
61
|
5
|
|
|
|
|
30
|
($name{mei_yomi}, $name{mei}) = split(/\t/, $mei); |
62
|
|
|
|
|
|
|
|
63
|
5
|
|
|
|
|
18
|
return \%name; |
64
|
|
|
|
|
|
|
} |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
1; |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
__END__ |