File Coverage

blib/lib/Banal/DateTime.pm
Criterion Covered Total %
statement 18 49 36.7
branch n/a
condition 0 21 0.0
subroutine 6 16 37.5
pod 10 10 100.0
total 34 96 35.4


line stmt bran cond sub pod time code
1             package Banal::DateTime;
2              
3 1     1   25941 use 5.006;
  1         4  
  1         62  
4 1     1   1093 use utf8;
  1         11  
  1         6  
5 1     1   37 use strict;
  1         8  
  1         37  
6 1     1   5 use warnings;
  1         2  
  1         42  
7 1     1   5 no warnings qw(uninitialized);
  1         2  
  1         54  
8              
9             our $VERSION = '0.10';
10              
11 1     1   1643 use DateTime;
  1         316885  
  1         751  
12             our @ISA = qw(DateTime);
13              
14              
15             #********************************************
16             # CONSTRUCTORS
17             #********************************************
18             sub new {
19 0     0 1   my $proto = shift;
20 0   0       my $class = ref($proto) || $proto;
21            
22 0           my $self = DateTime->new(@_);
23 0           return bless $self, $class;
24             }
25              
26             #=================================
27             sub from_epoch {
28 0     0 1   my $proto = shift;
29 0   0       my $class = ref($proto) || $proto;
30            
31 0           my $self = DateTime->from_epoch(@_);
32 0           return bless $self, $class;
33             }
34              
35             #=================================
36             sub now {
37 0     0 1   my $proto = shift;
38 0   0       my $class = ref($proto) || $proto;
39            
40 0           my $self = DateTime->now(@_);
41 0           return bless $self, $class;
42             }
43              
44             #=================================
45             sub today {
46 0     0 1   my $proto = shift;
47 0   0       my $class = ref($proto) || $proto;
48            
49 0           my $self = DateTime->today(@_);
50 0           return bless $self, $class;
51             }
52              
53             #=================================
54             sub from_object {
55 0     0 1   my $proto = shift;
56 0   0       my $class = ref($proto) || $proto;
57            
58 0           my $self = DateTime->from_object(@_);
59 0           return bless $self, $class;
60             }
61              
62             #=================================
63             sub last_day_of_month {
64 0     0 1   my $proto = shift;
65 0   0       my $class = ref($proto) || $proto;
66            
67 0           my $self = DateTime->last_day_of_month(@_);
68 0           return bless $self, $class;
69             }
70              
71             #=================================
72             sub from_day_of_year {
73 0     0 1   my $proto = shift;
74 0   0       my $class = ref($proto) || $proto;
75            
76 0           my $self = DateTime->from_day_of_year(@_);
77 0           return bless $self, $class;
78             }
79              
80              
81             #********************************************
82             # OBJECT METHODS
83             #********************************************
84              
85             #=======================
86             # Always 4 digits (at a minimum)
87             #======================
88             sub year_std {
89 0     0 1   return shift->year();
90             }
91              
92              
93             #=======================
94             # Always 2 digits
95             #======================
96             sub month_std {
97 0     0 1   return shift->strftime("%m");
98             }
99              
100             #=======================
101             # Always 2 digits
102             #======================
103             sub day_std {
104 0     0 1   return shift->strftime("%d");
105             }
106              
107              
108              
109              
110              
111              
112              
113              
114              
115             1;
116              
117              
118              
119              
120             __END__