line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
#response object |
2
|
|
|
|
|
|
|
package PSGI::Hector::Response::NotModified; |
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
=pod |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
=head1 NAME |
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
Response NotModified - View plugin to return a 304 Response |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
=head1 SYNOPSIS |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
my $response = $hector->getResponse(); |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head1 DESCRIPTION |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
This view plugin is automatically used by L when the request Etag matches the current request, eg, the client |
17
|
|
|
|
|
|
|
has a copy of the page already. |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
=head1 METHODS |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
=cut |
22
|
|
|
|
|
|
|
|
23
|
1
|
|
|
1
|
|
889
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
25
|
|
24
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
24
|
|
25
|
1
|
|
|
1
|
|
4
|
use parent qw(PSGI::Hector::Response::Base); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
26
|
|
|
|
|
|
|
######################################################### |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
=head2 new($hector) |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
Constructor, sets the HTTP response code to 304 |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=cut |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
######################################################### |
35
|
|
|
|
|
|
|
sub new{ |
36
|
0
|
|
|
0
|
1
|
|
my($class, $hector) = @_; |
37
|
0
|
|
|
|
|
|
my $self = $class->SUPER::new($hector); |
38
|
0
|
|
|
|
|
|
bless $self, $class; |
39
|
0
|
|
|
|
|
|
$self->code(304); |
40
|
0
|
|
|
|
|
|
$self->message('Not Modified'); |
41
|
0
|
|
|
|
|
|
return $self; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
######################################################### |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
=pod |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
=head2 display() |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
$response->display(); |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
This method is called automatically at the end of an action. |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
Just displays the HTTP headers as no body is needed for a 304 response. |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
=cut |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
######################################################### |
58
|
|
|
|
|
|
|
sub display{ #this sub will display the page headers if needed |
59
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
60
|
0
|
|
|
|
|
|
print "Status: " . $self->as_string(); |
61
|
0
|
|
|
|
|
|
return 1; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
######################################################### |
64
|
|
|
|
|
|
|
#FIXME not required |
65
|
|
|
|
|
|
|
######################################################### |
66
|
|
|
|
|
|
|
sub setTemplate{ |
67
|
0
|
|
|
0
|
0
|
|
return 1; |
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
######################################################### |
70
|
|
|
|
|
|
|
#FIXME not required |
71
|
|
|
|
|
|
|
######################################################### |
72
|
|
|
|
|
|
|
sub setError{ |
73
|
0
|
|
|
0
|
1
|
|
return 1; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
######################################################### |
76
|
|
|
|
|
|
|
#FIXME not required |
77
|
|
|
|
|
|
|
######################################################### |
78
|
|
|
|
|
|
|
sub setTemplateVar{ |
79
|
0
|
|
|
0
|
0
|
|
return 1; |
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
############################################################## |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=pod |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 Notes |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 Author |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
MacGyveR |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
Development questions, bug reports, and patches are welcome to the above address. |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 See Also |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
=head1 Copyright |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
Copyright (c) 2017 MacGyveR. All rights reserved. |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=cut |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
######################################################### |
104
|
|
|
|
|
|
|
return 1; |