line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
|
2
|
1
|
|
|
1
|
|
6
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
1113
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
require Psh; |
5
|
|
|
|
|
|
|
require Psh::Options; |
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
package Psh::Support::TiedOption; |
8
|
|
|
|
|
|
|
package Psh::Support::TiedOption::Scalar; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub TIESCALAR { |
11
|
4
|
|
|
4
|
|
7
|
my ($class, $optname) = @_; |
12
|
4
|
|
|
|
|
17
|
return bless \$optname, $class; |
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
sub FETCH { |
15
|
6
|
|
|
6
|
|
81
|
my $optname = shift; |
16
|
6
|
|
|
|
|
17
|
my $val = Psh::Options::get_option($$optname); |
17
|
6
|
50
|
|
|
|
13
|
if (ref $val) { |
18
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_scalar', $$optname); |
19
|
0
|
|
|
|
|
0
|
return; |
20
|
|
|
|
|
|
|
} |
21
|
6
|
|
|
|
|
17
|
return $val; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
sub STORE { |
24
|
4
|
|
|
4
|
|
901
|
my ($optname, $newval) = @_; |
25
|
4
|
|
|
|
|
44
|
my $val = Psh::Options::get_option($$optname); |
26
|
4
|
50
|
|
|
|
11
|
if (ref $val) { |
27
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_scalar', $$optname); |
28
|
0
|
|
|
|
|
0
|
return; |
29
|
|
|
|
|
|
|
} |
30
|
4
|
|
|
|
|
12
|
Psh::Options::set_option($$optname, $newval); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
package Psh::Support::TiedOption::Array; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub TIEARRAY { |
36
|
4
|
|
|
4
|
|
5
|
my ($class, $optname) = @_; |
37
|
4
|
|
|
|
|
17
|
return bless \$optname, $class; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
sub FETCH { |
40
|
12
|
|
|
12
|
|
46
|
my ($optname, $index) = @_; |
41
|
12
|
|
|
|
|
25
|
my $val = Psh::Options::get_option($$optname); |
42
|
12
|
50
|
|
|
|
26
|
unless (ref $val eq 'ARRAY') { |
43
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_array', $$optname); |
44
|
0
|
|
|
|
|
0
|
return; |
45
|
|
|
|
|
|
|
} |
46
|
12
|
|
|
|
|
35
|
return $val->[$index]; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
sub STORE { |
49
|
12
|
|
|
12
|
|
19
|
my ($optname, $index, $newval) = @_; |
50
|
12
|
|
|
|
|
29
|
my $array = scalar Psh::Options::get_option($$optname); |
51
|
|
|
|
|
|
|
|
52
|
12
|
50
|
|
|
|
50
|
unless (ref $array eq 'ARRAY') { |
53
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_array', $$optname); |
54
|
0
|
|
|
|
|
0
|
return; |
55
|
|
|
|
|
|
|
} |
56
|
12
|
|
|
|
|
21
|
$array->[$index] = $newval; |
57
|
12
|
|
|
|
|
27
|
Psh::Options::set_option($$optname, $array); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
sub FETCHSIZE { |
60
|
18
|
|
|
18
|
|
897
|
my ($optname) = @_; |
61
|
18
|
|
|
|
|
48
|
my $val = Psh::Options::get_option($$optname); |
62
|
18
|
50
|
|
|
|
45
|
unless (ref $val eq 'ARRAY') { |
63
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_array', $$optname); |
64
|
0
|
|
|
|
|
0
|
return; |
65
|
|
|
|
|
|
|
} |
66
|
18
|
|
|
|
|
48
|
return scalar @$val; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
sub CLEAR { |
69
|
4
|
|
|
4
|
|
1110
|
my ($optname) = @_; |
70
|
4
|
|
|
|
|
9
|
my $val = Psh::Options::get_option($$optname); |
71
|
4
|
50
|
|
|
|
11
|
unless (ref $val eq 'ARRAY') { |
72
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_array', $$optname); |
73
|
0
|
|
|
|
|
0
|
return; |
74
|
|
|
|
|
|
|
} |
75
|
4
|
|
|
|
|
11
|
Psh::Options::set_option($$optname, []); |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
4
|
|
|
4
|
|
14
|
sub EXTEND { |
79
|
|
|
|
|
|
|
} |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
package Psh::Support::TiedOption::Hash; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
sub TIEHASH { |
85
|
2
|
|
|
2
|
|
3
|
my ($class, $optname) = @_; |
86
|
2
|
|
|
|
|
10
|
return bless \$optname, $class; |
87
|
|
|
|
|
|
|
} |
88
|
|
|
|
|
|
|
sub FETCH { |
89
|
20
|
|
|
20
|
|
93
|
my ($optname, $key) = @_; |
90
|
20
|
|
|
|
|
44
|
my $val = Psh::Options::get_option($$optname); |
91
|
20
|
50
|
|
|
|
46
|
unless (ref $val eq 'HASH') { |
92
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_hash', $$optname); |
93
|
0
|
|
|
|
|
0
|
return; |
94
|
|
|
|
|
|
|
} |
95
|
20
|
|
|
|
|
61
|
return $val->{$key}; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
sub STORE { |
98
|
2
|
|
|
2
|
|
832
|
my ($optname, $key, $newval) = @_; |
99
|
2
|
|
|
|
|
6
|
my $hash = scalar Psh::Options::get_option($$optname); |
100
|
2
|
50
|
|
|
|
6
|
unless (ref $hash eq 'HASH') { |
101
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_hash', $$optname); |
102
|
0
|
|
|
|
|
0
|
return; |
103
|
|
|
|
|
|
|
} |
104
|
2
|
|
|
|
|
4
|
$hash->{$key} = $newval; |
105
|
2
|
|
|
|
|
5
|
Psh::Options::set_option($$optname, $hash); |
106
|
|
|
|
|
|
|
} |
107
|
|
|
|
|
|
|
sub EXISTS { |
108
|
20
|
|
|
20
|
|
239
|
my ($optname, $key) = @_; |
109
|
20
|
|
|
|
|
77
|
my $val = Psh::Options::get_option($$optname); |
110
|
20
|
50
|
|
|
|
54
|
unless (ref $val eq 'HASH') { |
111
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_hash', $$optname); |
112
|
0
|
|
|
|
|
0
|
return; |
113
|
|
|
|
|
|
|
} |
114
|
20
|
|
|
|
|
62
|
return exists $val->{$key}; |
115
|
|
|
|
|
|
|
} |
116
|
|
|
|
|
|
|
sub DELETE { |
117
|
2
|
|
|
2
|
|
18
|
my ($optname, $key) = @_; |
118
|
2
|
|
|
|
|
11
|
my $val = Psh::Options::get_option($$optname); |
119
|
2
|
50
|
|
|
|
9
|
unless (ref $val eq 'HASH') { |
120
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_hash', $$optname); |
121
|
0
|
|
|
|
|
0
|
return; |
122
|
|
|
|
|
|
|
} |
123
|
2
|
|
|
|
|
7
|
return delete $val->{$key}; |
124
|
|
|
|
|
|
|
} |
125
|
|
|
|
|
|
|
sub CLEAR { |
126
|
0
|
|
|
0
|
|
0
|
my ($optname) = @_; |
127
|
0
|
|
|
|
|
0
|
my $val = Psh::Options::get_option($$optname); |
128
|
0
|
0
|
|
|
|
0
|
unless (ref $val eq 'HASH') { |
129
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_hash', $$optname); |
130
|
0
|
|
|
|
|
0
|
return; |
131
|
|
|
|
|
|
|
} |
132
|
0
|
|
|
|
|
0
|
Psh::Options::set_option($$optname, {}); |
133
|
|
|
|
|
|
|
} |
134
|
|
|
|
|
|
|
sub FIRSTKEY { |
135
|
6
|
|
|
6
|
|
1596
|
my ($optname) = @_; |
136
|
6
|
|
|
|
|
18
|
my $val = Psh::Options::get_option($$optname); |
137
|
6
|
50
|
|
|
|
15
|
unless (ref $val eq 'HASH') { |
138
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_hash', $$optname); |
139
|
0
|
|
|
|
|
0
|
return; |
140
|
|
|
|
|
|
|
} |
141
|
|
|
|
|
|
|
# Reset keys iterator |
142
|
6
|
|
|
|
|
12
|
my $reset_keys = keys %$val; |
143
|
6
|
|
|
|
|
22
|
return each %$val; |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
sub NEXTKEY { |
146
|
20
|
|
|
20
|
|
27
|
my ($optname) = @_; |
147
|
20
|
|
|
|
|
40
|
my $val = Psh::Options::get_option($$optname); |
148
|
20
|
50
|
|
|
|
46
|
unless (ref $val eq 'HASH') { |
149
|
0
|
|
|
|
|
0
|
Psh::Util::print_error_i18n('bi_tieopt_fetch_badtype_hash', $$optname); |
150
|
0
|
|
|
|
|
0
|
return; |
151
|
|
|
|
|
|
|
} |
152
|
20
|
|
|
|
|
59
|
return each %$val; |
153
|
|
|
|
|
|
|
} |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
1; |
156
|
|
|
|
|
|
|
|