line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#factory response object |
2
|
|
|
|
|
|
|
package PSGI::Hector::Response; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=pod |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
PSGI::Hector::Response - Page response class |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 DESCRIPTION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
Factory class for creating response objects. |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
=head1 METHODS |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
|
5
|
|
25
|
use strict; |
|
5
|
|
|
|
|
7
|
|
|
5
|
|
|
|
|
110
|
|
21
|
5
|
|
|
5
|
|
20
|
use warnings; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
607
|
|
22
|
|
|
|
|
|
|
######################################################### |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
=pod |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
=head2 new($hector, $plugin) |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
Constructor, a factory method that will return an instance of the requested response plugin. |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
If the response is not modified from the client's provided Etag header an instance of L |
31
|
|
|
|
|
|
|
will be returned instead. |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
=cut |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
######################################################### |
36
|
|
|
|
|
|
|
sub new{ |
37
|
8
|
|
|
8
|
1
|
14
|
my($class, $hector, $plugin) = @_; |
38
|
8
|
50
|
|
|
|
18
|
if($plugin){ |
39
|
8
|
|
|
4
|
|
403
|
eval "use $plugin;"; #should do this a better way |
|
4
|
|
|
1
|
|
697
|
|
|
4
|
|
|
1
|
|
11
|
|
|
4
|
|
|
1
|
|
88
|
|
|
1
|
|
|
1
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
16
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
19
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
10
|
|
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
11
|
|
40
|
8
|
50
|
|
|
|
28
|
if(!$@){ #plugin loaded ok |
41
|
8
|
|
|
|
|
24
|
my $self = $plugin->new($hector); |
42
|
8
|
|
|
|
|
26
|
return $self; |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
else{ |
45
|
0
|
|
|
|
|
0
|
die("Plugin load problem: $@"); |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
} |
48
|
|
|
|
|
|
|
else{ |
49
|
0
|
|
|
|
|
0
|
die("No plugin given"); |
50
|
|
|
|
|
|
|
} |
51
|
0
|
|
|
|
|
0
|
return undef; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
######################################################### |
54
|
|
|
|
|
|
|
=pod |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
=head1 Notes |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=head1 Author |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
MacGyveR |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
Development questions, bug reports, and patches are welcome to the above address. |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
=head1 See Also |
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
=head1 Copyright |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
Copyright (c) 2017 MacGyveR. All rights reserved. |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
=cut |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
########################################## |
75
|
|
|
|
|
|
|
return 1; |