| 1 | package Time::Moment::Ext; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use Time::Piece; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use parent 'Time::Moment'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | |||||||||||||||||||||||||||||
| 9 | 2 | our $VERSION = '0.06'; | |||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 2 | my $SQL_FORMAT = '%Y-%m-%d %H:%M:%S'; | |||||||||||||||||||||||||||
| 12 | 2 | my $SQL_DATE = '%Y-%m-%d'; | |||||||||||||||||||||||||||
| 13 | 2 | my $SQL_TIME = '%H:%M:%S'; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 2 | ▶ | sub Time::Moment::strptime { | ||||||||||||||||||||||||||
|
Subroutine
strptime: called CC=3 SCAR=12.5
Pod
undocumented
| |||||||||||||||||||||||||||||
| 16 | 2 | my ($class, $str, $format) = @_; | |||||||||||||||||||||||||||
| 17 | 2 | ▶ | return unless ($str && $format); | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$str and $format
MC/DC0%0/2
$str and $format
$str
$format
Truth table33%1/3
A and B
A= $strB= $format
| |||||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 2 | return $class->from_object(scalar localtime->strptime($str, $format)); | |||||||||||||||||||||||||||
| 20 | } | ||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||
| 22 | 2 | ▶ | sub Time::Moment::from_datetime { | ||||||||||||||||||||||||||
|
Subroutine
from_datetime: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||
| 23 | 2 | my ($class, $str) = @_; | |||||||||||||||||||||||||||
| 24 | 2 | ▶ | return unless $str; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||
| 26 | 2 | return $class->strptime($str, $SQL_FORMAT); | |||||||||||||||||||||||||||
| 27 | } | ||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | 1 | ▶ | sub Time::Moment::to_datetime { | ||||||||||||||||||||||||||
|
Subroutine
to_datetime: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 30 | 1 | return shift->strftime($SQL_FORMAT); | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||
| 33 | 1 | ▶ | sub Time::Moment::to_date { | ||||||||||||||||||||||||||
|
Subroutine
to_date: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 34 | 1 | return shift->strftime($SQL_DATE); | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | 1 | ▶ | sub Time::Moment::to_time { | ||||||||||||||||||||||||||
|
Subroutine
to_time: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 38 | 1 | return shift->strftime($SQL_TIME); | |||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 2 | ▶ | sub Time::Moment::day { | ||||||||||||||||||||||||||
|
Subroutine
day: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 42 | 2 | return shift->day_of_month; | |||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | 2 | 1; | |||||||||||||||||||||||||||
| 46 | __END__ | ||||||||||||||||||||||||||||