line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Rest::HtmlVis::Key; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2663
|
use 5.006; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
83
|
|
4
|
1
|
|
|
1
|
|
7
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
45
|
|
5
|
1
|
|
|
1
|
|
7
|
use warnings FATAL => 'all'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
356
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
=head1 NAME |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
Rest::HtmlVis::Key - Base class for easy-to-use html vis |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
=head1 VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Version 0.01 |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
=cut |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = '0.01'; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 SYNOPSIS |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
All you have to do is to inherit from Rest::HtmlVis::Key and then implement the callback html. |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Example: |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
package Rest::HtmlVis::MyGraph; |
27
|
|
|
|
|
|
|
use parent qw( Rest::HtmlVis::Key ); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
use YAML::Syck; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub html { |
32
|
|
|
|
|
|
|
my ($self) = @_; |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
local $Data::Dumper::Indent=1; |
35
|
|
|
|
|
|
|
local $Data::Dumper::Quotekeys=0; |
36
|
|
|
|
|
|
|
local $Data::Dumper::Terse=1; |
37
|
|
|
|
|
|
|
local $Data::Dumper::Sortkeys=1; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
return ' '.Dump($self->getStruct).' '; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
=head2 new |
45
|
|
|
|
|
|
|
|
46
|
|
|
|
|
|
|
=cut |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
sub new { |
49
|
0
|
|
|
0
|
1
|
|
my ($class) = @_; |
50
|
0
|
|
|
|
|
|
return bless {}, $class; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
=head2 setStruct |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub setStruct { |
58
|
0
|
|
|
0
|
1
|
|
my ($self, $key, $struct, $env) = @_; |
59
|
0
|
0
|
|
|
|
|
if (exists $struct->{$key}){ |
60
|
0
|
|
|
|
|
|
$self->{struct} = $struct->{$key}; |
61
|
0
|
|
|
|
|
|
$self->{env} = $env; |
62
|
0
|
|
|
|
|
|
return 1; |
63
|
|
|
|
|
|
|
}else{ |
64
|
0
|
|
|
|
|
|
$self->{struct} = undef; |
65
|
|
|
|
|
|
|
} |
66
|
0
|
|
|
|
|
|
return undef; |
67
|
|
|
|
|
|
|
} |
68
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
=head2 getStruct |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
Return html hash with input structure. |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
=cut |
74
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub getStruct { |
76
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
77
|
0
|
|
|
|
|
|
return $self->{struct}; |
78
|
|
|
|
|
|
|
} |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
=head2 getEnv |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
Return env variables. |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
=cut |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub getEnv { |
87
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
88
|
0
|
|
|
|
|
|
return $self->{env}; |
89
|
|
|
|
|
|
|
} |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head2 getOrder |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Return wight on elemnt on html page. Default 1 means in middle; |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=cut |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
sub getOrder { |
98
|
0
|
|
|
0
|
1
|
|
return 1; |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=head2 blocks |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
Number of blocks in row. Max 12. (ala bootstrap) |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
Default is 12; |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
sub blocks { |
110
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
111
|
0
|
|
|
|
|
|
return 12; |
112
|
|
|
|
|
|
|
} |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=head2 newRow |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
Define if element is on new row or is the part of previous row. |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
Default is 0 - no new row; |
119
|
|
|
|
|
|
|
|
120
|
|
|
|
|
|
|
=cut |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
sub newRow { |
123
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
124
|
0
|
|
|
|
|
|
return 0; |
125
|
|
|
|
|
|
|
} |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head2 head |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Return head of page as HTML string. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
Default empty. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
=cut |
134
|
|
|
|
|
|
|
|
135
|
|
|
|
|
|
|
sub head { |
136
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
137
|
0
|
|
|
|
|
|
return; |
138
|
|
|
|
|
|
|
} |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
=head2 onload |
141
|
|
|
|
|
|
|
|
142
|
|
|
|
|
|
|
Return onload javascript function of onload attr in body. It must ends with ; |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
Default empty. |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
=cut |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
sub onload { |
149
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
150
|
0
|
|
|
|
|
|
return; |
151
|
|
|
|
|
|
|
} |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=head2 html |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Return body part of HTML. |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
Default empty. |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
=cut |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
sub html { |
162
|
0
|
|
|
0
|
1
|
|
my ($self) = @_; |
163
|
0
|
|
|
|
|
|
return; |
164
|
|
|
|
|
|
|
} |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
=head1 AUTHOR |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
Vaclav Dovrtel, C<< >> |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 BUGS |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
Please report any bugs or feature requests to github repository. |
173
|
|
|
|
|
|
|
|
174
|
|
|
|
|
|
|
=head1 ACKNOWLEDGEMENTS |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
Inspired by L |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 REPOSITORY |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
L |
181
|
|
|
|
|
|
|
|
182
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
183
|
|
|
|
|
|
|
|
184
|
|
|
|
|
|
|
Copyright 2015 Vaclav Dovrtel. |
185
|
|
|
|
|
|
|
|
186
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it |
187
|
|
|
|
|
|
|
under the terms of either: the GNU General Public License as published |
188
|
|
|
|
|
|
|
by the Free Software Foundation; or the Artistic License. |
189
|
|
|
|
|
|
|
|
190
|
|
|
|
|
|
|
See L for more information. |
191
|
|
|
|
|
|
|
|
192
|
|
|
|
|
|
|
=cut |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
1; # End of Rest::HtmlVis::Key |