line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Parse::Date::Month::EN; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
69654
|
use 5.010001; |
|
1
|
|
|
|
|
16
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
20
|
|
5
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
9
|
|
|
1
|
|
|
|
|
38
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
6
|
use Exporter qw(import); |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
371
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
10
|
|
|
|
|
|
|
our $DATE = '2023-06-16'; # DATE |
11
|
|
|
|
|
|
|
our $DIST = 'Parse-Date-Month-EN'; # DIST |
12
|
|
|
|
|
|
|
our $VERSION = '0.001'; # VERSION |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
our @EXPORT_OK = qw(parse_date_month_en $Pat); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our %month_values = ( |
17
|
|
|
|
|
|
|
jn => 1, |
18
|
|
|
|
|
|
|
jan => 1, |
19
|
|
|
|
|
|
|
january => 1, |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
fe => 2, |
22
|
|
|
|
|
|
|
feb => 2, |
23
|
|
|
|
|
|
|
february => 2, |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
mr => 3, |
26
|
|
|
|
|
|
|
mar => 3, |
27
|
|
|
|
|
|
|
march => 3, |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
ap => 4, |
30
|
|
|
|
|
|
|
apr => 4, |
31
|
|
|
|
|
|
|
april => 4, |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my => 5, |
34
|
|
|
|
|
|
|
may => 5, |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
jn => 6, |
37
|
|
|
|
|
|
|
jun => 6, |
38
|
|
|
|
|
|
|
june => 6, |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
jl => 7, |
41
|
|
|
|
|
|
|
jul => 7, |
42
|
|
|
|
|
|
|
july => 7, |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
au => 8, |
45
|
|
|
|
|
|
|
agt => 8, |
46
|
|
|
|
|
|
|
aug => 8, |
47
|
|
|
|
|
|
|
august => 8, |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
se => 9, |
50
|
|
|
|
|
|
|
sep => 9, |
51
|
|
|
|
|
|
|
sept => 9, |
52
|
|
|
|
|
|
|
september => 9, |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
oc => 10, |
55
|
|
|
|
|
|
|
oct => 10, |
56
|
|
|
|
|
|
|
october => 10, |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
nv => 11, |
59
|
|
|
|
|
|
|
nov => 11, |
60
|
|
|
|
|
|
|
nop => 11, |
61
|
|
|
|
|
|
|
november => 11, |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
de => 12, |
64
|
|
|
|
|
|
|
dec => 12, |
65
|
|
|
|
|
|
|
december => 12, |
66
|
|
|
|
|
|
|
); |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
our $Pat = join("|", sort keys %month_values); $Pat = qr/(?:$Pat)/; |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
our %SPEC; |
71
|
|
|
|
|
|
|
|
72
|
|
|
|
|
|
|
$SPEC{parse_date_month_en} = { |
73
|
|
|
|
|
|
|
v => 1.1, |
74
|
|
|
|
|
|
|
summary => 'Parse month name from English text', |
75
|
|
|
|
|
|
|
description => <<'_', |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
Returns undef when month name is unrecognized. |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
_ |
80
|
|
|
|
|
|
|
args => { |
81
|
|
|
|
|
|
|
text => { |
82
|
|
|
|
|
|
|
summary => 'The input text that contains month name', |
83
|
|
|
|
|
|
|
schema => 'str*', |
84
|
|
|
|
|
|
|
pos => 0, |
85
|
|
|
|
|
|
|
req => 1, |
86
|
|
|
|
|
|
|
}, |
87
|
|
|
|
|
|
|
}, |
88
|
|
|
|
|
|
|
result_naked => 1, |
89
|
|
|
|
|
|
|
}; |
90
|
|
|
|
|
|
|
sub parse_date_month_en { |
91
|
5
|
|
|
5
|
1
|
117
|
my %args = @_; |
92
|
5
|
|
|
|
|
10
|
my $text = $args{text}; |
93
|
|
|
|
|
|
|
|
94
|
5
|
|
|
|
|
18
|
$text =~ s/^\s+//s; |
95
|
5
|
50
|
|
|
|
14
|
return undef unless length($text); ## no critic: Subroutines::ProhibitExplicitReturnUndef |
96
|
|
|
|
|
|
|
|
97
|
5
|
|
|
|
|
29
|
$month_values{lc $text}; |
98
|
|
|
|
|
|
|
} |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
1; |
101
|
|
|
|
|
|
|
# ABSTRACT: Parse month name from English text |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__END__ |