line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Articulate::Enrichment::DateCreated; |
2
|
6
|
|
|
6
|
|
3242
|
use strict; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
190
|
|
3
|
6
|
|
|
6
|
|
25
|
use warnings; |
|
6
|
|
|
|
|
12
|
|
|
6
|
|
|
|
|
129
|
|
4
|
|
|
|
|
|
|
|
5
|
6
|
|
|
6
|
|
3000
|
use Text::Markdown; |
|
6
|
|
|
|
|
33815
|
|
|
6
|
|
|
|
|
314
|
|
6
|
6
|
|
|
6
|
|
42
|
use Moo; |
|
6
|
|
|
|
|
9
|
|
|
6
|
|
|
|
|
50
|
|
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
|
6
|
|
|
6
|
|
3553
|
use DateTime; |
|
6
|
|
|
|
|
194808
|
|
|
6
|
|
|
|
|
612
|
|
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub _now { |
23
|
2
|
|
|
2
|
|
24
|
DateTime->now; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub enrich { |
27
|
2
|
|
|
2
|
1
|
4
|
my $self = shift; |
28
|
2
|
|
|
|
|
5
|
my $item = shift; |
29
|
2
|
|
|
|
|
3
|
my $request = shift; |
30
|
2
|
|
|
|
|
8
|
my $now = _now; |
31
|
2
|
|
33
|
|
|
1059
|
$item->meta->{schema}->{core}->{dateCreated} //= "$now"; |
32
|
2
|
|
|
|
|
115
|
return $item; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
1; |