File Coverage

blib/lib/Articulate/Enrichment/DateUpdated.pm
Criterion Covered Total %
statement 22 22 100.0
branch n/a
condition n/a
subroutine 7 7 100.0
pod 1 2 50.0
total 30 31 96.7


line stmt bran cond sub pod time code
1             package Articulate::Enrichment::DateUpdated;
2 5     5   3701 use strict;
  5         10  
  5         170  
3 5     5   22 use warnings;
  5         7  
  5         122  
4              
5 5     5   23 use Text::Markdown;
  5         13  
  5         194  
6 5     5   21 use Moo;
  5         9  
  5         273  
7              
8             =head1 NAME
9              
10             Articulate::Enrichment::DateUpdated - add a update date to the meta
11              
12             =head1 METHODS
13              
14             =head3 enrich
15              
16             Sets the update date (C) to the current time.
17              
18             =cut
19              
20 5     5   2306 use DateTime;
  5         89101  
  5         622  
21              
22             sub now {
23 2     2 0 7 DateTime->now;
24             }
25              
26             sub enrich {
27 2     2 1 3 my $self = shift;
28 2         3 my $item = shift;
29 2         5 my $request = shift;
30 2         5 my $now = now;
31 2         303 $item->meta->{schema}->{core}->{dateUpdated} = "$now";
32 2         43 return $item;
33             }
34              
35             1;