| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package WSST::Schema; |
|
2
|
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
29288
|
use strict; |
|
|
5
|
|
|
|
|
10
|
|
|
|
5
|
|
|
|
|
172
|
|
|
4
|
5
|
|
|
5
|
|
17944
|
use Storable qw(dclone); |
|
|
5
|
|
|
|
|
33657
|
|
|
|
5
|
|
|
|
|
437
|
|
|
5
|
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
12114
|
use WSST::Schema::Data; |
|
|
5
|
|
|
|
|
20
|
|
|
|
5
|
|
|
|
|
52
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.1.1'; |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub new { |
|
11
|
3
|
|
|
3
|
1
|
1787
|
my $class = shift; |
|
12
|
3
|
|
100
|
|
|
22
|
my $data = shift || {}; |
|
13
|
3
|
|
|
|
|
38
|
my $self = { |
|
14
|
|
|
|
|
|
|
lang => $ENV{WSST_LANG}, |
|
15
|
|
|
|
|
|
|
data => WSST::Schema::Data->new($data), |
|
16
|
|
|
|
|
|
|
}; |
|
17
|
3
|
|
|
|
|
11
|
bless($self, $class); |
|
18
|
3
|
50
|
|
|
|
23
|
$self->_update_lang() if $self->{lang}; |
|
19
|
3
|
|
|
|
|
19
|
return $self; |
|
20
|
|
|
|
|
|
|
} |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub clone_data { |
|
23
|
4
|
|
|
4
|
1
|
2926
|
my $self = shift; |
|
24
|
4
|
|
|
|
|
9
|
return dclone($self->data); |
|
25
|
|
|
|
|
|
|
} |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub data { |
|
28
|
6
|
|
|
6
|
1
|
409
|
my $self = shift; |
|
29
|
6
|
|
|
|
|
297
|
return $self->{data}; |
|
30
|
|
|
|
|
|
|
} |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub lang { |
|
33
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
|
34
|
0
|
0
|
|
|
|
|
if (@_) { |
|
35
|
0
|
|
|
|
|
|
$self->{lang} = shift; |
|
36
|
0
|
|
|
|
|
|
$self->_update_lang(); |
|
37
|
|
|
|
|
|
|
} |
|
38
|
0
|
|
|
|
|
|
return $self->{lang}; |
|
39
|
|
|
|
|
|
|
} |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
sub _update_lang { |
|
42
|
0
|
|
|
0
|
|
|
my $self = shift; |
|
43
|
|
|
|
|
|
|
|
|
44
|
0
|
|
0
|
|
|
|
my $lang = $self->{lang} || "default"; |
|
45
|
0
|
|
|
|
|
|
my $hash_list = [$self->{data}]; |
|
46
|
|
|
|
|
|
|
|
|
47
|
0
|
|
|
|
|
|
while (my $hash = shift(@$hash_list)) { |
|
48
|
0
|
|
|
|
|
|
foreach my $key (keys %$hash) { |
|
49
|
0
|
0
|
|
|
|
|
next if $key =~ /_m17n$/; |
|
50
|
0
|
|
|
|
|
|
my $key_m17n = $key . "_m17n"; |
|
51
|
0
|
0
|
0
|
|
|
|
if ($hash->{$key_m17n} && ref($hash->{$key_m17n}) eq 'HASH') { |
|
52
|
0
|
0
|
|
|
|
|
$hash->{$key_m17n}->{default} = $hash->{$key} |
|
53
|
|
|
|
|
|
|
unless exists $hash->{$key_m17n}->{default}; |
|
54
|
0
|
|
|
|
|
|
$hash->{$key} = $hash->{$key_m17n}->{$lang}; |
|
55
|
0
|
|
|
|
|
|
next; |
|
56
|
|
|
|
|
|
|
} |
|
57
|
0
|
0
|
|
|
|
|
if (ref($hash->{$key}) eq 'HASH') { |
|
58
|
0
|
|
|
|
|
|
push(@$hash_list, $hash->{$key}); |
|
59
|
0
|
|
|
|
|
|
next; |
|
60
|
|
|
|
|
|
|
} |
|
61
|
0
|
0
|
|
|
|
|
if (ref($hash->{$key}) eq 'ARRAY') { |
|
62
|
0
|
|
|
|
|
|
foreach my $val (@{$hash->{$key}}) { |
|
|
0
|
|
|
|
|
|
|
|
63
|
0
|
0
|
|
|
|
|
push(@$hash_list, $val) |
|
64
|
|
|
|
|
|
|
if ref($val) eq 'HASH'; |
|
65
|
|
|
|
|
|
|
} |
|
66
|
|
|
|
|
|
|
} |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
} |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
=head1 NAME |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
WSST::Schema - Schema class of WSST |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
76
|
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Schema is container class of parsed schema data. |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
=head1 METHODS |
|
80
|
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=head2 new |
|
82
|
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
Constructor. |
|
84
|
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head2 clone_data |
|
86
|
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
Returns schema data which copied deeply. |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head2 data |
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Returns schema data. |
|
92
|
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head2 lang |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
Accessor method for lang value. |
|
96
|
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
=head1 SEE ALSO |
|
98
|
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
http://code.google.com/p/wsst/ |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head1 AUTHORS |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Mitsuhisa Oshikawa |
|
104
|
|
|
|
|
|
|
Yusuke Kawasaki |
|
105
|
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
|
107
|
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
Copyright 2008 WSS Project Team |
|
109
|
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
=cut |
|
111
|
|
|
|
|
|
|
1; |