| 1 | package Banal::DateTime; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 2 | ▶ | use 5.006; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | 2 | ▶ | use utf8; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 5 | 2 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 6 | 2 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 7 | 2 | ▶ | no warnings qw(uninitialized); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | |||||||||||||||||||||
| 9 | 2 | our $VERSION = '0.10'; | |||||||||||||||||||
| 10 | |||||||||||||||||||||
| 11 | 2 | ▶ | use DateTime; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 2 | our @ISA = qw(DateTime); | |||||||||||||||||||
| 13 | |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | #******************************************** | ||||||||||||||||||||
| 16 | # CONSTRUCTORS | ||||||||||||||||||||
| 17 | #******************************************** | ||||||||||||||||||||
| 18 | 0 | ▶ | sub new { | ||||||||||||||||||
|
Subroutine
new: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 19 | 0 | my $proto = shift; | |||||||||||||||||||
| 20 | 0 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 21 | |||||||||||||||||||||
| 22 | 0 | my $self = DateTime->new(@_); | |||||||||||||||||||
| 23 | 0 | return bless $self, $class; | |||||||||||||||||||
| 24 | } | ||||||||||||||||||||
| 25 | |||||||||||||||||||||
| 26 | #================================= | ||||||||||||||||||||
| 27 | 0 | ▶ | sub from_epoch { | ||||||||||||||||||
|
Subroutine
from_epoch: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 28 | 0 | my $proto = shift; | |||||||||||||||||||
| 29 | 0 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 30 | |||||||||||||||||||||
| 31 | 0 | my $self = DateTime->from_epoch(@_); | |||||||||||||||||||
| 32 | 0 | return bless $self, $class; | |||||||||||||||||||
| 33 | } | ||||||||||||||||||||
| 34 | |||||||||||||||||||||
| 35 | #================================= | ||||||||||||||||||||
| 36 | 0 | ▶ | sub now { | ||||||||||||||||||
|
Subroutine
now: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 37 | 0 | my $proto = shift; | |||||||||||||||||||
| 38 | 0 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 39 | |||||||||||||||||||||
| 40 | 0 | my $self = DateTime->now(@_); | |||||||||||||||||||
| 41 | 0 | return bless $self, $class; | |||||||||||||||||||
| 42 | } | ||||||||||||||||||||
| 43 | |||||||||||||||||||||
| 44 | #================================= | ||||||||||||||||||||
| 45 | 0 | ▶ | sub today { | ||||||||||||||||||
|
Subroutine
today: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 46 | 0 | my $proto = shift; | |||||||||||||||||||
| 47 | 0 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 0 | my $self = DateTime->today(@_); | |||||||||||||||||||
| 50 | 0 | return bless $self, $class; | |||||||||||||||||||
| 51 | } | ||||||||||||||||||||
| 52 | |||||||||||||||||||||
| 53 | #================================= | ||||||||||||||||||||
| 54 | 0 | ▶ | sub from_object { | ||||||||||||||||||
|
Subroutine
from_object: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 55 | 0 | my $proto = shift; | |||||||||||||||||||
| 56 | 0 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 57 | |||||||||||||||||||||
| 58 | 0 | my $self = DateTime->from_object(@_); | |||||||||||||||||||
| 59 | 0 | return bless $self, $class; | |||||||||||||||||||
| 60 | } | ||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | #================================= | ||||||||||||||||||||
| 63 | 0 | ▶ | sub last_day_of_month { | ||||||||||||||||||
|
Subroutine
last_day_of_month: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 64 | 0 | my $proto = shift; | |||||||||||||||||||
| 65 | 0 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 66 | |||||||||||||||||||||
| 67 | 0 | my $self = DateTime->last_day_of_month(@_); | |||||||||||||||||||
| 68 | 0 | return bless $self, $class; | |||||||||||||||||||
| 69 | } | ||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | #================================= | ||||||||||||||||||||
| 72 | 0 | ▶ | sub from_day_of_year { | ||||||||||||||||||
|
Subroutine
from_day_of_year: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||||||||||||
| 73 | 0 | my $proto = shift; | |||||||||||||||||||
| 74 | 0 | ▶ | my $class = ref($proto) || $proto; | ||||||||||||||||||
|
Condition0%0/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table0%0/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | 0 | my $self = DateTime->from_day_of_year(@_); | |||||||||||||||||||
| 77 | 0 | return bless $self, $class; | |||||||||||||||||||
| 78 | } | ||||||||||||||||||||
| 79 | |||||||||||||||||||||
| 80 | |||||||||||||||||||||
| 81 | #******************************************** | ||||||||||||||||||||
| 82 | # OBJECT METHODS | ||||||||||||||||||||
| 83 | #******************************************** | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | #======================= | ||||||||||||||||||||
| 86 | # Always 4 digits (at a minimum) | ||||||||||||||||||||
| 87 | #====================== | ||||||||||||||||||||
| 88 | 0 | ▶ | sub year_std { | ||||||||||||||||||
|
Subroutine
year_std: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 89 | 0 | return shift->year(); | |||||||||||||||||||
| 90 | } | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | #======================= | ||||||||||||||||||||
| 94 | # Always 2 digits | ||||||||||||||||||||
| 95 | #====================== | ||||||||||||||||||||
| 96 | 0 | ▶ | sub month_std { | ||||||||||||||||||
|
Subroutine
month_std: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 97 | 0 | return shift->strftime("%m"); | |||||||||||||||||||
| 98 | } | ||||||||||||||||||||
| 99 | |||||||||||||||||||||
| 100 | #======================= | ||||||||||||||||||||
| 101 | # Always 2 digits | ||||||||||||||||||||
| 102 | #====================== | ||||||||||||||||||||
| 103 | 0 | ▶ | sub day_std { | ||||||||||||||||||
|
Subroutine
day_std: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 104 | 0 | return shift->strftime("%d"); | |||||||||||||||||||
| 105 | } | ||||||||||||||||||||
| 106 | |||||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | |||||||||||||||||||||
| 109 | |||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | |||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | |||||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | 2 | 1; | |||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | |||||||||||||||||||||
| 118 | |||||||||||||||||||||
| 119 | |||||||||||||||||||||
| 120 | __END__ | ||||||||||||||||||||