File Coverage

lib/Spoon/Headers.pm
Criterion Covered Total %
statement 9 21 42.8
branch 0 2 0.0
condition n/a
subroutine 3 8 37.5
pod 0 5 0.0
total 12 36 33.3


line stmt bran cond sub pod time code
1             package Spoon::Headers;
2 3     3   1875 use Spoon::Base -Base;
  3         5  
  3         34  
3 3     3   2319  
  3     3   6  
  3         110  
  3         17  
  3         6  
  3         1043  
4             field content_type => 'text/html';
5             field charset => 'UTF-8';
6             field expires => 'now';
7             field pragma => 'no-cache';
8             field cache_control => 'no-cache';
9             field redirect => '';
10              
11 0     0 0   sub print {
12 0           my $headers = $self->get;
13 0           $self->utf8_encode($headers);
14 0           print $headers;
15             }
16              
17 0     0 0   sub get {
18 0 0         $self->redirect
19             ? CGI::redirect($self->redirect_value)
20             : CGI::header($self->value);
21             }
22              
23 0     0 0   sub redirect_value {
24             (
25 0           $self->hub->cookie->set_cookie_headers,
26             -location => $self->redirect,
27             );
28             }
29              
30 0     0 0   sub value {
31             (
32 0           $self->hub->cookie->set_cookie_headers,
33             -charset => $self->charset,
34             -type => $self->content_type,
35             -expires => $self->expires,
36             -pragma => $self->pragma,
37             -cache_control => $self->cache_control,
38             -last_modified => $self->last_modified,
39             );
40             }
41              
42 0     0 0   sub last_modified {
43 0           scalar gmtime;
44             }