| 1 | package Articulate::Enrichment::DateUpdated; | ||
| 2 | 6 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 3 | 6 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 6 | ▶ | use Text::Markdown; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 6 | 6 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 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<meta.schema.core.dateUpdated>) to the current | ||
| 17 | time. | ||
| 18 | |||
| 19 | =cut | ||
| 20 | |||
| 21 | 6 | ▶ | use DateTime; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 22 | |||
| 23 | 2 | ▶ | sub _now { |
|
Subroutine
_now: called CC=1 SCAR=0.0
| |||
| 24 | 2 | DateTime->now; | |
| 25 | } | ||
| 26 | |||
| 27 | 2 | ▶ | sub enrich { |
|
Subroutine
enrich: called CC=1 SCAR=0.0
Pod
documented
| |||
| 28 | 2 | my $self = shift; | |
| 29 | 2 | my $item = shift; | |
| 30 | 2 | my $request = shift; | |
| 31 | 2 | my $now = _now; | |
| 32 | 2 | $item->meta->{schema}->{core}->{dateUpdated} = "$now"; | |
| 33 | 2 | return $item; | |
| 34 | } | ||
| 35 | |||
| 36 | 6 | 1; | |