line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Khonsu::Ra; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
2120
|
use strict; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
147
|
|
4
|
5
|
|
|
5
|
|
31
|
use warnings; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
121
|
|
5
|
|
|
|
|
|
|
|
6
|
5
|
|
|
5
|
|
2082
|
use Clone; |
|
5
|
|
|
|
|
12007
|
|
|
5
|
|
|
|
|
245
|
|
7
|
|
|
|
|
|
|
|
8
|
5
|
|
|
5
|
|
2008
|
use Khonsu::Shape::Line; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
159
|
|
9
|
5
|
|
|
5
|
|
1930
|
use Khonsu::Shape::Box; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
159
|
|
10
|
5
|
|
|
5
|
|
1843
|
use Khonsu::Shape::Circle; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
174
|
|
11
|
5
|
|
|
5
|
|
1870
|
use Khonsu::Shape::Pie; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
178
|
|
12
|
5
|
|
|
5
|
|
1863
|
use Khonsu::Shape::Ellipse; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
166
|
|
13
|
|
|
|
|
|
|
|
14
|
5
|
|
|
5
|
|
1952
|
use Khonsu::Font; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
172
|
|
15
|
|
|
|
|
|
|
|
16
|
5
|
|
|
5
|
|
1906
|
use Khonsu::Text; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
185
|
|
17
|
5
|
|
|
5
|
|
1896
|
use Khonsu::Text::H1; |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
200
|
|
18
|
5
|
|
|
5
|
|
1925
|
use Khonsu::Text::H2; |
|
5
|
|
|
|
|
23
|
|
|
5
|
|
|
|
|
188
|
|
19
|
5
|
|
|
5
|
|
1922
|
use Khonsu::Text::H3; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
247
|
|
20
|
5
|
|
|
5
|
|
1937
|
use Khonsu::Text::H4; |
|
5
|
|
|
|
|
22
|
|
|
5
|
|
|
|
|
190
|
|
21
|
5
|
|
|
5
|
|
1898
|
use Khonsu::Text::H5; |
|
5
|
|
|
|
|
41
|
|
|
5
|
|
|
|
|
217
|
|
22
|
5
|
|
|
5
|
|
1923
|
use Khonsu::Text::H6; |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
196
|
|
23
|
|
|
|
|
|
|
|
24
|
5
|
|
|
5
|
|
1792
|
use Khonsu::Image; |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
202
|
|
25
|
|
|
|
|
|
|
|
26
|
5
|
|
|
5
|
|
1913
|
use Khonsu::Form; |
|
5
|
|
|
|
|
14
|
|
|
5
|
|
|
|
|
213
|
|
27
|
5
|
|
|
5
|
|
2100
|
use Khonsu::Form::Field::Input; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
253
|
|
28
|
5
|
|
|
5
|
|
1926
|
use Khonsu::Form::Field::Select; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
245
|
|
29
|
5
|
|
|
5
|
|
1994
|
use Khonsu::Form::Field::Checkbox; |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
253
|
|
30
|
|
|
|
|
|
|
|
31
|
5
|
|
|
5
|
|
1883
|
use Khonsu::TOC; |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
286
|
|
32
|
|
|
|
|
|
|
|
33
|
5
|
|
|
5
|
|
2863
|
use Types::Standard qw/Str Object ArrayRef HashRef Num Bool CodeRef/; |
|
5
|
|
|
|
|
370073
|
|
|
5
|
|
|
|
|
50
|
|
34
|
|
|
|
|
|
|
|
35
|
5
|
|
|
5
|
|
7909
|
use constant RW => (is => 'rw'); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
453
|
|
36
|
5
|
|
|
5
|
|
30
|
use constant REQ => (required => 1); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
320
|
|
37
|
5
|
|
|
5
|
|
29
|
use constant STR => (isa => Str); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
17
|
|
38
|
5
|
|
|
5
|
|
322
|
use constant OBJ => (isa => Object); |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
31
|
|
39
|
5
|
|
|
5
|
|
381
|
use constant BOOL => (isa => Bool); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
30
|
|
40
|
5
|
|
|
5
|
|
328
|
use constant AR => (isa => ArrayRef); |
|
5
|
|
|
|
|
15
|
|
|
5
|
|
|
|
|
19
|
|
41
|
5
|
|
|
5
|
|
346
|
use constant HR => (isa => HashRef); |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
18
|
|
42
|
5
|
|
|
5
|
|
430
|
use constant DAR => (isa => ArrayRef, default => sub { [ ] }); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
15
|
|
|
354
|
|
|
|
|
728
|
|
43
|
5
|
|
|
5
|
|
485
|
use constant DHR => (isa => HashRef, default => sub { { } }); |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
17
|
|
|
748
|
|
|
|
|
1772
|
|
44
|
5
|
|
|
5
|
|
354
|
use constant NUM => (isa => Num); |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
36
|
|
45
|
5
|
|
|
5
|
|
313
|
use constant CODE => (isa => CodeRef); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
20
|
|
46
|
5
|
|
|
|
|
16
|
use constant POINTS => ( |
47
|
|
|
|
|
|
|
x => {is => 'rw', isa => Num}, |
48
|
|
|
|
|
|
|
y => {is => 'rw', isa => Num}, |
49
|
|
|
|
|
|
|
w => {is => 'rw', isa => Num}, |
50
|
|
|
|
|
|
|
h => {is => 'rw', isa => Num}, |
51
|
5
|
|
|
5
|
|
483
|
); |
|
5
|
|
|
|
|
12
|
|
52
|
|
|
|
|
|
|
use constant LINE => ( |
53
|
4
|
|
|
|
|
62
|
line => {is => 'rw', isa => Object, default => sub { Khonsu::Shape::Line->new() }} |
54
|
5
|
|
|
5
|
|
565
|
); |
|
5
|
|
|
|
|
29
|
|
|
5
|
|
|
|
|
25
|
|
55
|
|
|
|
|
|
|
use constant BOX => ( |
56
|
94
|
|
|
|
|
411
|
box => {is => 'rw', isa => Object, default => sub { Khonsu::Shape::Box->new() }} |
57
|
5
|
|
|
5
|
|
550
|
); |
|
5
|
|
|
|
|
17
|
|
|
5
|
|
|
|
|
26
|
|
58
|
|
|
|
|
|
|
use constant CIRCLE => ( |
59
|
4
|
|
|
|
|
44
|
circle => {is => 'rw', isa => Object, default => sub { Khonsu::Shape::Circle->new() }} |
60
|
5
|
|
|
5
|
|
573
|
); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
15
|
|
61
|
|
|
|
|
|
|
use constant PIE => ( |
62
|
4
|
|
|
|
|
33
|
pie => {is => 'rw', isa => Object, default => sub { Khonsu::Shape::Pie->new() }} |
63
|
5
|
|
|
5
|
|
617
|
); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
16
|
|
64
|
|
|
|
|
|
|
use constant ELLIPSE => ( |
65
|
4
|
|
|
|
|
35
|
ellipse => {is => 'rw', isa => Object, default => sub { Khonsu::Shape::Ellipse->new() }} |
66
|
5
|
|
|
5
|
|
573
|
); |
|
5
|
|
|
|
|
13
|
|
|
5
|
|
|
|
|
18
|
|
67
|
|
|
|
|
|
|
use constant FONT => ( |
68
|
402
|
|
|
|
|
1047
|
font => {is => 'rw', isa => Object, default => sub { Khonsu::Font->new() }} |
69
|
5
|
|
|
5
|
|
570
|
); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
16
|
|
70
|
|
|
|
|
|
|
use constant TEXT => ( |
71
|
4
|
|
|
|
|
32
|
text => {is => 'rw', isa => Object, default => sub { Khonsu::Text->new() }} |
72
|
5
|
|
|
5
|
|
567
|
); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
16
|
|
73
|
|
|
|
|
|
|
use constant H1 => ( |
74
|
4
|
|
|
|
|
36
|
h1 => {is => 'rw', isa => Object, default => sub { Khonsu::Text::H1->new() }} |
75
|
5
|
|
|
5
|
|
556
|
); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
19
|
|
76
|
|
|
|
|
|
|
use constant H2 => ( |
77
|
4
|
|
|
|
|
43
|
h2 => {is => 'rw', isa => Object, default => sub { Khonsu::Text::H2->new() }} |
78
|
5
|
|
|
5
|
|
588
|
); |
|
5
|
|
|
|
|
25
|
|
|
5
|
|
|
|
|
24
|
|
79
|
|
|
|
|
|
|
use constant H3 => ( |
80
|
4
|
|
|
|
|
67
|
h3 => {is => 'rw', isa => Object, default => sub { Khonsu::Text::H3->new() }} |
81
|
5
|
|
|
5
|
|
599
|
); |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
16
|
|
82
|
|
|
|
|
|
|
use constant H4 => ( |
83
|
4
|
|
|
|
|
41
|
h4 => {is => 'rw', isa => Object, default => sub { Khonsu::Text::H4->new() }} |
84
|
5
|
|
|
5
|
|
588
|
); |
|
5
|
|
|
|
|
16
|
|
|
5
|
|
|
|
|
22
|
|
85
|
|
|
|
|
|
|
use constant H5 => ( |
86
|
4
|
|
|
|
|
45
|
h5 => {is => 'rw', isa => Object, default => sub { Khonsu::Text::H5->new() }} |
87
|
5
|
|
|
5
|
|
652
|
); |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
29
|
|
88
|
|
|
|
|
|
|
use constant H6 => ( |
89
|
4
|
|
|
|
|
46
|
h6 => {is => 'rw', isa => Object, default => sub { Khonsu::Text::H6->new() }} |
90
|
5
|
|
|
5
|
|
596
|
); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
13
|
|
91
|
|
|
|
|
|
|
use constant IMAGE => ( |
92
|
4
|
|
|
|
|
49
|
image => {is => 'rw', isa => Object, default => sub { Khonsu::Image->new() }} |
93
|
5
|
|
|
5
|
|
553
|
); |
|
5
|
|
|
|
|
27
|
|
|
5
|
|
|
|
|
18
|
|
94
|
|
|
|
|
|
|
use constant TOC => ( |
95
|
4
|
|
|
|
|
38
|
toc => {is => 'rw', isa => Object, default => sub { Khonsu::TOC->new() }} |
96
|
5
|
|
|
5
|
|
589
|
); |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
19
|
|
97
|
|
|
|
|
|
|
use constant FORM => ( |
98
|
4
|
|
|
|
|
40
|
form => {is => 'rw', isa => Object, default => sub { Khonsu::Form->new() }} |
99
|
5
|
|
|
5
|
|
556
|
); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
15
|
|
100
|
|
|
|
|
|
|
use constant INPUT => ( |
101
|
4
|
|
|
|
|
51
|
input => {is => 'rw', isa => Object, default => sub { Khonsu::Form::Field::Input->new() }} |
102
|
5
|
|
|
5
|
|
566
|
); |
|
5
|
|
|
|
|
12
|
|
|
5
|
|
|
|
|
19
|
|
103
|
|
|
|
|
|
|
use constant SELECT => ( |
104
|
4
|
|
|
|
|
46
|
select => {is => 'rw', isa => Object, default => sub { Khonsu::Form::Field::Select->new() }} |
105
|
5
|
|
|
5
|
|
557
|
); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
17
|
|
106
|
|
|
|
|
|
|
use constant CHECKBOX => ( |
107
|
4
|
|
|
|
|
45
|
checkbox => {is => 'rw', isa => Object, default => sub { Khonsu::Form::Field::Checkbox->new() }} |
108
|
5
|
|
|
5
|
|
564
|
); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
23
|
|
109
|
|
|
|
|
|
|
sub new { |
110
|
1012
|
|
|
1012
|
0
|
3174
|
my ($pkg, %params) = @_; |
111
|
|
|
|
|
|
|
|
112
|
1012
|
|
|
|
|
3382
|
my $self = bless { |
113
|
|
|
|
|
|
|
attributes => {} |
114
|
|
|
|
|
|
|
}, $pkg; |
115
|
1012
|
|
|
|
|
3253
|
my @attributes = $self->attributes(); |
116
|
1012
|
|
|
|
|
3598
|
for (my $i = 0; $i < $#attributes; $i += 2) { |
117
|
11054
|
|
|
|
|
22105
|
my ($key, $value) = ($attributes[$i], $attributes[$i + 1]); |
118
|
0
|
|
|
0
|
|
0
|
$self->{attributes}->{$key} = $value->{is} eq 'ro' ? sub { $_[0]->{$key}; } : sub { |
119
|
72570
|
|
|
72570
|
|
117761
|
my ($self, $val) = @_; |
120
|
72570
|
100
|
|
|
|
121682
|
if (defined $val) { |
121
|
12853
|
100
|
|
|
|
45079
|
if ($value->{isa}) { |
122
|
12845
|
|
|
|
|
75444
|
$val = $value->{isa}->($val); |
123
|
|
|
|
|
|
|
} |
124
|
12853
|
|
|
|
|
273146
|
$self->{$key} = $val; |
125
|
|
|
|
|
|
|
} |
126
|
72570
|
|
|
|
|
315532
|
return $self->{$key}; |
127
|
11054
|
50
|
|
|
|
57007
|
}; |
128
|
|
|
|
|
|
|
|
129
|
11054
|
50
|
66
|
|
|
24576
|
if ($value->{required} && ! defined $params{$key}) { |
130
|
0
|
|
|
|
|
0
|
die "$key is required"; |
131
|
|
|
|
|
|
|
} |
132
|
|
|
|
|
|
|
|
133
|
11054
|
100
|
100
|
|
|
24644
|
if ($value->{default} && !$params{$key}) { |
134
|
4680
|
|
|
|
|
10469
|
$params{$key} = $value->{default}->($self); |
135
|
|
|
|
|
|
|
} |
136
|
|
|
|
|
|
|
|
137
|
11054
|
100
|
|
|
|
22390
|
if (defined $params{$key}) { |
138
|
7695
|
50
|
|
|
|
20604
|
if ($value->{isa}) { |
139
|
7695
|
|
|
|
|
45532
|
$params{$key} = $value->{isa}->($params{$key}); |
140
|
|
|
|
|
|
|
} |
141
|
7695
|
|
|
|
|
155601
|
$self->{$key} = $params{$key}; |
142
|
|
|
|
|
|
|
} |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
|
145
|
1012
|
|
|
|
|
1476
|
for my $plugin (@{$params{PLUGINS}}) { |
|
1012
|
|
|
|
|
2626
|
|
146
|
0
|
|
|
|
|
0
|
my ($key) = lc($plugin) =~ m/::([^:]*)$/; |
147
|
|
|
|
|
|
|
$self->{attributes}->{$key} = sub { |
148
|
0
|
|
|
0
|
|
0
|
my ($self, $val) = @_; |
149
|
0
|
0
|
|
|
|
0
|
if (defined $val) { |
150
|
0
|
|
|
|
|
0
|
$self->{$key} = $val; |
151
|
|
|
|
|
|
|
} |
152
|
0
|
|
|
|
|
0
|
return $self->{$key}; |
153
|
0
|
|
|
|
|
0
|
}; |
154
|
0
|
|
|
|
|
0
|
$self->{$key} = $plugin->new(); |
155
|
|
|
|
|
|
|
$self->{attributes}->{"add_$key"} = sub { |
156
|
0
|
|
|
0
|
|
0
|
my ($self, %args) = @_; |
157
|
0
|
|
|
|
|
0
|
$self->$key->add($self, %args); |
158
|
0
|
|
|
|
|
0
|
return $self; |
159
|
0
|
|
|
|
|
0
|
}; |
160
|
|
|
|
|
|
|
} |
161
|
|
|
|
|
|
|
|
162
|
1012
|
100
|
|
|
|
4127
|
$self->BUILD(%params) if $self->can('BUILD'); |
163
|
|
|
|
|
|
|
|
164
|
1012
|
|
|
|
|
5079
|
return $self; |
165
|
|
|
|
|
|
|
} |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
sub set_points { |
168
|
90
|
|
|
90
|
0
|
4364
|
my ($self, $mx, $my, $mw, $mh) = @_; |
169
|
90
|
|
|
|
|
464
|
$self->x($mx); |
170
|
90
|
|
|
|
|
435
|
$self->y($my); |
171
|
90
|
|
|
|
|
394
|
$self->w($mw); |
172
|
90
|
|
|
|
|
465
|
$self->h($mh); |
173
|
90
|
|
|
|
|
207
|
return $self; |
174
|
|
|
|
|
|
|
} |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
sub get_points { |
177
|
1892
|
|
|
1892
|
0
|
3329
|
my ($self) = shift; |
178
|
|
|
|
|
|
|
return ( |
179
|
1892
|
|
|
|
|
7345
|
x => $self->x, |
180
|
|
|
|
|
|
|
y => $self->y, |
181
|
|
|
|
|
|
|
w => $self->w, |
182
|
|
|
|
|
|
|
h => $self->h |
183
|
|
|
|
|
|
|
); |
184
|
|
|
|
|
|
|
} |
185
|
|
|
|
|
|
|
|
186
|
110
|
|
|
110
|
0
|
214
|
sub attributes { return (); } |
187
|
|
|
|
|
|
|
|
188
|
|
|
|
|
|
|
sub set_attributes { |
189
|
2894
|
|
|
2894
|
0
|
7582
|
my ($self, %params) = @_; |
190
|
2894
|
|
|
|
|
6984
|
for (keys %params) { |
191
|
7330
|
100
|
|
|
|
16967
|
next unless $self->{attributes}->{$_}; |
192
|
5797
|
|
|
|
|
16951
|
$self->{attributes}->{$_}($self, $params{$_}); |
193
|
|
|
|
|
|
|
} |
194
|
2894
|
|
|
|
|
6817
|
return $self; |
195
|
|
|
|
|
|
|
} |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
sub clone { |
198
|
170
|
|
|
170
|
0
|
280
|
my ($self) = @_; |
199
|
170
|
|
|
|
|
278
|
my $ref = ref $self; |
200
|
170
|
|
|
|
|
11915
|
return bless Clone::clone($self), $ref; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
0
|
|
|
sub DESTROY {} |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
sub AUTOLOAD { |
206
|
66773
|
|
|
66773
|
|
284078
|
my $classname = ref $_[0]; |
207
|
66773
|
|
|
|
|
82204
|
my $validname = '[_a-zA-Z][\:a-zA-Z0-9_]*'; |
208
|
66773
|
|
|
|
|
772171
|
our $AUTOLOAD =~ /^${classname}::($validname)$/; |
209
|
66773
|
|
|
|
|
152083
|
my $key = $1; |
210
|
66773
|
50
|
|
|
|
122657
|
die "illegal key name, must be of $validname form\n$AUTOLOAD" unless $key; |
211
|
66773
|
50
|
|
|
|
148433
|
if ( $_[0]->{attributes}->{$key} ) { |
212
|
66773
|
|
|
|
|
146461
|
$_[0]->{attributes}->{$key}->(@_); |
213
|
|
|
|
|
|
|
} else { |
214
|
0
|
|
|
|
|
|
die "illegal use of AUTOLOAD $classname -> $key -"; |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
} |
217
|
|
|
|
|
|
|
|
218
|
|
|
|
|
|
|
1; |