| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
7
|
|
|
7
|
|
65542
|
use v5.40; |
|
|
7
|
|
|
|
|
24
|
|
|
2
|
7
|
|
|
7
|
|
43
|
use feature 'class'; |
|
|
7
|
|
|
|
|
11
|
|
|
|
7
|
|
|
|
|
1060
|
|
|
3
|
7
|
|
|
7
|
|
61
|
no warnings 'experimental::class'; |
|
|
7
|
|
|
|
|
15
|
|
|
|
7
|
|
|
|
|
785
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
class App::Gimei::Runner { |
|
6
|
|
|
|
|
|
|
|
|
7
|
7
|
|
|
7
|
|
6004
|
binmode STDOUT, ":encoding(UTF-8)"; |
|
|
7
|
|
|
|
|
183
|
|
|
|
7
|
|
|
|
|
64
|
|
|
8
|
|
|
|
|
|
|
|
|
9
|
7
|
|
|
7
|
|
5558
|
use Getopt::Long; |
|
|
7
|
|
|
|
|
128607
|
|
|
|
7
|
|
|
|
|
55
|
|
|
10
|
7
|
|
|
7
|
|
5451
|
use Pod::Usage; |
|
|
7
|
|
|
|
|
572817
|
|
|
|
7
|
|
|
|
|
984
|
|
|
11
|
7
|
|
|
7
|
|
112
|
use Pod::Find qw( pod_where ); |
|
|
7
|
|
|
|
|
15
|
|
|
|
7
|
|
|
|
|
438
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
7
|
|
|
7
|
|
3816
|
use App::Gimei; |
|
|
7
|
|
|
|
|
20
|
|
|
|
7
|
|
|
|
|
306
|
|
|
14
|
7
|
|
|
7
|
|
3526
|
use App::Gimei::Parser; |
|
|
7
|
|
|
|
|
31
|
|
|
|
7
|
|
|
|
|
6104
|
|
|
15
|
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# |
|
17
|
|
|
|
|
|
|
# instance variables |
|
18
|
|
|
|
|
|
|
# |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
field $conf : param = { POD_FILE => pod_where( { -inc => 1 }, 'App::Gimei' ) }; |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# |
|
23
|
|
|
|
|
|
|
# instance methods |
|
24
|
|
|
|
|
|
|
# |
|
25
|
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
method _parse_option ( $args_ref, $opts_ref ) { |
|
27
|
|
|
|
|
|
|
$opts_ref->{n} = 1; |
|
28
|
|
|
|
|
|
|
$opts_ref->{sep} = ', '; |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
my $p = Getopt::Long::Parser->new( config => ["no_ignore_case"], ); |
|
31
|
|
|
|
|
|
|
|
|
32
|
1
|
|
|
1
|
|
1200
|
local $SIG{__WARN__} = sub { die "Error: $_[0]" }; |
|
33
|
|
|
|
|
|
|
my $ok = |
|
34
|
|
|
|
|
|
|
$p->getoptionsfromarray( $args_ref, $opts_ref, "help|h", "version|v", "n=i", |
|
35
|
|
|
|
|
|
|
"sep=s", ); |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
if ( $opts_ref->{n} < 1 ) { |
|
38
|
|
|
|
|
|
|
die |
|
39
|
|
|
|
|
|
|
"Error: value $opts_ref->{n} invalid for option n (must be positive number)\n"; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
} |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
method execute (@args) { |
|
44
|
|
|
|
|
|
|
my %opts; |
|
45
|
|
|
|
|
|
|
$self->_parse_option( \@args, \%opts ); |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
if ( $opts{version} ) { |
|
48
|
|
|
|
|
|
|
say "$App::Gimei::VERSION"; |
|
49
|
|
|
|
|
|
|
return 0; |
|
50
|
|
|
|
|
|
|
} |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
if ( $opts{help} ) { |
|
53
|
|
|
|
|
|
|
pod2usage( -input => ${$conf}{POD_FILE}, -exitval => 'noexit' ); |
|
54
|
|
|
|
|
|
|
return 0; |
|
55
|
|
|
|
|
|
|
} |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
if ( !@args ) { |
|
58
|
|
|
|
|
|
|
push @args, 'name:kanji'; |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
# my $parser = App::Gimei::Parser->new( args => \@args ); |
|
62
|
|
|
|
|
|
|
# my $generators = $parser->parse(); |
|
63
|
|
|
|
|
|
|
my $generators = App::Gimei::Parser::parse( \@args ); |
|
64
|
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
_semantic_analysis($generators); |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
foreach ( 1 .. $opts{n} ) { |
|
68
|
|
|
|
|
|
|
say join $opts{sep}, $generators->execute(); |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
return 0; |
|
72
|
|
|
|
|
|
|
} |
|
73
|
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
# |
|
75
|
|
|
|
|
|
|
# class methods |
|
76
|
|
|
|
|
|
|
# |
|
77
|
|
|
|
|
|
|
|
|
78
|
25
|
|
|
25
|
|
36
|
sub _semantic_analysis ($generators) { |
|
|
25
|
|
|
|
|
35
|
|
|
|
25
|
|
|
|
|
28
|
|
|
79
|
25
|
|
|
|
|
77
|
foreach my $gen ( $generators->to_list() ) { |
|
80
|
26
|
100
|
100
|
|
|
195
|
if ( $gen->word_class eq 'Data::Gimei::Address' |
|
81
|
|
|
|
|
|
|
&& $gen->rendering eq 'romaji' ) |
|
82
|
|
|
|
|
|
|
{ |
|
83
|
2
|
|
|
|
|
19
|
die "Error: rendering romaji is not supported for address\n"; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
} |
|
86
|
|
|
|
|
|
|
} |
|
87
|
|
|
|
|
|
|
} |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
1; |