| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Acme::CPANModules::Parse::HumanDate; |
|
2
|
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
520779
|
use strict; |
|
|
1
|
|
|
|
|
3
|
|
|
|
1
|
|
|
|
|
211
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
|
6
|
|
|
|
|
|
|
our $DATE = '2023-10-31'; # DATE |
|
7
|
|
|
|
|
|
|
our $DIST = 'Acme-CPANModules-Parse-HumanDate'; # DIST |
|
8
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
|
9
|
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $LIST = { |
|
11
|
|
|
|
|
|
|
summary => "List of modules that parse human date/time expression", |
|
12
|
|
|
|
|
|
|
entries => [ |
|
13
|
|
|
|
|
|
|
{ |
|
14
|
|
|
|
|
|
|
module=>'DateTime::Format::Natural', |
|
15
|
|
|
|
|
|
|
description => <<'_', |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Compared to , this module can also parse |
|
18
|
|
|
|
|
|
|
duration in addition to date/time, e.g.: |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
2 years 3 months |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
And it also can extract the date expression from a longer string. |
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
Speed-wise, I'd say the two modules are roughly comparable. For some patterns |
|
25
|
|
|
|
|
|
|
one might be faster than the other. |
|
26
|
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
_ |
|
28
|
|
|
|
|
|
|
bench_code_template => 'DateTime::Format::Natural->new->parse_datetime()', |
|
29
|
|
|
|
|
|
|
}, |
|
30
|
|
|
|
|
|
|
{ |
|
31
|
|
|
|
|
|
|
module=>'DateTime::Format::Flexible', |
|
32
|
|
|
|
|
|
|
description => <<'_', |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
One advantage of this over is its time zone |
|
35
|
|
|
|
|
|
|
support, e.g.: |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
yesterday 8pm UTC |
|
38
|
|
|
|
|
|
|
yesterday 20:00 +0800 |
|
39
|
|
|
|
|
|
|
yesterday 20:00 Asia/Jakarta |
|
40
|
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
Speed-wise, I'd say the two modules are roughly comparable. For some patterns |
|
42
|
|
|
|
|
|
|
one might be faster than the other. |
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
_ |
|
45
|
|
|
|
|
|
|
bench_code_template => 'DateTime::Format::Flexible->new->parse_datetime()', |
|
46
|
|
|
|
|
|
|
}, |
|
47
|
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
{ |
|
49
|
|
|
|
|
|
|
module => 'Date::Parse', |
|
50
|
|
|
|
|
|
|
description => <<'_', |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
This module can parse several formats, but does not really fall into "human |
|
53
|
|
|
|
|
|
|
date/time parser" as it lacks support for casual expression like "yesterday" or |
|
54
|
|
|
|
|
|
|
3 hours ago". |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
_ |
|
57
|
|
|
|
|
|
|
}, |
|
58
|
|
|
|
|
|
|
], |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
bench_datasets => [ |
|
61
|
|
|
|
|
|
|
{args=>{str => 'yesterday'}}, |
|
62
|
|
|
|
|
|
|
{args=>{str => '2 days ago'}}, |
|
63
|
|
|
|
|
|
|
{args=>{str => '2021-09-06 20:03:00'}}, |
|
64
|
|
|
|
|
|
|
], |
|
65
|
|
|
|
|
|
|
}; |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
1; |
|
68
|
|
|
|
|
|
|
# ABSTRACT: List of modules that parse human date/time expression |
|
69
|
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
__END__ |