| 1 | #!/usr/bin/perl | ||||||||||
| 2 | 30 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 30 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | |||||||||||
| 5 | package WWW::Shopify::Liquid::Filter::DateParse; | ||||||||||
| 6 | 30 | ▶ | use base 'WWW::Shopify::Liquid::Filter'; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | 30 | ▶ | use Date::Parse; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | 30 | ▶ | use DateTime::Format::Strptime; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | 0 | ▶ | sub min_arguments { return 0; } | ||||||||
|
Subroutine
min_arguments: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 11 | 0 | ▶ | sub max_arguments { return 1; } | ||||||||
|
Subroutine
max_arguments: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 12 | sub operate { | ||||||||||
| 13 | 0 | ▶ | my ($self, $hash, $operand, $pattern) = @_; | ||||||||
|
Subroutine
operate: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 14 | 0 | ▶ | if ($pattern) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | 0 | my $strp = DateTime::Format::Strptime->new(pattern => $pattern); | |||||||||
| 16 | 0 | return $strp->parse_datetime($operand); | |||||||||
| 17 | } | ||||||||||
| 18 | 0 | my $result = str2time($operand, "UTC"); | |||||||||
| 19 | 0 | ▶ | return undef unless $result; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 20 | 0 | return DateTime->from_epoch( epoch => $result ); | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 30 | 1; | |||||||||