line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CGI::Lazy; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
1276
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
41
|
|
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
7
|
use JSON; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
9
|
|
6
|
1
|
|
|
1
|
|
130
|
use CGI::Pretty; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
7
|
1
|
|
|
1
|
|
61
|
use CGI::Lazy::Config; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
31
|
|
8
|
1
|
|
|
1
|
|
6
|
use CGI::Lazy::Plugin; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
26
|
|
9
|
1
|
|
|
1
|
|
5
|
use CGI::Lazy::DB; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
21
|
|
10
|
1
|
|
|
1
|
|
11
|
use CGI::Lazy::DB::RecordSet; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
11
|
1
|
|
|
1
|
|
6
|
use CGI::Lazy::Session; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
12
|
1
|
|
|
1
|
|
6
|
use CGI::Lazy::Template; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
13
|
1
|
|
|
1
|
|
5
|
use CGI::Lazy::Widget; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
28
|
|
14
|
1
|
|
|
1
|
|
5
|
use CGI::Lazy::Globals; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
100
|
|
15
|
1
|
|
|
1
|
|
7
|
use CGI::Lazy::ErrorHandler; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
21
|
|
16
|
1
|
|
|
1
|
|
5
|
use CGI::Lazy::Utility; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
34
|
|
17
|
1
|
|
|
1
|
|
4
|
use CGI::Lazy::Javascript; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
15
|
|
18
|
1
|
|
|
1
|
|
6
|
use CGI::Lazy::CSS; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
19
|
|
19
|
1
|
|
|
1
|
|
4
|
use CGI::Lazy::Image; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
14
|
|
20
|
1
|
|
|
1
|
|
5
|
use CGI::Lazy::Authn; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
23
|
|
21
|
1
|
|
|
1
|
|
3
|
use CGI::Lazy::Authz; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
17
|
|
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
4
|
use base qw(CGI::Pretty); |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
1366
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
our $VERSION = '1.10'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
our $AutoloadClass = 'CGI'; #this is neccesarry to get around an autoload problem in CGI.pm. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#------------------------------------------------------------ |
30
|
|
|
|
|
|
|
sub DESTROY { |
31
|
0
|
|
|
0
|
|
0
|
my $self = shift; |
32
|
|
|
|
|
|
|
|
33
|
0
|
0
|
0
|
|
|
0
|
if ($self->plugin && $self->plugin->session) { |
34
|
0
|
0
|
|
|
|
0
|
unless ($self->plugin->session->{saveOnDestroy} == 0) { |
35
|
0
|
|
|
|
|
0
|
$self->session->save; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
} |
38
|
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
0
|
return; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
#------------------------------------------------------------ |
43
|
|
|
|
|
|
|
sub authn { |
44
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
45
|
|
|
|
|
|
|
|
46
|
0
|
|
|
|
|
0
|
return $self->{_authn}; |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
#------------------------------------------------------------ |
50
|
|
|
|
|
|
|
sub authz { |
51
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
0
|
return $self->{_authz}; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
#------------------------------------------------------------ |
58
|
|
|
|
|
|
|
sub css { |
59
|
1
|
|
|
1
|
0
|
2
|
my $self = shift; |
60
|
|
|
|
|
|
|
|
61
|
1
|
|
|
|
|
10
|
return CGI::Lazy::CSS->new($self); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
} |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
#------------------------------------------------------------ |
66
|
|
|
|
|
|
|
sub csswrap { |
67
|
0
|
|
|
0
|
0
|
0
|
my $self = shift; |
68
|
0
|
|
|
|
|
0
|
my $css = shift; |
69
|
|
|
|
|
|
|
|
70
|
0
|
|
|
|
|
0
|
my $csspre = "\n\n"; |
72
|
|
|
|
|
|
|
|
73
|
0
|
|
|
|
|
0
|
return $csspre.$css.$csspost; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
#------------------------------------------------------------ |
77
|
|
|
|
|
|
|
sub image { |
78
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
79
|
|
|
|
|
|
|
|
80
|
1
|
|
|
|
|
9
|
return CGI::Lazy::Image->new($self); |
81
|
|
|
|
|
|
|
} |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
#------------------------------------------------------------ |
84
|
|
|
|
|
|
|
sub javascript { |
85
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
86
|
|
|
|
|
|
|
|
87
|
1
|
|
|
|
|
9
|
return CGI::Lazy::Javascript->new($self); |
88
|
|
|
|
|
|
|
} |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
#------------------------------------------------------------ |
91
|
|
|
|
|
|
|
sub config { |
92
|
7
|
|
|
7
|
1
|
9
|
my $self = shift; |
93
|
|
|
|
|
|
|
|
94
|
7
|
|
|
|
|
82
|
return $self->{_config}; |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
#------------------------------------------------------------ |
98
|
|
|
|
|
|
|
sub db { |
99
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
0
|
return $self->{_db}; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
#------------------------------------------------------------ |
105
|
|
|
|
|
|
|
sub dbh { |
106
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
107
|
|
|
|
|
|
|
|
108
|
0
|
|
|
|
|
0
|
return $self->db->dbh; |
109
|
|
|
|
|
|
|
} |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
#------------------------------------------------------------ |
112
|
|
|
|
|
|
|
sub errorHandler { |
113
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
114
|
|
|
|
|
|
|
|
115
|
1
|
|
|
|
|
5
|
return $self->{_errorHandler}; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
#------------------------------------------------------------ |
119
|
|
|
|
|
|
|
sub header { |
120
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
121
|
|
|
|
|
|
|
|
122
|
0
|
|
|
|
|
0
|
my %args; |
123
|
|
|
|
|
|
|
|
124
|
0
|
0
|
|
|
|
0
|
if (scalar @_ % 2 == 0) { |
125
|
0
|
|
|
|
|
0
|
%args = @_; |
126
|
|
|
|
|
|
|
} else { |
127
|
0
|
|
|
|
|
0
|
my $ref = shift; |
128
|
0
|
|
|
|
|
0
|
%args = %$ref; |
129
|
|
|
|
|
|
|
} |
130
|
|
|
|
|
|
|
|
131
|
0
|
|
0
|
|
|
0
|
my $explicitcookies = $args{-cookie} || []; #cookies set explictly in the instance |
132
|
0
|
|
|
|
|
0
|
my $lazycookie; |
133
|
|
|
|
|
|
|
|
134
|
0
|
0
|
|
|
|
0
|
if ($self->plugin) { #it's possible that this object hasn't been built- if the config object doesn't create for instance. |
135
|
0
|
0
|
0
|
|
|
0
|
if ($self->plugin->session && $self->session) { |
136
|
0
|
|
|
|
|
0
|
$lazycookie = $self->cookie( |
137
|
|
|
|
|
|
|
-name => $self->plugin->session->{sessionCookie}, |
138
|
|
|
|
|
|
|
-expires => $self->plugin->session->{expires}, |
139
|
|
|
|
|
|
|
-value => $self->session->sessionID, |
140
|
|
|
|
|
|
|
); |
141
|
|
|
|
|
|
|
} |
142
|
|
|
|
|
|
|
} else { #something really bad happened. Return a header anyway, so we can show an error message |
143
|
0
|
|
|
|
|
0
|
return $self->SUPER::header(); |
144
|
|
|
|
|
|
|
} |
145
|
|
|
|
|
|
|
|
146
|
0
|
|
|
|
|
0
|
$args{-cookie} = [$lazycookie, @$explicitcookies]; |
147
|
|
|
|
|
|
|
|
148
|
0
|
|
|
|
|
0
|
return $self->SUPER::header(%args); |
149
|
|
|
|
|
|
|
} |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
#------------------------------------------------------------ |
152
|
|
|
|
|
|
|
sub jswrap { |
153
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
154
|
0
|
|
|
|
|
0
|
my $js = shift; |
155
|
|
|
|
|
|
|
|
156
|
0
|
|
|
|
|
0
|
my $jspre = "\n\n"; |
158
|
0
|
|
|
|
|
0
|
return $jspre.$js.$jspost; |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
#------------------------------------------------------------ |
162
|
|
|
|
|
|
|
sub mod_perl { |
163
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
164
|
|
|
|
|
|
|
|
165
|
0
|
|
|
|
|
0
|
return $self->{_mod_perl}; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
|
168
|
|
|
|
|
|
|
#------------------------------------------------------------ |
169
|
|
|
|
|
|
|
sub new { |
170
|
1
|
|
|
1
|
1
|
126
|
my $class = shift; |
171
|
1
|
|
|
|
|
4
|
my $vars = shift; |
172
|
|
|
|
|
|
|
|
173
|
1
|
|
|
|
|
2
|
my $sessionID; |
174
|
|
|
|
|
|
|
|
175
|
1
|
|
|
|
|
14
|
my $self = bless $class->SUPER::new(@_), $class; |
176
|
|
|
|
|
|
|
|
177
|
1
|
|
|
|
|
5171
|
$self->{_vars} = $vars; |
178
|
1
|
|
|
|
|
11
|
$self->{_errorHandler} = CGI::Lazy::ErrorHandler->new($self); |
179
|
1
|
|
|
|
|
12
|
$self->{_config} = CGI::Lazy::Config->new($self, $vars); |
180
|
1
|
|
|
|
|
10
|
$self->{_plugin} = CGI::Lazy::Plugin->new($self); |
181
|
1
|
|
|
|
|
11
|
$self->{_db} = CGI::Lazy::DB->new($self); |
182
|
|
|
|
|
|
|
|
183
|
1
|
50
|
|
|
|
4
|
if ($self->plugin->session) { |
184
|
0
|
|
|
|
|
0
|
$self->{_session} = CGI::Lazy::Session->open($self, $sessionID); |
185
|
|
|
|
|
|
|
} |
186
|
|
|
|
|
|
|
|
187
|
1
|
50
|
|
|
|
3
|
if ($self->plugin->authn) { |
188
|
0
|
|
|
|
|
0
|
$self->{_authn} = CGI::Lazy::Authn->new($self); |
189
|
|
|
|
|
|
|
} |
190
|
|
|
|
|
|
|
|
191
|
1
|
50
|
|
|
|
5
|
if ($self->plugin->authz) { |
192
|
0
|
|
|
|
|
0
|
$self->{_authz} = CGI::Lazy::Authz->new($self); |
193
|
|
|
|
|
|
|
} |
194
|
|
|
|
|
|
|
|
195
|
1
|
50
|
|
|
|
4
|
if ($self->plugin->mod_perl) { |
196
|
0
|
|
|
|
|
0
|
require CGI::Lazy::ModPerl; |
197
|
0
|
|
|
|
|
0
|
$self->{_mod_perl} = CGI::Lazy::ModPerl->new($self); |
198
|
|
|
|
|
|
|
} |
199
|
|
|
|
|
|
|
|
200
|
1
|
|
|
|
|
5
|
return $self; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
|
|
|
|
|
|
#------------------------------------------------------------ |
204
|
|
|
|
|
|
|
sub lazyversion { |
205
|
1
|
|
|
1
|
1
|
1925
|
my $self = shift; |
206
|
|
|
|
|
|
|
|
207
|
1
|
|
|
|
|
6
|
return $VERSION; |
208
|
|
|
|
|
|
|
} |
209
|
|
|
|
|
|
|
|
210
|
|
|
|
|
|
|
#------------------------------------------------------------ |
211
|
|
|
|
|
|
|
sub plugin { |
212
|
6
|
|
|
6
|
1
|
12
|
my $self = shift; |
213
|
|
|
|
|
|
|
|
214
|
6
|
|
|
|
|
50
|
return $self->{_plugin}; |
215
|
|
|
|
|
|
|
} |
216
|
|
|
|
|
|
|
|
217
|
|
|
|
|
|
|
#------------------------------------------------------------ |
218
|
|
|
|
|
|
|
sub session { |
219
|
0
|
|
|
0
|
1
|
0
|
my $self = shift; |
220
|
|
|
|
|
|
|
|
221
|
0
|
|
|
|
|
0
|
return $self->{_session}; |
222
|
|
|
|
|
|
|
} |
223
|
|
|
|
|
|
|
|
224
|
|
|
|
|
|
|
#------------------------------------------------------------ |
225
|
|
|
|
|
|
|
sub template { |
226
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
227
|
1
|
|
|
|
|
2
|
my $template = shift; |
228
|
|
|
|
|
|
|
|
229
|
1
|
50
|
|
|
|
8
|
if ($self->{_template}->{$template}) { #if it's been created, return it |
230
|
0
|
|
|
|
|
0
|
return $self->{_template}->{$template}; |
231
|
|
|
|
|
|
|
} else { #if not, create it and return it |
232
|
1
|
|
|
|
|
10
|
return $self->{_template}->{$template} = CGI::Lazy::Template->new($self, $template); |
233
|
|
|
|
|
|
|
} |
234
|
|
|
|
|
|
|
} |
235
|
|
|
|
|
|
|
|
236
|
|
|
|
|
|
|
#------------------------------------------------------------ |
237
|
|
|
|
|
|
|
sub util { |
238
|
1
|
|
|
1
|
1
|
2
|
my $self = shift; |
239
|
|
|
|
|
|
|
|
240
|
1
|
|
|
|
|
9
|
return CGI::Lazy::Utility->new($self); |
241
|
|
|
|
|
|
|
|
242
|
|
|
|
|
|
|
} |
243
|
|
|
|
|
|
|
|
244
|
|
|
|
|
|
|
#------------------------------------------------------------ |
245
|
|
|
|
|
|
|
sub vars { |
246
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
247
|
|
|
|
|
|
|
|
248
|
2
|
|
|
|
|
18
|
return $self->{_vars}; |
249
|
|
|
|
|
|
|
} |
250
|
|
|
|
|
|
|
|
251
|
|
|
|
|
|
|
#------------------------------------------------------------ |
252
|
|
|
|
|
|
|
sub widget { |
253
|
1
|
|
|
1
|
1
|
3
|
my $self = shift; |
254
|
|
|
|
|
|
|
|
255
|
1
|
|
|
|
|
9
|
return CGI::Lazy::Widget->new($self); |
256
|
|
|
|
|
|
|
} |
257
|
|
|
|
|
|
|
|
258
|
|
|
|
|
|
|
1; |
259
|
|
|
|
|
|
|
|
260
|
|
|
|
|
|
|
__END__ |