line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Articulate::Enrichment::DateCreated; |
2
|
5
|
|
|
5
|
|
2535
|
use strict; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
158
|
|
3
|
5
|
|
|
5
|
|
18
|
use warnings; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
102
|
|
4
|
|
|
|
|
|
|
|
5
|
5
|
|
|
5
|
|
2365
|
use Text::Markdown; |
|
5
|
|
|
|
|
25912
|
|
|
5
|
|
|
|
|
222
|
|
6
|
5
|
|
|
5
|
|
30
|
use Moo; |
|
5
|
|
|
|
|
5
|
|
|
5
|
|
|
|
|
34
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
=head1 NAME |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
Articulate::Enrichment::DateCreated - add a creation date to the meta |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
=head1 METHODS |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
=head3 enrich |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
Sets the creation date (C) to the current time, unless it already has a defined value. |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
=cut |
19
|
|
|
|
|
|
|
|
20
|
5
|
|
|
5
|
|
4716
|
use DateTime; |
|
5
|
|
|
|
|
359533
|
|
|
5
|
|
|
|
|
596
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _now { |
23
|
2
|
|
|
2
|
|
14
|
DateTime->now; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub enrich { |
27
|
2
|
|
|
2
|
1
|
8
|
my $self = shift; |
28
|
2
|
|
|
|
|
4
|
my $item = shift; |
29
|
2
|
|
|
|
|
2
|
my $request = shift; |
30
|
2
|
|
|
|
|
7
|
my $now = _now; |
31
|
2
|
|
33
|
|
|
676
|
$item->meta->{schema}->{core}->{dateCreated} //= "$now"; |
32
|
2
|
|
|
|
|
73
|
return $item; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |