File Coverage

blib/lib/HTTP/Headers/ActionPack/DateHeader.pm
Criterion Covered Total %
statement 24 31 77.4
branch n/a
condition n/a
subroutine 14 21 66.6
pod 16 16 100.0
total 54 68 79.4


line stmt bran cond sub pod time code
1             package HTTP::Headers::ActionPack::DateHeader;
2             BEGIN {
3 7     7   250466 $HTTP::Headers::ActionPack::DateHeader::AUTHORITY = 'cpan:STEVAN';
4             }
5             {
6             $HTTP::Headers::ActionPack::DateHeader::VERSION = '0.09';
7             }
8             # ABSTRACT: A Date Header
9              
10 7     7   55 use strict;
  7         17  
  7         218  
11 7     7   40 use warnings;
  7         14  
  7         263  
12              
13 7         57 use HTTP::Headers::ActionPack::Util qw[
14             header_to_date
15             date_to_header
16 7     7   2332 ];
  7         18  
17              
18 7     7   6845 use parent 'HTTP::Headers::ActionPack::Core::Base';
  7         1413  
  7         42  
19              
20             sub BUILDARGS {
21 9     9 1 24 my (undef, $date) = @_;
22 9         80 +{ date => $date }
23             }
24              
25             sub new_from_string {
26 8     8 1 1598 my ($class, $header_string) = @_;
27 8         54 $class->new( header_to_date( $header_string ) );
28             }
29              
30 15     15 1 26090 sub as_string { date_to_header( (shift)->{'date'} ) }
31              
32             # implement a simple API
33 2     2 1 668 sub second { (shift)->{'date'}->second }
34 2     2 1 634 sub minute { (shift)->{'date'}->minute }
35 2     2 1 644 sub hour { (shift)->{'date'}->hour }
36 0     0 1 0 sub day_of_month { (shift)->{'date'}->day_of_month }
37 0     0 1 0 sub month_number { (shift)->{'date'}->mon }
38 0     0 1 0 sub fullmonth { (shift)->{'date'}->fullmonth }
39 2     2 1 860 sub month { (shift)->{'date'}->month }
40 2     2 1 668 sub year { (shift)->{'date'}->year }
41 0     0 1 0 sub day_of_week { (shift)->{'date'}->day_of_week }
42 2     2 1 873 sub day { (shift)->{'date'}->day }
43 0     0 1   sub fullday { (shift)->{'date'}->fullday }
44 0     0 1   sub epoch { (shift)->{'date'}->epoch }
45              
46 0     0 1   sub date { (shift)->{'date'} }
47              
48             1;
49              
50             __END__