File Coverage

blib/lib/Petal/Utils/Date.pm
Criterion Covered Total %
statement 27 27 100.0
branch 1 2 50.0
condition 1 3 33.3
subroutine 8 8 100.0
pod 0 1 0.0
total 37 41 90.2


line stmt bran cond sub pod time code
1             package Petal::Utils::Date;
2              
3 2     2   12 use strict;
  2         5  
  2         98  
4 2     2   10 use warnings::register;
  2         4  
  2         307  
5              
6 2     2   12 use Carp;
  2         3  
  2         129  
7 2     2   2639 use Date::Format;
  2         18796  
  2         200  
8              
9 2     2   21 use base qw( Petal::Utils::Base );
  2         4  
  2         762  
10              
11 2     2   13 use constant name => 'date';
  2         3  
  2         136  
12 2     2   11 use constant aliases => qw();
  2         60  
  2         403  
13              
14             our $VERSION = ((require Petal::Utils), $Petal::Utils::VERSION)[1];
15             our $REVISION = (split(/ /, ' $Revision: 1.2 $ '))[2];
16              
17             sub process {
18 1     1 0 26830 my $self = shift;
19 1         2 my $hash = shift;
20 1   33     6 my $args = shift || confess( "'date' expects a variable (got nothing)" );
21 1         6 my $result = $hash->fetch( $args );
22 1 50       153 return unless length($result); # do nothing if $args evaluates to nothing
23 1         7 return time2str('%b %e %Y %T', $result);
24             }
25              
26             1;