| 1 | package Venus::Date; | ||||||||||||||||||||
| 2 | |||||||||||||||||||||
| 3 | 2 | ▶ | use 5.018; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 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 | |||||||||||||||||||||
| 8 | 2 | ▶ | use Venus::Class 'attr', 'base', 'with'; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | |||||||||||||||||||||
| 10 | 2 | base 'Venus::Kind::Utility'; | |||||||||||||||||||
| 11 | |||||||||||||||||||||
| 12 | 2 | with 'Venus::Role::Buildable'; | |||||||||||||||||||
| 13 | 2 | with 'Venus::Role::Explainable'; | |||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | use overload ( | ||||||||||||||||||||
| 16 | '""' => 'explain', | ||||||||||||||||||||
| 17 | 1 | ▶ | '!=' => sub{("$_[0]" + 0) != ($_[1] + 0)}, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 18 | 2 | ▶ | '+' => sub{("$_[0]" + 0) + ($_[1] + 0)}, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 19 | 1 | ▶ | '-' => sub{("$_[0]" + 0) - ($_[1] + 0)}, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 20 | 198 | ▶ | '0+' => sub{($_[0]->epoch + 0)}, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 21 | 1 | ▶ | '<' => sub{("$_[0]" + 0) < ($_[1] + 0)}, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 22 | 1 | ▶ | '<=' => sub{("$_[0]" + 0) <= ($_[1] + 0)}, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 23 | 1 | ▶ | '==' => sub{("$_[0]" + 0) == ($_[1] + 0)}, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 24 | 1 | ▶ | '>' => sub{("$_[0]" + 0) > ($_[1] + 0)}, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 25 | 1 | ▶ | '>=' => sub{("$_[0]" + 0) >= ($_[1] + 0)}, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 26 | 1 | ▶ | 'eq' => sub{"$_[0]" eq "$_[1]"}, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 27 | 1 | ▶ | 'ne' => sub{"$_[0]" ne "$_[1]"}, | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 28 | 2 | '~~' => 'explain', | |||||||||||||||||||
| 29 | fallback => 1, | ||||||||||||||||||||
| 30 | 2 | ▶ | ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 31 | |||||||||||||||||||||
| 32 | # ATTRIBUTES | ||||||||||||||||||||
| 33 | |||||||||||||||||||||
| 34 | 2 | attr 'day'; | |||||||||||||||||||
| 35 | 2 | attr 'month'; | |||||||||||||||||||
| 36 | 2 | attr 'year'; | |||||||||||||||||||
| 37 | 2 | attr 'hour'; | |||||||||||||||||||
| 38 | 2 | attr 'minute'; | |||||||||||||||||||
| 39 | 2 | attr 'second'; | |||||||||||||||||||
| 40 | |||||||||||||||||||||
| 41 | # BUILDERS | ||||||||||||||||||||
| 42 | |||||||||||||||||||||
| 43 | sub build_arg { | ||||||||||||||||||||
| 44 | 93 | ▶ | my ($self, $time) = @_; | ||||||||||||||||||
|
Subroutine
build_arg: called CC=7 SCAR=23.8
Pod
undocumented
| |||||||||||||||||||||
| 45 | |||||||||||||||||||||
| 46 | 93 | my $data = {}; | |||||||||||||||||||
| 47 | 93 | my @time = gmtime $time; | |||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | 93 | ▶ | $data->{day} //= $time[3]; | ||||||||||||||||||
|
Condition33%1/3
$data->{"day"} //= $time[3]
MC/DC0%0/2
$data->{"day"} //= $time[3]
$data->{"day"}
$time[3]
Truth table33%1/3
A //= B
A= $data->{"day"}B= $time[3]
| |||||||||||||||||||||
| 50 | 93 | ▶ | $data->{hour} //= $time[2]; | ||||||||||||||||||
|
Condition33%1/3
$data->{"hour"} //= $time[2]
MC/DC0%0/2
$data->{"hour"} //= $time[2]
$data->{"hour"}
$time[2]
Truth table33%1/3
A //= B
A= $data->{"hour"}B= $time[2]
| |||||||||||||||||||||
| 51 | 93 | ▶ | $data->{minute} //= $time[1]; | ||||||||||||||||||
|
Condition33%1/3
$data->{"minute"} //= $time[1]
MC/DC0%0/2
$data->{"minute"} //= $time[1]
$data->{"minute"}
$time[1]
Truth table33%1/3
A //= B
A= $data->{"minute"}B= $time[1]
| |||||||||||||||||||||
| 52 | 93 | ▶ | $data->{month} //= $time[4] + 1; | ||||||||||||||||||
|
Condition33%1/3
$data->{"month"} //= $time[4] + 1
MC/DC0%0/2
$data->{"month"} //= $time[4] + 1
$data->{"month"}
$time[4] + 1
Truth table33%1/3
A //= B
A= $data->{"month"}B= $time[4] + 1
| |||||||||||||||||||||
| 53 | 93 | ▶ | $data->{second} //= $time[0]; | ||||||||||||||||||
|
Condition33%1/3
$data->{"second"} //= $time[0]
MC/DC0%0/2
$data->{"second"} //= $time[0]
$data->{"second"}
$time[0]
Truth table33%1/3
A //= B
A= $data->{"second"}B= $time[0]
| |||||||||||||||||||||
| 54 | 93 | ▶ | $data->{year} //= $time[5] + 1900; | ||||||||||||||||||
|
Condition33%1/3
$data->{"year"} //= $time[5] + 1900
MC/DC0%0/2
$data->{"year"} //= $time[5] + 1900
$data->{"year"}
$time[5] + 1900
Truth table33%1/3
A //= B
A= $data->{"year"}B= $time[5] + 1900
| |||||||||||||||||||||
| 55 | |||||||||||||||||||||
| 56 | 93 | return $data; | |||||||||||||||||||
| 57 | } | ||||||||||||||||||||
| 58 | |||||||||||||||||||||
| 59 | sub build_args { | ||||||||||||||||||||
| 60 | 96 | ▶ | my ($self, $data) = @_; | ||||||||||||||||||
|
Subroutine
build_args: called CC=7 SCAR=21.8
Pod
undocumented
| |||||||||||||||||||||
| 61 | |||||||||||||||||||||
| 62 | 96 | my @time = gmtime time; | |||||||||||||||||||
| 63 | |||||||||||||||||||||
| 64 | 96 | ▶ | $data->{day} //= $time[3]; | ||||||||||||||||||
|
Condition33%1/3
$data->{"day"} //= $time[3]
MC/DC0%0/2
$data->{"day"} //= $time[3]
$data->{"day"}
$time[3]
Truth table33%1/3
A //= B
A= $data->{"day"}B= $time[3]
| |||||||||||||||||||||
| 65 | 96 | ▶ | $data->{hour} //= $time[2]; | ||||||||||||||||||
|
Condition66%2/3
$data->{"hour"} //= $time[2]
MC/DC0%0/2
$data->{"hour"} //= $time[2]
$data->{"hour"}
$time[2]
Truth table66%2/3
A //= B
A= $data->{"hour"}B= $time[2]
| |||||||||||||||||||||
| 66 | 96 | ▶ | $data->{minute} //= $time[1]; | ||||||||||||||||||
|
Condition66%2/3
$data->{"minute"} //= $time[1]
MC/DC0%0/2
$data->{"minute"} //= $time[1]
$data->{"minute"}
$time[1]
Truth table66%2/3
A //= B
A= $data->{"minute"}B= $time[1]
| |||||||||||||||||||||
| 67 | 96 | ▶ | $data->{month} //= $time[4] + 1; | ||||||||||||||||||
|
Condition33%1/3
$data->{"month"} //= $time[4] + 1
MC/DC0%0/2
$data->{"month"} //= $time[4] + 1
$data->{"month"}
$time[4] + 1
Truth table33%1/3
A //= B
A= $data->{"month"}B= $time[4] + 1
| |||||||||||||||||||||
| 68 | 96 | ▶ | $data->{second} //= $time[0]; | ||||||||||||||||||
|
Condition66%2/3
$data->{"second"} //= $time[0]
MC/DC0%0/2
$data->{"second"} //= $time[0]
$data->{"second"}
$time[0]
Truth table66%2/3
A //= B
A= $data->{"second"}B= $time[0]
| |||||||||||||||||||||
| 69 | 96 | ▶ | $data->{year} //= $time[5] + 1900; | ||||||||||||||||||
|
Condition33%1/3
$data->{"year"} //= $time[5] + 1900
MC/DC0%0/2
$data->{"year"} //= $time[5] + 1900
$data->{"year"}
$time[5] + 1900
Truth table33%1/3
A //= B
A= $data->{"year"}B= $time[5] + 1900
| |||||||||||||||||||||
| 70 | |||||||||||||||||||||
| 71 | 96 | return $data; | |||||||||||||||||||
| 72 | } | ||||||||||||||||||||
| 73 | |||||||||||||||||||||
| 74 | # METHODS | ||||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | sub add { | ||||||||||||||||||||
| 77 | 8 | ▶ | my ($self, $data) = @_; | ||||||||||||||||||
|
Subroutine
add: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||
| 78 | |||||||||||||||||||||
| 79 | 8 | for my $name (qw(days hours minutes months seconds years)) { | |||||||||||||||||||
| 80 | 48 | ▶ | if (my $code = $self->can("add_$name")) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 81 | 48 | $self->$code($data->{$name}); | |||||||||||||||||||
| 82 | } | ||||||||||||||||||||
| 83 | } | ||||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | 8 | return $self; | |||||||||||||||||||
| 86 | } | ||||||||||||||||||||
| 87 | |||||||||||||||||||||
| 88 | sub add_days { | ||||||||||||||||||||
| 89 | 11 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||
|
Subroutine
add_days: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 90 | |||||||||||||||||||||
| 91 | 11 | ▶ | $size //= 0; | ||||||||||||||||||
|
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 92 | |||||||||||||||||||||
| 93 | 11 | ▶ | $size = ($self->timeseconds->ONE_DAY * $size) if $size; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 94 | |||||||||||||||||||||
| 95 | 11 | return $self->reset($self->epoch + $size); | |||||||||||||||||||
| 96 | } | ||||||||||||||||||||
| 97 | |||||||||||||||||||||
| 98 | sub add_hours { | ||||||||||||||||||||
| 99 | 11 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||
|
Subroutine
add_hours: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 100 | |||||||||||||||||||||
| 101 | 11 | ▶ | $size //= 0; | ||||||||||||||||||
|
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 102 | |||||||||||||||||||||
| 103 | 11 | ▶ | $size = ($self->timeseconds->ONE_HOUR * $size) if $size; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 104 | |||||||||||||||||||||
| 105 | 11 | return $self->reset($self->epoch + $size); | |||||||||||||||||||
| 106 | } | ||||||||||||||||||||
| 107 | |||||||||||||||||||||
| 108 | sub add_hms { | ||||||||||||||||||||
| 109 | 3 | ▶ | my ($self, $h, $m, $s) = @_; | ||||||||||||||||||
|
Subroutine
add_hms: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||
| 110 | |||||||||||||||||||||
| 111 | 3 | my $data = {}; | |||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | 3 | ▶ | $data->{hours} = $h if defined $h; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 114 | 3 | ▶ | $data->{minutes} = $m if defined $m; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 115 | 3 | ▶ | $data->{seconds} = $s if defined $s; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 116 | |||||||||||||||||||||
| 117 | 3 | return $self->add($data); | |||||||||||||||||||
| 118 | } | ||||||||||||||||||||
| 119 | |||||||||||||||||||||
| 120 | sub add_mdy { | ||||||||||||||||||||
| 121 | 3 | ▶ | my ($self, $m, $d, $y) = @_; | ||||||||||||||||||
|
Subroutine
add_mdy: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||
| 122 | |||||||||||||||||||||
| 123 | 3 | my $data = {}; | |||||||||||||||||||
| 124 | |||||||||||||||||||||
| 125 | 3 | ▶ | $data->{days} = $d if defined $d; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 126 | 3 | ▶ | $data->{months} = $m if defined $m; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 127 | 3 | ▶ | $data->{years} = $y if defined $y; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 128 | |||||||||||||||||||||
| 129 | 3 | return $self->add($data); | |||||||||||||||||||
| 130 | } | ||||||||||||||||||||
| 131 | |||||||||||||||||||||
| 132 | sub add_minutes { | ||||||||||||||||||||
| 133 | 11 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||
|
Subroutine
add_minutes: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 134 | |||||||||||||||||||||
| 135 | 11 | ▶ | $size //= 0; | ||||||||||||||||||
|
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 136 | |||||||||||||||||||||
| 137 | 11 | ▶ | $size = ($self->timeseconds->ONE_MINUTE * $size) if $size; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 138 | |||||||||||||||||||||
| 139 | 11 | return $self->reset($self->epoch + $size); | |||||||||||||||||||
| 140 | } | ||||||||||||||||||||
| 141 | |||||||||||||||||||||
| 142 | sub add_months { | ||||||||||||||||||||
| 143 | 11 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||
|
Subroutine
add_months: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 144 | |||||||||||||||||||||
| 145 | 11 | ▶ | $size //= 0; | ||||||||||||||||||
|
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 146 | |||||||||||||||||||||
| 147 | 11 | ▶ | $size = ($self->timeseconds->ONE_MONTH * $size) if $size; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 148 | |||||||||||||||||||||
| 149 | 11 | return $self->reset($self->epoch + $size); | |||||||||||||||||||
| 150 | } | ||||||||||||||||||||
| 151 | |||||||||||||||||||||
| 152 | sub add_seconds { | ||||||||||||||||||||
| 153 | 11 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||
|
Subroutine
add_seconds: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 154 | |||||||||||||||||||||
| 155 | 11 | ▶ | $size //= 0; | ||||||||||||||||||
|
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 156 | |||||||||||||||||||||
| 157 | 11 | return $self->reset($self->epoch + $size); | |||||||||||||||||||
| 158 | } | ||||||||||||||||||||
| 159 | |||||||||||||||||||||
| 160 | sub add_years { | ||||||||||||||||||||
| 161 | 11 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||
|
Subroutine
add_years: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 162 | |||||||||||||||||||||
| 163 | 11 | ▶ | $size //= 0; | ||||||||||||||||||
|
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 164 | |||||||||||||||||||||
| 165 | 11 | ▶ | $size = ($self->timeseconds->ONE_YEAR * $size) if $size; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 166 | |||||||||||||||||||||
| 167 | 11 | return $self->reset($self->epoch + $size); | |||||||||||||||||||
| 168 | } | ||||||||||||||||||||
| 169 | |||||||||||||||||||||
| 170 | sub assertion { | ||||||||||||||||||||
| 171 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
assertion: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 172 | |||||||||||||||||||||
| 173 | 0 | my $assertion = $self->SUPER::assertion; | |||||||||||||||||||
| 174 | |||||||||||||||||||||
| 175 | $assertion->match('number')->format(sub{ | ||||||||||||||||||||
| 176 | 0 | ▶ | (ref $self || $self)->new($_) | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=2 SCAR=17.9
Condition0%0/3
ref $self || $self
MC/DC0%0/2
ref $self || $self
ref $self
$self
Truth table0%0/3
A || B
A= ref $selfB= $self
| |||||||||||||||||||||
| 177 | 0 | }); | |||||||||||||||||||
| 178 | |||||||||||||||||||||
| 179 | 0 | return $assertion; | |||||||||||||||||||
| 180 | } | ||||||||||||||||||||
| 181 | |||||||||||||||||||||
| 182 | sub epoch { | ||||||||||||||||||||
| 183 | 407 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
epoch: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 184 | |||||||||||||||||||||
| 185 | 407 | return $self->timepiece->epoch; | |||||||||||||||||||
| 186 | } | ||||||||||||||||||||
| 187 | |||||||||||||||||||||
| 188 | sub explain { | ||||||||||||||||||||
| 189 | 13 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
explain: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 190 | |||||||||||||||||||||
| 191 | 13 | return $self->epoch; | |||||||||||||||||||
| 192 | } | ||||||||||||||||||||
| 193 | |||||||||||||||||||||
| 194 | sub format { | ||||||||||||||||||||
| 195 | 4 | ▶ | my ($self, @args) = @_; | ||||||||||||||||||
|
Subroutine
format: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 196 | |||||||||||||||||||||
| 197 | 4 | return $self->timepiece->strftime(@args); | |||||||||||||||||||
| 198 | } | ||||||||||||||||||||
| 199 | |||||||||||||||||||||
| 200 | sub hms { | ||||||||||||||||||||
| 201 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
hms: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 202 | |||||||||||||||||||||
| 203 | 1 | return $self->timepiece->hms; | |||||||||||||||||||
| 204 | } | ||||||||||||||||||||
| 205 | |||||||||||||||||||||
| 206 | sub iso8601 { | ||||||||||||||||||||
| 207 | 7 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
iso8601: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 208 | |||||||||||||||||||||
| 209 | 7 | return $self->timepiece->datetime; | |||||||||||||||||||
| 210 | } | ||||||||||||||||||||
| 211 | |||||||||||||||||||||
| 212 | sub mdy { | ||||||||||||||||||||
| 213 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
mdy: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 214 | |||||||||||||||||||||
| 215 | 1 | return $self->timepiece->mdy; | |||||||||||||||||||
| 216 | } | ||||||||||||||||||||
| 217 | |||||||||||||||||||||
| 218 | sub parse { | ||||||||||||||||||||
| 219 | 1 | ▶ | my ($self, @args) = @_; | ||||||||||||||||||
|
Subroutine
parse: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 220 | |||||||||||||||||||||
| 221 | 1 | my $timepiece = $self->timepiece->strptime(@args); | |||||||||||||||||||
| 222 | |||||||||||||||||||||
| 223 | 1 | return $self->reset($timepiece->epoch); | |||||||||||||||||||
| 224 | } | ||||||||||||||||||||
| 225 | |||||||||||||||||||||
| 226 | sub reset { | ||||||||||||||||||||
| 227 | 134 | ▶ | my ($self, $time) = @_; | ||||||||||||||||||
|
Subroutine
reset: called CC=2 SCAR=7.0
Pod
documented
| |||||||||||||||||||||
| 228 | |||||||||||||||||||||
| 229 | 134 | ▶ | $time ||= time; | ||||||||||||||||||
|
Condition33%1/3
$time ||= time
MC/DC0%0/2
$time ||= time
$time
time
Truth table33%1/3
A ||= B
A= $timeB= time
| |||||||||||||||||||||
| 230 | |||||||||||||||||||||
| 231 | 134 | my @time = gmtime $time; | |||||||||||||||||||
| 232 | |||||||||||||||||||||
| 233 | 134 | $self->day($time[3]); | |||||||||||||||||||
| 234 | 134 | $self->hour($time[2]); | |||||||||||||||||||
| 235 | 134 | $self->minute($time[1]); | |||||||||||||||||||
| 236 | 134 | $self->month($time[4] + 1); | |||||||||||||||||||
| 237 | 134 | $self->second($time[0]); | |||||||||||||||||||
| 238 | 134 | $self->year($time[5] + 1900); | |||||||||||||||||||
| 239 | |||||||||||||||||||||
| 240 | 134 | return $self; | |||||||||||||||||||
| 241 | } | ||||||||||||||||||||
| 242 | |||||||||||||||||||||
| 243 | sub restart { | ||||||||||||||||||||
| 244 | 0 | ▶ | my ($self, $here) = @_; | ||||||||||||||||||
|
Subroutine
restart: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 245 | |||||||||||||||||||||
| 246 | 0 | my $timepiece = $self->timepiece->truncate(to => $here); | |||||||||||||||||||
| 247 | |||||||||||||||||||||
| 248 | 0 | return $self->reset($timepiece->epoch); | |||||||||||||||||||
| 249 | } | ||||||||||||||||||||
| 250 | |||||||||||||||||||||
| 251 | sub restart_day { | ||||||||||||||||||||
| 252 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
restart_day: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 253 | |||||||||||||||||||||
| 254 | 0 | return $self->restart('day'); | |||||||||||||||||||
| 255 | } | ||||||||||||||||||||
| 256 | |||||||||||||||||||||
| 257 | sub restart_hour { | ||||||||||||||||||||
| 258 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
restart_hour: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 259 | |||||||||||||||||||||
| 260 | 0 | return $self->restart('hour'); | |||||||||||||||||||
| 261 | } | ||||||||||||||||||||
| 262 | |||||||||||||||||||||
| 263 | sub restart_minute { | ||||||||||||||||||||
| 264 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
restart_minute: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 265 | |||||||||||||||||||||
| 266 | 0 | return $self->restart('minute'); | |||||||||||||||||||
| 267 | } | ||||||||||||||||||||
| 268 | |||||||||||||||||||||
| 269 | sub restart_month { | ||||||||||||||||||||
| 270 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
restart_month: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 271 | |||||||||||||||||||||
| 272 | 0 | return $self->restart('month'); | |||||||||||||||||||
| 273 | } | ||||||||||||||||||||
| 274 | |||||||||||||||||||||
| 275 | sub restart_quarter { | ||||||||||||||||||||
| 276 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
restart_quarter: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 277 | |||||||||||||||||||||
| 278 | 0 | return $self->restart('quarter'); | |||||||||||||||||||
| 279 | } | ||||||||||||||||||||
| 280 | |||||||||||||||||||||
| 281 | sub restart_second { | ||||||||||||||||||||
| 282 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
restart_second: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 283 | |||||||||||||||||||||
| 284 | 0 | return $self->restart('second'); | |||||||||||||||||||
| 285 | } | ||||||||||||||||||||
| 286 | |||||||||||||||||||||
| 287 | sub restart_year { | ||||||||||||||||||||
| 288 | 0 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
restart_year: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 289 | |||||||||||||||||||||
| 290 | 0 | return $self->restart('year'); | |||||||||||||||||||
| 291 | } | ||||||||||||||||||||
| 292 | |||||||||||||||||||||
| 293 | sub rfc822 { | ||||||||||||||||||||
| 294 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
rfc822: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 295 | |||||||||||||||||||||
| 296 | 1 | return $self->format('%a, %d %b %Y %H:%M:%S %z'); | |||||||||||||||||||
| 297 | } | ||||||||||||||||||||
| 298 | |||||||||||||||||||||
| 299 | sub rfc1123 { | ||||||||||||||||||||
| 300 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
rfc1123: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 301 | |||||||||||||||||||||
| 302 | 1 | return $self->format('%a, %d %b %Y %T GMT'); | |||||||||||||||||||
| 303 | } | ||||||||||||||||||||
| 304 | |||||||||||||||||||||
| 305 | sub rfc3339 { | ||||||||||||||||||||
| 306 | 6 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
rfc3339: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 307 | |||||||||||||||||||||
| 308 | 6 | return "@{[$self->iso8601]}Z"; | |||||||||||||||||||
| 309 | } | ||||||||||||||||||||
| 310 | |||||||||||||||||||||
| 311 | sub rfc7231 { | ||||||||||||||||||||
| 312 | 1 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
rfc7231: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 313 | |||||||||||||||||||||
| 314 | 1 | return $self->timepiece->strftime; | |||||||||||||||||||
| 315 | } | ||||||||||||||||||||
| 316 | |||||||||||||||||||||
| 317 | sub set { | ||||||||||||||||||||
| 318 | 9 | ▶ | my ($self, $data) = @_; | ||||||||||||||||||
|
Subroutine
set: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 319 | |||||||||||||||||||||
| 320 | 9 | for my $name (qw(day hour minute month second year)) { | |||||||||||||||||||
| 321 | 54 | ▶ | if (defined $data->{$name}) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 322 | 22 | $self->$name($data->{$name}); | |||||||||||||||||||
| 323 | } | ||||||||||||||||||||
| 324 | } | ||||||||||||||||||||
| 325 | |||||||||||||||||||||
| 326 | 9 | return $self; | |||||||||||||||||||
| 327 | } | ||||||||||||||||||||
| 328 | |||||||||||||||||||||
| 329 | sub set_hms { | ||||||||||||||||||||
| 330 | 3 | ▶ | my ($self, $h, $m, $s) = @_; | ||||||||||||||||||
|
Subroutine
set_hms: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||
| 331 | |||||||||||||||||||||
| 332 | 3 | my $data = {}; | |||||||||||||||||||
| 333 | |||||||||||||||||||||
| 334 | 3 | ▶ | $data->{hour} = $h if defined $h; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 335 | 3 | ▶ | $data->{minute} = $m if defined $m; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 336 | 3 | ▶ | $data->{second} = $s if defined $s; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 337 | |||||||||||||||||||||
| 338 | 3 | return $self->set($data); | |||||||||||||||||||
| 339 | } | ||||||||||||||||||||
| 340 | |||||||||||||||||||||
| 341 | sub set_mdy { | ||||||||||||||||||||
| 342 | 3 | ▶ | my ($self, $m, $d, $y) = @_; | ||||||||||||||||||
|
Subroutine
set_mdy: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||
| 343 | |||||||||||||||||||||
| 344 | 3 | my $data = {}; | |||||||||||||||||||
| 345 | |||||||||||||||||||||
| 346 | 3 | ▶ | $data->{day} = $d if defined $d; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 347 | 3 | ▶ | $data->{month} = $m if defined $m; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 348 | 3 | ▶ | $data->{year} = $y if defined $y; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 349 | |||||||||||||||||||||
| 350 | 3 | return $self->set($data); | |||||||||||||||||||
| 351 | } | ||||||||||||||||||||
| 352 | |||||||||||||||||||||
| 353 | sub string { | ||||||||||||||||||||
| 354 | 5 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||
| 355 | |||||||||||||||||||||
| 356 | 5 | return $self->rfc3339; | |||||||||||||||||||
| 357 | } | ||||||||||||||||||||
| 358 | |||||||||||||||||||||
| 359 | sub sub { | ||||||||||||||||||||
| 360 | 8 | ▶ | my ($self, $data) = @_; | ||||||||||||||||||
|
Subroutine
sub: called CC=3 SCAR=11.1
Pod
documented
| |||||||||||||||||||||
| 361 | |||||||||||||||||||||
| 362 | 8 | for my $name (qw(days hours minutes months seconds years)) { | |||||||||||||||||||
| 363 | 48 | ▶ | if (my $code = $self->can("sub_$name")) { | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 364 | 48 | $self->$code($data->{$name}); | |||||||||||||||||||
| 365 | } | ||||||||||||||||||||
| 366 | } | ||||||||||||||||||||
| 367 | |||||||||||||||||||||
| 368 | 8 | return $self; | |||||||||||||||||||
| 369 | } | ||||||||||||||||||||
| 370 | |||||||||||||||||||||
| 371 | sub sub_days { | ||||||||||||||||||||
| 372 | 11 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||
|
Subroutine
sub_days: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 373 | |||||||||||||||||||||
| 374 | 11 | ▶ | $size //= 0; | ||||||||||||||||||
|
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 375 | |||||||||||||||||||||
| 376 | 11 | ▶ | $size = ($self->timeseconds->ONE_DAY * $size) if $size; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 377 | |||||||||||||||||||||
| 378 | 11 | return $self->reset($self->epoch - $size); | |||||||||||||||||||
| 379 | } | ||||||||||||||||||||
| 380 | |||||||||||||||||||||
| 381 | sub sub_hours { | ||||||||||||||||||||
| 382 | 11 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||
|
Subroutine
sub_hours: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 383 | |||||||||||||||||||||
| 384 | 11 | ▶ | $size //= 0; | ||||||||||||||||||
|
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 385 | |||||||||||||||||||||
| 386 | 11 | ▶ | $size = ($self->timeseconds->ONE_HOUR * $size) if $size; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 387 | |||||||||||||||||||||
| 388 | 11 | return $self->reset($self->epoch - $size); | |||||||||||||||||||
| 389 | } | ||||||||||||||||||||
| 390 | |||||||||||||||||||||
| 391 | sub sub_hms { | ||||||||||||||||||||
| 392 | 3 | ▶ | my ($self, $h, $m, $s) = @_; | ||||||||||||||||||
|
Subroutine
sub_hms: called CC=4 SCAR=13.9
Pod
documented
| |||||||||||||||||||||
| 393 | |||||||||||||||||||||
| 394 | 3 | my $data = {}; | |||||||||||||||||||
| 395 | |||||||||||||||||||||
| 396 | 3 | ▶ | $data->{hours} = $h if defined $h; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 397 | 3 | ▶ | $data->{minutes} = $m if defined $m; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 398 | 3 | ▶ | $data->{seconds} = $s if defined $s; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 399 | |||||||||||||||||||||
| 400 | 3 | return $self->sub($data); | |||||||||||||||||||
| 401 | } | ||||||||||||||||||||
| 402 | |||||||||||||||||||||
| 403 | sub sub_mdy { | ||||||||||||||||||||
| 404 | 3 | ▶ | my ($self, $m, $d, $y) = @_; | ||||||||||||||||||
|
Subroutine
sub_mdy: called CC=4 SCAR=14.0
Pod
documented
| |||||||||||||||||||||
| 405 | |||||||||||||||||||||
| 406 | 3 | my $data = {}; | |||||||||||||||||||
| 407 | |||||||||||||||||||||
| 408 | 3 | ▶ | $data->{days} = $d if defined $d; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 409 | 3 | ▶ | $data->{months} = $m if defined $m; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 410 | 3 | ▶ | $data->{years} = $y if defined $y; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 411 | |||||||||||||||||||||
| 412 | 3 | return $self->sub($data); | |||||||||||||||||||
| 413 | } | ||||||||||||||||||||
| 414 | |||||||||||||||||||||
| 415 | sub sub_minutes { | ||||||||||||||||||||
| 416 | 11 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||
|
Subroutine
sub_minutes: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 417 | |||||||||||||||||||||
| 418 | 11 | ▶ | $size //= 0; | ||||||||||||||||||
|
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 419 | |||||||||||||||||||||
| 420 | 11 | ▶ | $size = ($self->timeseconds->ONE_MINUTE * $size) if $size; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 421 | |||||||||||||||||||||
| 422 | 11 | return $self->reset($self->epoch - $size); | |||||||||||||||||||
| 423 | } | ||||||||||||||||||||
| 424 | |||||||||||||||||||||
| 425 | sub sub_months { | ||||||||||||||||||||
| 426 | 11 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||
|
Subroutine
sub_months: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 427 | |||||||||||||||||||||
| 428 | 11 | ▶ | $size //= 0; | ||||||||||||||||||
|
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 429 | |||||||||||||||||||||
| 430 | 11 | ▶ | $size = ($self->timeseconds->ONE_MONTH * $size) if $size; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 431 | |||||||||||||||||||||
| 432 | 11 | return $self->reset($self->epoch - $size); | |||||||||||||||||||
| 433 | } | ||||||||||||||||||||
| 434 | |||||||||||||||||||||
| 435 | sub sub_seconds { | ||||||||||||||||||||
| 436 | 11 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||
|
Subroutine
sub_seconds: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||
| 437 | |||||||||||||||||||||
| 438 | 11 | ▶ | $size //= 0; | ||||||||||||||||||
|
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 439 | |||||||||||||||||||||
| 440 | 11 | return $self->reset($self->epoch - $size); | |||||||||||||||||||
| 441 | } | ||||||||||||||||||||
| 442 | |||||||||||||||||||||
| 443 | sub sub_years { | ||||||||||||||||||||
| 444 | 11 | ▶ | my ($self, $size) = @_; | ||||||||||||||||||
|
Subroutine
sub_years: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||
| 445 | |||||||||||||||||||||
| 446 | 11 | ▶ | $size //= 0; | ||||||||||||||||||
|
Condition100%2/2
$size //= 0
MC/DC100%1/1
$size //= 0
$size
Truth table100%2/2
A
A= $size
| |||||||||||||||||||||
| 447 | |||||||||||||||||||||
| 448 | 11 | ▶ | $size = ($self->timeseconds->ONE_YEAR * $size) if $size; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 449 | |||||||||||||||||||||
| 450 | 11 | return $self->reset($self->epoch - $size); | |||||||||||||||||||
| 451 | } | ||||||||||||||||||||
| 452 | |||||||||||||||||||||
| 453 | sub timelocal { | ||||||||||||||||||||
| 454 | 422 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
timelocal: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 455 | |||||||||||||||||||||
| 456 | 422 | require Time::Local; | |||||||||||||||||||
| 457 | |||||||||||||||||||||
| 458 | 422 | my $day = $self->day; | |||||||||||||||||||
| 459 | 422 | my $hour = $self->hour; | |||||||||||||||||||
| 460 | 422 | my $minute = $self->minute; | |||||||||||||||||||
| 461 | 422 | my $month = $self->month - 1; | |||||||||||||||||||
| 462 | 422 | my $second = $self->second; | |||||||||||||||||||
| 463 | 422 | my $year = $self->year; | |||||||||||||||||||
| 464 | |||||||||||||||||||||
| 465 | 422 | return Time::Local::timegm($second, $minute, $hour, $day, $month, $year); | |||||||||||||||||||
| 466 | } | ||||||||||||||||||||
| 467 | |||||||||||||||||||||
| 468 | sub timepiece { | ||||||||||||||||||||
| 469 | 422 | ▶ | my ($self) = @_; | ||||||||||||||||||
|
Subroutine
timepiece: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||
| 470 | |||||||||||||||||||||
| 471 | 422 | require Time::Piece; | |||||||||||||||||||
| 472 | |||||||||||||||||||||
| 473 | 422 | return Time::Piece->gmtime(0 + $self->timelocal); | |||||||||||||||||||
| 474 | } | ||||||||||||||||||||
| 475 | |||||||||||||||||||||
| 476 | sub timeseconds { | ||||||||||||||||||||
| 477 | 60 | ▶ | my ($self, $time) = @_; | ||||||||||||||||||
|
Subroutine
timeseconds: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||
| 478 | |||||||||||||||||||||
| 479 | 60 | require Time::Seconds; | |||||||||||||||||||
| 480 | |||||||||||||||||||||
| 481 | 60 | ▶ | return Time::Seconds->new($time // 0); | ||||||||||||||||||
|
Condition50%1/2
$time // 0
MC/DC0%0/1
$time // 0
$time
Truth table50%1/2
A
A= $time
| |||||||||||||||||||||
| 482 | } | ||||||||||||||||||||
| 483 | |||||||||||||||||||||
| 484 | 2 | 1; | |||||||||||||||||||
| 485 | |||||||||||||||||||||
| 486 | |||||||||||||||||||||
| 487 | |||||||||||||||||||||
| 488 | =head1 NAME | ||||||||||||||||||||
| 489 | |||||||||||||||||||||
| 490 | Venus::Date - Date Class | ||||||||||||||||||||
| 491 | |||||||||||||||||||||
| 492 | =cut | ||||||||||||||||||||
| 493 | |||||||||||||||||||||
| 494 | =head1 ABSTRACT | ||||||||||||||||||||
| 495 | |||||||||||||||||||||
| 496 | Date Class for Perl 5 | ||||||||||||||||||||
| 497 | |||||||||||||||||||||
| 498 | =cut | ||||||||||||||||||||
| 499 | |||||||||||||||||||||
| 500 | =head1 SYNOPSIS | ||||||||||||||||||||
| 501 | |||||||||||||||||||||
| 502 | package main; | ||||||||||||||||||||
| 503 | |||||||||||||||||||||
| 504 | use Venus::Date; | ||||||||||||||||||||
| 505 | |||||||||||||||||||||
| 506 | my $date = Venus::Date->new(570672000); | ||||||||||||||||||||
| 507 | |||||||||||||||||||||
| 508 | # $date->string; | ||||||||||||||||||||
| 509 | |||||||||||||||||||||
| 510 | # '1988-02-01T00:00:00Z' | ||||||||||||||||||||
| 511 | |||||||||||||||||||||
| 512 | =cut | ||||||||||||||||||||
| 513 | |||||||||||||||||||||
| 514 | =head1 DESCRIPTION | ||||||||||||||||||||
| 515 | |||||||||||||||||||||
| 516 | This package provides methods for formatting, parsing, and manipulating date | ||||||||||||||||||||
| 517 | and time data. | ||||||||||||||||||||
| 518 | |||||||||||||||||||||
| 519 | =cut | ||||||||||||||||||||
| 520 | |||||||||||||||||||||
| 521 | =head1 ATTRIBUTES | ||||||||||||||||||||
| 522 | |||||||||||||||||||||
| 523 | This package has the following attributes: | ||||||||||||||||||||
| 524 | |||||||||||||||||||||
| 525 | =cut | ||||||||||||||||||||
| 526 | |||||||||||||||||||||
| 527 | =head2 day | ||||||||||||||||||||
| 528 | |||||||||||||||||||||
| 529 | day(Int) | ||||||||||||||||||||
| 530 | |||||||||||||||||||||
| 531 | This attribute is read-write, accepts C<(Int)> values, and is optional. | ||||||||||||||||||||
| 532 | |||||||||||||||||||||
| 533 | =cut | ||||||||||||||||||||
| 534 | |||||||||||||||||||||
| 535 | =head2 month | ||||||||||||||||||||
| 536 | |||||||||||||||||||||
| 537 | month(Int) | ||||||||||||||||||||
| 538 | |||||||||||||||||||||
| 539 | This attribute is read-write, accepts C<(Int)> values, and is optional. | ||||||||||||||||||||
| 540 | |||||||||||||||||||||
| 541 | =cut | ||||||||||||||||||||
| 542 | |||||||||||||||||||||
| 543 | =head2 year | ||||||||||||||||||||
| 544 | |||||||||||||||||||||
| 545 | year(Int) | ||||||||||||||||||||
| 546 | |||||||||||||||||||||
| 547 | This attribute is read-write, accepts C<(Int)> values, and is optional. | ||||||||||||||||||||
| 548 | |||||||||||||||||||||
| 549 | =cut | ||||||||||||||||||||
| 550 | |||||||||||||||||||||
| 551 | =head2 hour | ||||||||||||||||||||
| 552 | |||||||||||||||||||||
| 553 | hour(Int) | ||||||||||||||||||||
| 554 | |||||||||||||||||||||
| 555 | This attribute is read-write, accepts C<(Int)> values, and is optional. | ||||||||||||||||||||
| 556 | |||||||||||||||||||||
| 557 | =cut | ||||||||||||||||||||
| 558 | |||||||||||||||||||||
| 559 | =head2 minute | ||||||||||||||||||||
| 560 | |||||||||||||||||||||
| 561 | minute(Int) | ||||||||||||||||||||
| 562 | |||||||||||||||||||||
| 563 | This attribute is read-write, accepts C<(Int)> values, and is optional. | ||||||||||||||||||||
| 564 | |||||||||||||||||||||
| 565 | =cut | ||||||||||||||||||||
| 566 | |||||||||||||||||||||
| 567 | =head2 second | ||||||||||||||||||||
| 568 | |||||||||||||||||||||
| 569 | second(Int) | ||||||||||||||||||||
| 570 | |||||||||||||||||||||
| 571 | This attribute is read-write, accepts C<(Int)> values, and is optional. | ||||||||||||||||||||
| 572 | |||||||||||||||||||||
| 573 | =cut | ||||||||||||||||||||
| 574 | |||||||||||||||||||||
| 575 | =head1 INHERITS | ||||||||||||||||||||
| 576 | |||||||||||||||||||||
| 577 | This package inherits behaviors from: | ||||||||||||||||||||
| 578 | |||||||||||||||||||||
| 579 | L<Venus::Kind::Utility> | ||||||||||||||||||||
| 580 | |||||||||||||||||||||
| 581 | =cut | ||||||||||||||||||||
| 582 | |||||||||||||||||||||
| 583 | =head1 INTEGRATES | ||||||||||||||||||||
| 584 | |||||||||||||||||||||
| 585 | This package integrates behaviors from: | ||||||||||||||||||||
| 586 | |||||||||||||||||||||
| 587 | L<Venus::Role::Buildable> | ||||||||||||||||||||
| 588 | |||||||||||||||||||||
| 589 | L<Venus::Role::Explainable> | ||||||||||||||||||||
| 590 | |||||||||||||||||||||
| 591 | =cut | ||||||||||||||||||||
| 592 | |||||||||||||||||||||
| 593 | =head1 METHODS | ||||||||||||||||||||
| 594 | |||||||||||||||||||||
| 595 | This package provides the following methods: | ||||||||||||||||||||
| 596 | |||||||||||||||||||||
| 597 | =cut | ||||||||||||||||||||
| 598 | |||||||||||||||||||||
| 599 | =head2 add | ||||||||||||||||||||
| 600 | |||||||||||||||||||||
| 601 | add(hashref $data) (Venus::Date) | ||||||||||||||||||||
| 602 | |||||||||||||||||||||
| 603 | The add method increments the date and time attributes specified. | ||||||||||||||||||||
| 604 | |||||||||||||||||||||
| 605 | I<Since C<0.01>> | ||||||||||||||||||||
| 606 | |||||||||||||||||||||
| 607 | =over 4 | ||||||||||||||||||||
| 608 | |||||||||||||||||||||
| 609 | =item add example 1 | ||||||||||||||||||||
| 610 | |||||||||||||||||||||
| 611 | # given: synopsis; | ||||||||||||||||||||
| 612 | |||||||||||||||||||||
| 613 | $date = $date->add({ | ||||||||||||||||||||
| 614 | days => 1, | ||||||||||||||||||||
| 615 | months => 1, | ||||||||||||||||||||
| 616 | years => 1, | ||||||||||||||||||||
| 617 | }); | ||||||||||||||||||||
| 618 | |||||||||||||||||||||
| 619 | # $date->string; # 1989-03-03T16:17:54Z | ||||||||||||||||||||
| 620 | |||||||||||||||||||||
| 621 | # $date->epoch; # 604945074 | ||||||||||||||||||||
| 622 | |||||||||||||||||||||
| 623 | |||||||||||||||||||||
| 624 | |||||||||||||||||||||
| 625 | |||||||||||||||||||||
| 626 | =back | ||||||||||||||||||||
| 627 | |||||||||||||||||||||
| 628 | =over 4 | ||||||||||||||||||||
| 629 | |||||||||||||||||||||
| 630 | =item add example 2 | ||||||||||||||||||||
| 631 | |||||||||||||||||||||
| 632 | # given: synopsis; | ||||||||||||||||||||
| 633 | |||||||||||||||||||||
| 634 | $date = $date->add({ | ||||||||||||||||||||
| 635 | hours => 1, | ||||||||||||||||||||
| 636 | minutes => 1, | ||||||||||||||||||||
| 637 | seconds => 1, | ||||||||||||||||||||
| 638 | }); | ||||||||||||||||||||
| 639 | |||||||||||||||||||||
| 640 | # $date->string; # 1988-02-01T01:01:01Z | ||||||||||||||||||||
| 641 | |||||||||||||||||||||
| 642 | # $date->epoch; # 570675661 | ||||||||||||||||||||
| 643 | |||||||||||||||||||||
| 644 | =back | ||||||||||||||||||||
| 645 | |||||||||||||||||||||
| 646 | =cut | ||||||||||||||||||||
| 647 | |||||||||||||||||||||
| 648 | =head2 add_days | ||||||||||||||||||||
| 649 | |||||||||||||||||||||
| 650 | add_days(number $days) (any) | ||||||||||||||||||||
| 651 | |||||||||||||||||||||
| 652 | The add_days method increments the C<day> attribute. | ||||||||||||||||||||
| 653 | |||||||||||||||||||||
| 654 | I<Since C<0.01>> | ||||||||||||||||||||
| 655 | |||||||||||||||||||||
| 656 | =over 4 | ||||||||||||||||||||
| 657 | |||||||||||||||||||||
| 658 | =item add_days example 1 | ||||||||||||||||||||
| 659 | |||||||||||||||||||||
| 660 | # given: synopsis; | ||||||||||||||||||||
| 661 | |||||||||||||||||||||
| 662 | $date = $date->add_days(1); | ||||||||||||||||||||
| 663 | |||||||||||||||||||||
| 664 | # $date->string; # 1988-02-02T00:00:00Z | ||||||||||||||||||||
| 665 | |||||||||||||||||||||
| 666 | # $date->epoch; # 570758400 | ||||||||||||||||||||
| 667 | |||||||||||||||||||||
| 668 | =back | ||||||||||||||||||||
| 669 | |||||||||||||||||||||
| 670 | =over 4 | ||||||||||||||||||||
| 671 | |||||||||||||||||||||
| 672 | =item add_days example 2 | ||||||||||||||||||||
| 673 | |||||||||||||||||||||
| 674 | # given: synopsis; | ||||||||||||||||||||
| 675 | |||||||||||||||||||||
| 676 | $date = $date->add_days(40); | ||||||||||||||||||||
| 677 | |||||||||||||||||||||
| 678 | # $date->string; # 1988-03-12T00:00:00Z | ||||||||||||||||||||
| 679 | |||||||||||||||||||||
| 680 | # $date->epoch; # 574128000 | ||||||||||||||||||||
| 681 | |||||||||||||||||||||
| 682 | =back | ||||||||||||||||||||
| 683 | |||||||||||||||||||||
| 684 | =over 4 | ||||||||||||||||||||
| 685 | |||||||||||||||||||||
| 686 | =item add_days example 3 | ||||||||||||||||||||
| 687 | |||||||||||||||||||||
| 688 | # given: synopsis; | ||||||||||||||||||||
| 689 | |||||||||||||||||||||
| 690 | $date = $date->add_days(-1); | ||||||||||||||||||||
| 691 | |||||||||||||||||||||
| 692 | # $date->string; # 1988-01-31T00:00:00Z | ||||||||||||||||||||
| 693 | |||||||||||||||||||||
| 694 | # $date->epoch; # 570585600 | ||||||||||||||||||||
| 695 | |||||||||||||||||||||
| 696 | =back | ||||||||||||||||||||
| 697 | |||||||||||||||||||||
| 698 | =cut | ||||||||||||||||||||
| 699 | |||||||||||||||||||||
| 700 | =head2 add_hms | ||||||||||||||||||||
| 701 | |||||||||||||||||||||
| 702 | add_hms(maybe[number] $hours, maybe[number] $minutes, maybe[number] $seconds) (Venus::Date) | ||||||||||||||||||||
| 703 | |||||||||||||||||||||
| 704 | The add_hms method increments the C<hour>, C<minute>, and C<second> attributes. | ||||||||||||||||||||
| 705 | |||||||||||||||||||||
| 706 | I<Since C<0.01>> | ||||||||||||||||||||
| 707 | |||||||||||||||||||||
| 708 | =over 4 | ||||||||||||||||||||
| 709 | |||||||||||||||||||||
| 710 | =item add_hms example 1 | ||||||||||||||||||||
| 711 | |||||||||||||||||||||
| 712 | # given: synopsis; | ||||||||||||||||||||
| 713 | |||||||||||||||||||||
| 714 | $date = $date->add_hms(1, 0, 0); | ||||||||||||||||||||
| 715 | |||||||||||||||||||||
| 716 | # $date->string; # 1988-02-01T01:00:00Z | ||||||||||||||||||||
| 717 | |||||||||||||||||||||
| 718 | # $date->epoch; # 570675600 | ||||||||||||||||||||
| 719 | |||||||||||||||||||||
| 720 | =back | ||||||||||||||||||||
| 721 | |||||||||||||||||||||
| 722 | =over 4 | ||||||||||||||||||||
| 723 | |||||||||||||||||||||
| 724 | =item add_hms example 2 | ||||||||||||||||||||
| 725 | |||||||||||||||||||||
| 726 | # given: synopsis; | ||||||||||||||||||||
| 727 | |||||||||||||||||||||
| 728 | $date = $date->add_hms(undef, 1, 1); | ||||||||||||||||||||
| 729 | |||||||||||||||||||||
| 730 | # $date->string; # 1988-02-01T00:01:01Z | ||||||||||||||||||||
| 731 | |||||||||||||||||||||
| 732 | # $date->epoch; # 570672061 | ||||||||||||||||||||
| 733 | |||||||||||||||||||||
| 734 | =back | ||||||||||||||||||||
| 735 | |||||||||||||||||||||
| 736 | =over 4 | ||||||||||||||||||||
| 737 | |||||||||||||||||||||
| 738 | =item add_hms example 3 | ||||||||||||||||||||
| 739 | |||||||||||||||||||||
| 740 | # given: synopsis; | ||||||||||||||||||||
| 741 | |||||||||||||||||||||
| 742 | $date = $date->add_hms(1, 1); | ||||||||||||||||||||
| 743 | |||||||||||||||||||||
| 744 | # $date->string; # 1988-02-01T01:01:00Z | ||||||||||||||||||||
| 745 | |||||||||||||||||||||
| 746 | # $date->epoch; # 570675660 | ||||||||||||||||||||
| 747 | |||||||||||||||||||||
| 748 | =back | ||||||||||||||||||||
| 749 | |||||||||||||||||||||
| 750 | =cut | ||||||||||||||||||||
| 751 | |||||||||||||||||||||
| 752 | =head2 add_hours | ||||||||||||||||||||
| 753 | |||||||||||||||||||||
| 754 | add_hours(number $hours) (any) | ||||||||||||||||||||
| 755 | |||||||||||||||||||||
| 756 | The add_hours method increments the C<hour> attribute. | ||||||||||||||||||||
| 757 | |||||||||||||||||||||
| 758 | I<Since C<0.01>> | ||||||||||||||||||||
| 759 | |||||||||||||||||||||
| 760 | =over 4 | ||||||||||||||||||||
| 761 | |||||||||||||||||||||
| 762 | =item add_hours example 1 | ||||||||||||||||||||
| 763 | |||||||||||||||||||||
| 764 | # given: synopsis; | ||||||||||||||||||||
| 765 | |||||||||||||||||||||
| 766 | $date = $date->add_hours(1); | ||||||||||||||||||||
| 767 | |||||||||||||||||||||
| 768 | # $date->string; # 1988-02-01T01:00:00Z | ||||||||||||||||||||
| 769 | |||||||||||||||||||||
| 770 | # $date->epoch; # 570675600 | ||||||||||||||||||||
| 771 | |||||||||||||||||||||
| 772 | =back | ||||||||||||||||||||
| 773 | |||||||||||||||||||||
| 774 | =over 4 | ||||||||||||||||||||
| 775 | |||||||||||||||||||||
| 776 | =item add_hours example 2 | ||||||||||||||||||||
| 777 | |||||||||||||||||||||
| 778 | # given: synopsis; | ||||||||||||||||||||
| 779 | |||||||||||||||||||||
| 780 | $date = $date->add_hours(25); | ||||||||||||||||||||
| 781 | |||||||||||||||||||||
| 782 | # $date->string; # 1988-02-02T01:00:00Z | ||||||||||||||||||||
| 783 | |||||||||||||||||||||
| 784 | # $date->epoch; # 570762000 | ||||||||||||||||||||
| 785 | |||||||||||||||||||||
| 786 | =back | ||||||||||||||||||||
| 787 | |||||||||||||||||||||
| 788 | =over 4 | ||||||||||||||||||||
| 789 | |||||||||||||||||||||
| 790 | =item add_hours example 3 | ||||||||||||||||||||
| 791 | |||||||||||||||||||||
| 792 | # given: synopsis; | ||||||||||||||||||||
| 793 | |||||||||||||||||||||
| 794 | $date = $date->add_hours(-1); | ||||||||||||||||||||
| 795 | |||||||||||||||||||||
| 796 | # $date->string; # 1988-01-31T23:00:00Z | ||||||||||||||||||||
| 797 | |||||||||||||||||||||
| 798 | # $date->epoch; # 570668400 | ||||||||||||||||||||
| 799 | |||||||||||||||||||||
| 800 | =back | ||||||||||||||||||||
| 801 | |||||||||||||||||||||
| 802 | =cut | ||||||||||||||||||||
| 803 | |||||||||||||||||||||
| 804 | =head2 add_mdy | ||||||||||||||||||||
| 805 | |||||||||||||||||||||
| 806 | add_mdy(maybe[number] $months, maybe[number] $days, maybe[number] $years) (Venus::Date) | ||||||||||||||||||||
| 807 | |||||||||||||||||||||
| 808 | The add_mdy method increments the C<month>, C<day>, and C<years> attributes. | ||||||||||||||||||||
| 809 | |||||||||||||||||||||
| 810 | I<Since C<0.01>> | ||||||||||||||||||||
| 811 | |||||||||||||||||||||
| 812 | =over 4 | ||||||||||||||||||||
| 813 | |||||||||||||||||||||
| 814 | =item add_mdy example 1 | ||||||||||||||||||||
| 815 | |||||||||||||||||||||
| 816 | # given: synopsis; | ||||||||||||||||||||
| 817 | |||||||||||||||||||||
| 818 | $date = $date->add_mdy(1, 0, 0); | ||||||||||||||||||||
| 819 | |||||||||||||||||||||
| 820 | # $date->string; # 1988-03-02T10:29:04Z | ||||||||||||||||||||
| 821 | |||||||||||||||||||||
| 822 | # $date->epoch; # 573301744 | ||||||||||||||||||||
| 823 | |||||||||||||||||||||
| 824 | =back | ||||||||||||||||||||
| 825 | |||||||||||||||||||||
| 826 | =over 4 | ||||||||||||||||||||
| 827 | |||||||||||||||||||||
| 828 | =item add_mdy example 2 | ||||||||||||||||||||
| 829 | |||||||||||||||||||||
| 830 | # given: synopsis; | ||||||||||||||||||||
| 831 | |||||||||||||||||||||
| 832 | $date = $date->add_mdy(undef, 1, 1); | ||||||||||||||||||||
| 833 | |||||||||||||||||||||
| 834 | # $date->string; # 1989-02-01T05:48:50Z | ||||||||||||||||||||
| 835 | |||||||||||||||||||||
| 836 | # $date->epoch; # 602315330 | ||||||||||||||||||||
| 837 | |||||||||||||||||||||
| 838 | =back | ||||||||||||||||||||
| 839 | |||||||||||||||||||||
| 840 | =over 4 | ||||||||||||||||||||
| 841 | |||||||||||||||||||||
| 842 | =item add_mdy example 3 | ||||||||||||||||||||
| 843 | |||||||||||||||||||||
| 844 | # given: synopsis; | ||||||||||||||||||||
| 845 | |||||||||||||||||||||
| 846 | $date = $date->add_mdy(1, 1); | ||||||||||||||||||||
| 847 | |||||||||||||||||||||
| 848 | # $date->string; # 1988-03-03T10:29:04Z | ||||||||||||||||||||
| 849 | |||||||||||||||||||||
| 850 | # $date->epoch; # 573388144 | ||||||||||||||||||||
| 851 | |||||||||||||||||||||
| 852 | =back | ||||||||||||||||||||
| 853 | |||||||||||||||||||||
| 854 | =cut | ||||||||||||||||||||
| 855 | |||||||||||||||||||||
| 856 | =head2 add_minutes | ||||||||||||||||||||
| 857 | |||||||||||||||||||||
| 858 | add_minutes(number $minutes) (Venus::Date) | ||||||||||||||||||||
| 859 | |||||||||||||||||||||
| 860 | The add_minutes method increments the C<minute> attribute. | ||||||||||||||||||||
| 861 | |||||||||||||||||||||
| 862 | I<Since C<0.01>> | ||||||||||||||||||||
| 863 | |||||||||||||||||||||
| 864 | =over 4 | ||||||||||||||||||||
| 865 | |||||||||||||||||||||
| 866 | =item add_minutes example 1 | ||||||||||||||||||||
| 867 | |||||||||||||||||||||
| 868 | # given: synopsis; | ||||||||||||||||||||
| 869 | |||||||||||||||||||||
| 870 | $date = $date->add_minutes(1); | ||||||||||||||||||||
| 871 | |||||||||||||||||||||
| 872 | # $date->string; # 1988-02-01T00:01:00Z | ||||||||||||||||||||
| 873 | |||||||||||||||||||||
| 874 | # $date->epoch; # 570672060 | ||||||||||||||||||||
| 875 | |||||||||||||||||||||
| 876 | =back | ||||||||||||||||||||
| 877 | |||||||||||||||||||||
| 878 | =over 4 | ||||||||||||||||||||
| 879 | |||||||||||||||||||||
| 880 | =item add_minutes example 2 | ||||||||||||||||||||
| 881 | |||||||||||||||||||||
| 882 | # given: synopsis; | ||||||||||||||||||||
| 883 | |||||||||||||||||||||
| 884 | $date = $date->add_minutes(61); | ||||||||||||||||||||
| 885 | |||||||||||||||||||||
| 886 | # $date->string; # 1988-02-01T01:01:00Z | ||||||||||||||||||||
| 887 | |||||||||||||||||||||
| 888 | # $date->epoch; # 570675660 | ||||||||||||||||||||
| 889 | |||||||||||||||||||||
| 890 | =back | ||||||||||||||||||||
| 891 | |||||||||||||||||||||
| 892 | =over 4 | ||||||||||||||||||||
| 893 | |||||||||||||||||||||
| 894 | =item add_minutes example 3 | ||||||||||||||||||||
| 895 | |||||||||||||||||||||
| 896 | # given: synopsis; | ||||||||||||||||||||
| 897 | |||||||||||||||||||||
| 898 | $date = $date->add_minutes(-1); | ||||||||||||||||||||
| 899 | |||||||||||||||||||||
| 900 | # $date->string; # 1988-01-31T23:59:00Z | ||||||||||||||||||||
| 901 | |||||||||||||||||||||
| 902 | # $date->epoch; # 570671940 | ||||||||||||||||||||
| 903 | |||||||||||||||||||||
| 904 | =back | ||||||||||||||||||||
| 905 | |||||||||||||||||||||
| 906 | =cut | ||||||||||||||||||||
| 907 | |||||||||||||||||||||
| 908 | =head2 add_months | ||||||||||||||||||||
| 909 | |||||||||||||||||||||
| 910 | add_months(number $months) (Venus::Date) | ||||||||||||||||||||
| 911 | |||||||||||||||||||||
| 912 | The add_months method increments the C<month> attribute. | ||||||||||||||||||||
| 913 | |||||||||||||||||||||
| 914 | I<Since C<0.01>> | ||||||||||||||||||||
| 915 | |||||||||||||||||||||
| 916 | =over 4 | ||||||||||||||||||||
| 917 | |||||||||||||||||||||
| 918 | =item add_months example 1 | ||||||||||||||||||||
| 919 | |||||||||||||||||||||
| 920 | # given: synopsis; | ||||||||||||||||||||
| 921 | |||||||||||||||||||||
| 922 | $date = $date->add_months(1); | ||||||||||||||||||||
| 923 | |||||||||||||||||||||
| 924 | # $date->string; # 1988-03-02T10:29:04Z | ||||||||||||||||||||
| 925 | |||||||||||||||||||||
| 926 | # $date->epoch; # 573301744 | ||||||||||||||||||||
| 927 | |||||||||||||||||||||
| 928 | =back | ||||||||||||||||||||
| 929 | |||||||||||||||||||||
| 930 | =over 4 | ||||||||||||||||||||
| 931 | |||||||||||||||||||||
| 932 | =item add_months example 2 | ||||||||||||||||||||
| 933 | |||||||||||||||||||||
| 934 | # given: synopsis; | ||||||||||||||||||||
| 935 | |||||||||||||||||||||
| 936 | $date = $date->add_months(13); | ||||||||||||||||||||
| 937 | |||||||||||||||||||||
| 938 | # $date->string; # 1989-03-02T16:17:52Z | ||||||||||||||||||||
| 939 | |||||||||||||||||||||
| 940 | # $date->epoch; # 604858672 | ||||||||||||||||||||
| 941 | |||||||||||||||||||||
| 942 | =back | ||||||||||||||||||||
| 943 | |||||||||||||||||||||
| 944 | =over 4 | ||||||||||||||||||||
| 945 | |||||||||||||||||||||
| 946 | =item add_months example 3 | ||||||||||||||||||||
| 947 | |||||||||||||||||||||
| 948 | # given: synopsis; | ||||||||||||||||||||
| 949 | |||||||||||||||||||||
| 950 | $date = $date->add_months(-1); | ||||||||||||||||||||
| 951 | |||||||||||||||||||||
| 952 | # $date->string; # 1988-01-01T13:30:56Z | ||||||||||||||||||||
| 953 | |||||||||||||||||||||
| 954 | # $date->epoch; # 568042256 | ||||||||||||||||||||
| 955 | |||||||||||||||||||||
| 956 | =back | ||||||||||||||||||||
| 957 | |||||||||||||||||||||
| 958 | =cut | ||||||||||||||||||||
| 959 | |||||||||||||||||||||
| 960 | =head2 add_seconds | ||||||||||||||||||||
| 961 | |||||||||||||||||||||
| 962 | add_seconds(number $seconds) (Venus::Date) | ||||||||||||||||||||
| 963 | |||||||||||||||||||||
| 964 | The add_seconds method increments the C<second> attribute. | ||||||||||||||||||||
| 965 | |||||||||||||||||||||
| 966 | I<Since C<0.01>> | ||||||||||||||||||||
| 967 | |||||||||||||||||||||
| 968 | =over 4 | ||||||||||||||||||||
| 969 | |||||||||||||||||||||
| 970 | =item add_seconds example 1 | ||||||||||||||||||||
| 971 | |||||||||||||||||||||
| 972 | # given: synopsis; | ||||||||||||||||||||
| 973 | |||||||||||||||||||||
| 974 | $date = $date->add_seconds(1); | ||||||||||||||||||||
| 975 | |||||||||||||||||||||
| 976 | # $date->string; # 1988-02-01T00:00:01Z | ||||||||||||||||||||
| 977 | |||||||||||||||||||||
| 978 | # $date->epoch; # 570672001 | ||||||||||||||||||||
| 979 | |||||||||||||||||||||
| 980 | =back | ||||||||||||||||||||
| 981 | |||||||||||||||||||||
| 982 | =over 4 | ||||||||||||||||||||
| 983 | |||||||||||||||||||||
| 984 | =item add_seconds example 2 | ||||||||||||||||||||
| 985 | |||||||||||||||||||||
| 986 | # given: synopsis; | ||||||||||||||||||||
| 987 | |||||||||||||||||||||
| 988 | $date = $date->add_seconds(61); | ||||||||||||||||||||
| 989 | |||||||||||||||||||||
| 990 | # $date->string; # 1988-02-01T00:01:01Z | ||||||||||||||||||||
| 991 | |||||||||||||||||||||
| 992 | # $date->epoch; # 570672061 | ||||||||||||||||||||
| 993 | |||||||||||||||||||||
| 994 | =back | ||||||||||||||||||||
| 995 | |||||||||||||||||||||
| 996 | =over 4 | ||||||||||||||||||||
| 997 | |||||||||||||||||||||
| 998 | =item add_seconds example 3 | ||||||||||||||||||||
| 999 | |||||||||||||||||||||
| 1000 | # given: synopsis; | ||||||||||||||||||||
| 1001 | |||||||||||||||||||||
| 1002 | $date = $date->add_seconds(-1); | ||||||||||||||||||||
| 1003 | |||||||||||||||||||||
| 1004 | # $date->string; # 1988-01-31T23:59:59Z | ||||||||||||||||||||
| 1005 | |||||||||||||||||||||
| 1006 | # $date->epoch; # 570671999 | ||||||||||||||||||||
| 1007 | |||||||||||||||||||||
| 1008 | =back | ||||||||||||||||||||
| 1009 | |||||||||||||||||||||
| 1010 | =cut | ||||||||||||||||||||
| 1011 | |||||||||||||||||||||
| 1012 | =head2 add_years | ||||||||||||||||||||
| 1013 | |||||||||||||||||||||
| 1014 | add_years(number $years) (Venus::Date) | ||||||||||||||||||||
| 1015 | |||||||||||||||||||||
| 1016 | The add_years method increments the C<year> attribute. | ||||||||||||||||||||
| 1017 | |||||||||||||||||||||
| 1018 | I<Since C<0.01>> | ||||||||||||||||||||
| 1019 | |||||||||||||||||||||
| 1020 | =over 4 | ||||||||||||||||||||
| 1021 | |||||||||||||||||||||
| 1022 | =item add_years example 1 | ||||||||||||||||||||
| 1023 | |||||||||||||||||||||
| 1024 | # given: synopsis; | ||||||||||||||||||||
| 1025 | |||||||||||||||||||||
| 1026 | $date = $date->add_years(1); | ||||||||||||||||||||
| 1027 | |||||||||||||||||||||
| 1028 | # $date->string; # 1989-01-31T05:48:50Z | ||||||||||||||||||||
| 1029 | |||||||||||||||||||||
| 1030 | # $date->epoch; # 602228930 | ||||||||||||||||||||
| 1031 | |||||||||||||||||||||
| 1032 | =back | ||||||||||||||||||||
| 1033 | |||||||||||||||||||||
| 1034 | =over 4 | ||||||||||||||||||||
| 1035 | |||||||||||||||||||||
| 1036 | =item add_years example 2 | ||||||||||||||||||||
| 1037 | |||||||||||||||||||||
| 1038 | # given: synopsis; | ||||||||||||||||||||
| 1039 | |||||||||||||||||||||
| 1040 | $date = $date->add_years(50); | ||||||||||||||||||||
| 1041 | |||||||||||||||||||||
| 1042 | # $date->string; # 2038-01-31T02:41:40Z | ||||||||||||||||||||
| 1043 | |||||||||||||||||||||
| 1044 | # $date->epoch; # 2148518500 | ||||||||||||||||||||
| 1045 | |||||||||||||||||||||
| 1046 | =back | ||||||||||||||||||||
| 1047 | |||||||||||||||||||||
| 1048 | =over 4 | ||||||||||||||||||||
| 1049 | |||||||||||||||||||||
| 1050 | =item add_years example 3 | ||||||||||||||||||||
| 1051 | |||||||||||||||||||||
| 1052 | # given: synopsis; | ||||||||||||||||||||
| 1053 | |||||||||||||||||||||
| 1054 | $date = $date->add_years(-1); | ||||||||||||||||||||
| 1055 | |||||||||||||||||||||
| 1056 | # $date->string; # 1987-01-31T18:11:10Z | ||||||||||||||||||||
| 1057 | |||||||||||||||||||||
| 1058 | # $date->epoch; # 539115070 | ||||||||||||||||||||
| 1059 | |||||||||||||||||||||
| 1060 | =back | ||||||||||||||||||||
| 1061 | |||||||||||||||||||||
| 1062 | =cut | ||||||||||||||||||||
| 1063 | |||||||||||||||||||||
| 1064 | =head2 epoch | ||||||||||||||||||||
| 1065 | |||||||||||||||||||||
| 1066 | epoch() (number) | ||||||||||||||||||||
| 1067 | |||||||||||||||||||||
| 1068 | The epoch method returns the epoch. | ||||||||||||||||||||
| 1069 | |||||||||||||||||||||
| 1070 | I<Since C<0.01>> | ||||||||||||||||||||
| 1071 | |||||||||||||||||||||
| 1072 | =over 4 | ||||||||||||||||||||
| 1073 | |||||||||||||||||||||
| 1074 | =item epoch example 1 | ||||||||||||||||||||
| 1075 | |||||||||||||||||||||
| 1076 | # given: synopsis; | ||||||||||||||||||||
| 1077 | |||||||||||||||||||||
| 1078 | my $epoch = $date->epoch; | ||||||||||||||||||||
| 1079 | |||||||||||||||||||||
| 1080 | # 570672000 | ||||||||||||||||||||
| 1081 | |||||||||||||||||||||
| 1082 | =back | ||||||||||||||||||||
| 1083 | |||||||||||||||||||||
| 1084 | =cut | ||||||||||||||||||||
| 1085 | |||||||||||||||||||||
| 1086 | =head2 explain | ||||||||||||||||||||
| 1087 | |||||||||||||||||||||
| 1088 | explain() (number) | ||||||||||||||||||||
| 1089 | |||||||||||||||||||||
| 1090 | The explain method returns the epoch and is used in stringification operations. | ||||||||||||||||||||
| 1091 | |||||||||||||||||||||
| 1092 | I<Since C<0.01>> | ||||||||||||||||||||
| 1093 | |||||||||||||||||||||
| 1094 | =over 4 | ||||||||||||||||||||
| 1095 | |||||||||||||||||||||
| 1096 | =item explain example 1 | ||||||||||||||||||||
| 1097 | |||||||||||||||||||||
| 1098 | # given: synopsis; | ||||||||||||||||||||
| 1099 | |||||||||||||||||||||
| 1100 | my $explain = $date->explain; | ||||||||||||||||||||
| 1101 | |||||||||||||||||||||
| 1102 | # 570672000 | ||||||||||||||||||||
| 1103 | |||||||||||||||||||||
| 1104 | =back | ||||||||||||||||||||
| 1105 | |||||||||||||||||||||
| 1106 | =cut | ||||||||||||||||||||
| 1107 | |||||||||||||||||||||
| 1108 | =head2 format | ||||||||||||||||||||
| 1109 | |||||||||||||||||||||
| 1110 | format(string $format) (string) | ||||||||||||||||||||
| 1111 | |||||||||||||||||||||
| 1112 | The format method returns the formatted date and time string. See | ||||||||||||||||||||
| 1113 | L<strftime|http://www.unix.com/man-page/FreeBSD/3/strftime/> for formatting | ||||||||||||||||||||
| 1114 | rules. | ||||||||||||||||||||
| 1115 | |||||||||||||||||||||
| 1116 | I<Since C<0.01>> | ||||||||||||||||||||
| 1117 | |||||||||||||||||||||
| 1118 | =over 4 | ||||||||||||||||||||
| 1119 | |||||||||||||||||||||
| 1120 | =item format example 1 | ||||||||||||||||||||
| 1121 | |||||||||||||||||||||
| 1122 | # given: synopsis; | ||||||||||||||||||||
| 1123 | |||||||||||||||||||||
| 1124 | my $format = $date->format('%A, %B %e, %Y'); | ||||||||||||||||||||
| 1125 | |||||||||||||||||||||
| 1126 | # Monday, February 1, 1988 | ||||||||||||||||||||
| 1127 | |||||||||||||||||||||
| 1128 | =back | ||||||||||||||||||||
| 1129 | |||||||||||||||||||||
| 1130 | =over 4 | ||||||||||||||||||||
| 1131 | |||||||||||||||||||||
| 1132 | =item format example 2 | ||||||||||||||||||||
| 1133 | |||||||||||||||||||||
| 1134 | # given: synopsis; | ||||||||||||||||||||
| 1135 | |||||||||||||||||||||
| 1136 | my $format = $date->format('%b %e %a'); | ||||||||||||||||||||
| 1137 | |||||||||||||||||||||
| 1138 | # Feb 1 Mon | ||||||||||||||||||||
| 1139 | |||||||||||||||||||||
| 1140 | =back | ||||||||||||||||||||
| 1141 | |||||||||||||||||||||
| 1142 | =cut | ||||||||||||||||||||
| 1143 | |||||||||||||||||||||
| 1144 | =head2 hms | ||||||||||||||||||||
| 1145 | |||||||||||||||||||||
| 1146 | hms() (string) | ||||||||||||||||||||
| 1147 | |||||||||||||||||||||
| 1148 | The hms method returns the time formatted as C<hh:mm:ss>. | ||||||||||||||||||||
| 1149 | |||||||||||||||||||||
| 1150 | I<Since C<0.01>> | ||||||||||||||||||||
| 1151 | |||||||||||||||||||||
| 1152 | =over 4 | ||||||||||||||||||||
| 1153 | |||||||||||||||||||||
| 1154 | =item hms example 1 | ||||||||||||||||||||
| 1155 | |||||||||||||||||||||
| 1156 | # given: synopsis; | ||||||||||||||||||||
| 1157 | |||||||||||||||||||||
| 1158 | my $hms = $date->hms; | ||||||||||||||||||||
| 1159 | |||||||||||||||||||||
| 1160 | # 00:00:00 | ||||||||||||||||||||
| 1161 | |||||||||||||||||||||
| 1162 | =back | ||||||||||||||||||||
| 1163 | |||||||||||||||||||||
| 1164 | =cut | ||||||||||||||||||||
| 1165 | |||||||||||||||||||||
| 1166 | =head2 iso8601 | ||||||||||||||||||||
| 1167 | |||||||||||||||||||||
| 1168 | iso8601() (string) | ||||||||||||||||||||
| 1169 | |||||||||||||||||||||
| 1170 | The iso8601 method returns the date and time formatted as an ISO8601 string. | ||||||||||||||||||||
| 1171 | |||||||||||||||||||||
| 1172 | I<Since C<0.01>> | ||||||||||||||||||||
| 1173 | |||||||||||||||||||||
| 1174 | =over 4 | ||||||||||||||||||||
| 1175 | |||||||||||||||||||||
| 1176 | =item iso8601 example 1 | ||||||||||||||||||||
| 1177 | |||||||||||||||||||||
| 1178 | # given: synopsis; | ||||||||||||||||||||
| 1179 | |||||||||||||||||||||
| 1180 | my $iso8601 = $date->iso8601; | ||||||||||||||||||||
| 1181 | |||||||||||||||||||||
| 1182 | # 1988-02-01T00:00:00 | ||||||||||||||||||||
| 1183 | |||||||||||||||||||||
| 1184 | =back | ||||||||||||||||||||
| 1185 | |||||||||||||||||||||
| 1186 | =cut | ||||||||||||||||||||
| 1187 | |||||||||||||||||||||
| 1188 | =head2 mdy | ||||||||||||||||||||
| 1189 | |||||||||||||||||||||
| 1190 | mdy() (string) | ||||||||||||||||||||
| 1191 | |||||||||||||||||||||
| 1192 | The mdy method returns the date formatted as C<mm-dd-yyyy>. | ||||||||||||||||||||
| 1193 | |||||||||||||||||||||
| 1194 | I<Since C<0.01>> | ||||||||||||||||||||
| 1195 | |||||||||||||||||||||
| 1196 | =over 4 | ||||||||||||||||||||
| 1197 | |||||||||||||||||||||
| 1198 | =item mdy example 1 | ||||||||||||||||||||
| 1199 | |||||||||||||||||||||
| 1200 | # given: synopsis; | ||||||||||||||||||||
| 1201 | |||||||||||||||||||||
| 1202 | my $mdy = $date->mdy; | ||||||||||||||||||||
| 1203 | |||||||||||||||||||||
| 1204 | # 02-01-1988 | ||||||||||||||||||||
| 1205 | |||||||||||||||||||||
| 1206 | =back | ||||||||||||||||||||
| 1207 | |||||||||||||||||||||
| 1208 | =cut | ||||||||||||||||||||
| 1209 | |||||||||||||||||||||
| 1210 | =head2 parse | ||||||||||||||||||||
| 1211 | |||||||||||||||||||||
| 1212 | parse(any @data) (Venus::Date) | ||||||||||||||||||||
| 1213 | |||||||||||||||||||||
| 1214 | The parse method resets and returns a date object based on the parsed time | ||||||||||||||||||||
| 1215 | provided. See L<strptime|http://www.unix.com/man-page/FreeBSD/3/strptime/> for | ||||||||||||||||||||
| 1216 | parsing rules. | ||||||||||||||||||||
| 1217 | |||||||||||||||||||||
| 1218 | I<Since C<0.01>> | ||||||||||||||||||||
| 1219 | |||||||||||||||||||||
| 1220 | =over 4 | ||||||||||||||||||||
| 1221 | |||||||||||||||||||||
| 1222 | =item parse example 1 | ||||||||||||||||||||
| 1223 | |||||||||||||||||||||
| 1224 | # given: synopsis; | ||||||||||||||||||||
| 1225 | |||||||||||||||||||||
| 1226 | $date = $date->parse('Monday, February 1, 1988', '%A, %B %e, %Y'); | ||||||||||||||||||||
| 1227 | |||||||||||||||||||||
| 1228 | # $date->string; # 1988-02-01T00:00:00Z | ||||||||||||||||||||
| 1229 | |||||||||||||||||||||
| 1230 | # $date->epoch; # 570672000 | ||||||||||||||||||||
| 1231 | |||||||||||||||||||||
| 1232 | =back | ||||||||||||||||||||
| 1233 | |||||||||||||||||||||
| 1234 | =cut | ||||||||||||||||||||
| 1235 | |||||||||||||||||||||
| 1236 | =head2 reset | ||||||||||||||||||||
| 1237 | |||||||||||||||||||||
| 1238 | reset(number $time) (Venus::Date) | ||||||||||||||||||||
| 1239 | |||||||||||||||||||||
| 1240 | The reset method resets all attributes to correspond with the epoch provided. | ||||||||||||||||||||
| 1241 | |||||||||||||||||||||
| 1242 | I<Since C<0.01>> | ||||||||||||||||||||
| 1243 | |||||||||||||||||||||
| 1244 | =over 4 | ||||||||||||||||||||
| 1245 | |||||||||||||||||||||
| 1246 | =item reset example 1 | ||||||||||||||||||||
| 1247 | |||||||||||||||||||||
| 1248 | # given: synopsis; | ||||||||||||||||||||
| 1249 | |||||||||||||||||||||
| 1250 | $date = $date->reset(631152000); | ||||||||||||||||||||
| 1251 | |||||||||||||||||||||
| 1252 | # $date->string; # 1990-01-01T00:00:00Z | ||||||||||||||||||||
| 1253 | |||||||||||||||||||||
| 1254 | # $date->epoch; # 631152000 | ||||||||||||||||||||
| 1255 | |||||||||||||||||||||
| 1256 | =back | ||||||||||||||||||||
| 1257 | |||||||||||||||||||||
| 1258 | =cut | ||||||||||||||||||||
| 1259 | |||||||||||||||||||||
| 1260 | =head2 restart | ||||||||||||||||||||
| 1261 | |||||||||||||||||||||
| 1262 | restart(string $interval) (Venus::Date) | ||||||||||||||||||||
| 1263 | |||||||||||||||||||||
| 1264 | The restart method truncates the date and time to the specified unit of time, | ||||||||||||||||||||
| 1265 | e.g. C<year>, C<quarter>, C<month>, C<day>, C<hour>, C<minute>, C<second>. | ||||||||||||||||||||
| 1266 | |||||||||||||||||||||
| 1267 | I<Since C<0.01>> | ||||||||||||||||||||
| 1268 | |||||||||||||||||||||
| 1269 | =over 4 | ||||||||||||||||||||
| 1270 | |||||||||||||||||||||
| 1271 | =item restart example 1 | ||||||||||||||||||||
| 1272 | |||||||||||||||||||||
| 1273 | # given: synopsis; | ||||||||||||||||||||
| 1274 | |||||||||||||||||||||
| 1275 | $date = $date->restart('year'); | ||||||||||||||||||||
| 1276 | |||||||||||||||||||||
| 1277 | # $date->string; # 1988-01-01T00:00:00Z | ||||||||||||||||||||
| 1278 | |||||||||||||||||||||
| 1279 | # $date->epoch; # 567993600 | ||||||||||||||||||||
| 1280 | |||||||||||||||||||||
| 1281 | =back | ||||||||||||||||||||
| 1282 | |||||||||||||||||||||
| 1283 | =over 4 | ||||||||||||||||||||
| 1284 | |||||||||||||||||||||
| 1285 | =item restart example 2 | ||||||||||||||||||||
| 1286 | |||||||||||||||||||||
| 1287 | # given: synopsis; | ||||||||||||||||||||
| 1288 | |||||||||||||||||||||
| 1289 | $date = $date->restart('quarter'); | ||||||||||||||||||||
| 1290 | |||||||||||||||||||||
| 1291 | # $date->string; # 1988-01-01T00:00:00Z | ||||||||||||||||||||
| 1292 | |||||||||||||||||||||
| 1293 | # $date->epoch; # 567993600 | ||||||||||||||||||||
| 1294 | |||||||||||||||||||||
| 1295 | =back | ||||||||||||||||||||
| 1296 | |||||||||||||||||||||
| 1297 | =over 4 | ||||||||||||||||||||
| 1298 | |||||||||||||||||||||
| 1299 | =item restart example 3 | ||||||||||||||||||||
| 1300 | |||||||||||||||||||||
| 1301 | # given: synopsis; | ||||||||||||||||||||
| 1302 | |||||||||||||||||||||
| 1303 | $date = $date->restart('month'); | ||||||||||||||||||||
| 1304 | |||||||||||||||||||||
| 1305 | # $date->string; # 1988-02-01T00:00:00Z | ||||||||||||||||||||
| 1306 | |||||||||||||||||||||
| 1307 | # $date->epoch; # 570672000 | ||||||||||||||||||||
| 1308 | |||||||||||||||||||||
| 1309 | =back | ||||||||||||||||||||
| 1310 | |||||||||||||||||||||
| 1311 | =cut | ||||||||||||||||||||
| 1312 | |||||||||||||||||||||
| 1313 | =head2 restart_day | ||||||||||||||||||||
| 1314 | |||||||||||||||||||||
| 1315 | restart_day() (Venus::Date) | ||||||||||||||||||||
| 1316 | |||||||||||||||||||||
| 1317 | The restart_day method truncates the date and time to the C<day>. | ||||||||||||||||||||
| 1318 | |||||||||||||||||||||
| 1319 | I<Since C<1.02>> | ||||||||||||||||||||
| 1320 | |||||||||||||||||||||
| 1321 | =over 4 | ||||||||||||||||||||
| 1322 | |||||||||||||||||||||
| 1323 | =item restart_day example 1 | ||||||||||||||||||||
| 1324 | |||||||||||||||||||||
| 1325 | # given: synopsis; | ||||||||||||||||||||
| 1326 | |||||||||||||||||||||
| 1327 | $date = $date->restart_day; | ||||||||||||||||||||
| 1328 | |||||||||||||||||||||
| 1329 | # $date->string; # 1988-02-01T00:00:00Z | ||||||||||||||||||||
| 1330 | |||||||||||||||||||||
| 1331 | # $date->epoch; # 570672000 | ||||||||||||||||||||
| 1332 | |||||||||||||||||||||
| 1333 | =back | ||||||||||||||||||||
| 1334 | |||||||||||||||||||||
| 1335 | =cut | ||||||||||||||||||||
| 1336 | |||||||||||||||||||||
| 1337 | =head2 restart_hour | ||||||||||||||||||||
| 1338 | |||||||||||||||||||||
| 1339 | restart_hour() (Venus::Date) | ||||||||||||||||||||
| 1340 | |||||||||||||||||||||
| 1341 | The restart_hour method truncates the date and time to the C<hour>. | ||||||||||||||||||||
| 1342 | |||||||||||||||||||||
| 1343 | I<Since C<1.02>> | ||||||||||||||||||||
| 1344 | |||||||||||||||||||||
| 1345 | =over 4 | ||||||||||||||||||||
| 1346 | |||||||||||||||||||||
| 1347 | =item restart_hour example 1 | ||||||||||||||||||||
| 1348 | |||||||||||||||||||||
| 1349 | # given: synopsis; | ||||||||||||||||||||
| 1350 | |||||||||||||||||||||
| 1351 | $date = $date->restart_hour; | ||||||||||||||||||||
| 1352 | |||||||||||||||||||||
| 1353 | # $date->string; # 1988-02-01T00:00:00Z | ||||||||||||||||||||
| 1354 | |||||||||||||||||||||
| 1355 | # $date->epoch; # 570672000 | ||||||||||||||||||||
| 1356 | |||||||||||||||||||||
| 1357 | =back | ||||||||||||||||||||
| 1358 | |||||||||||||||||||||
| 1359 | =cut | ||||||||||||||||||||
| 1360 | |||||||||||||||||||||
| 1361 | =head2 restart_minute | ||||||||||||||||||||
| 1362 | |||||||||||||||||||||
| 1363 | restart_minute() (Venus::Date) | ||||||||||||||||||||
| 1364 | |||||||||||||||||||||
| 1365 | The restart_minute method truncates the date and time to the C<minute>. | ||||||||||||||||||||
| 1366 | |||||||||||||||||||||
| 1367 | I<Since C<1.02>> | ||||||||||||||||||||
| 1368 | |||||||||||||||||||||
| 1369 | =over 4 | ||||||||||||||||||||
| 1370 | |||||||||||||||||||||
| 1371 | =item restart_minute example 1 | ||||||||||||||||||||
| 1372 | |||||||||||||||||||||
| 1373 | # given: synopsis; | ||||||||||||||||||||
| 1374 | |||||||||||||||||||||
| 1375 | $date = $date->restart_minute; | ||||||||||||||||||||
| 1376 | |||||||||||||||||||||
| 1377 | # $date->string; # 1988-02-01T00:00:00Z | ||||||||||||||||||||
| 1378 | |||||||||||||||||||||
| 1379 | # $date->epoch; # 570672000 | ||||||||||||||||||||
| 1380 | |||||||||||||||||||||
| 1381 | =back | ||||||||||||||||||||
| 1382 | |||||||||||||||||||||
| 1383 | =cut | ||||||||||||||||||||
| 1384 | |||||||||||||||||||||
| 1385 | =head2 restart_month | ||||||||||||||||||||
| 1386 | |||||||||||||||||||||
| 1387 | restart_month() (Venus::Date) | ||||||||||||||||||||
| 1388 | |||||||||||||||||||||
| 1389 | The restart_month method truncates the date and time to the C<month>. | ||||||||||||||||||||
| 1390 | |||||||||||||||||||||
| 1391 | I<Since C<1.02>> | ||||||||||||||||||||
| 1392 | |||||||||||||||||||||
| 1393 | =over 4 | ||||||||||||||||||||
| 1394 | |||||||||||||||||||||
| 1395 | =item restart_month example 1 | ||||||||||||||||||||
| 1396 | |||||||||||||||||||||
| 1397 | # given: synopsis; | ||||||||||||||||||||
| 1398 | |||||||||||||||||||||
| 1399 | $date = $date->restart_month; | ||||||||||||||||||||
| 1400 | |||||||||||||||||||||
| 1401 | # $date->string; # 1988-02-01T00:00:00Z | ||||||||||||||||||||
| 1402 | |||||||||||||||||||||
| 1403 | # $date->epoch; # 570672000 | ||||||||||||||||||||
| 1404 | |||||||||||||||||||||
| 1405 | =back | ||||||||||||||||||||
| 1406 | |||||||||||||||||||||
| 1407 | =cut | ||||||||||||||||||||
| 1408 | |||||||||||||||||||||
| 1409 | =head2 restart_quarter | ||||||||||||||||||||
| 1410 | |||||||||||||||||||||
| 1411 | restart_quarter() (Venus::Date) | ||||||||||||||||||||
| 1412 | |||||||||||||||||||||
| 1413 | The restart_quarter method truncates the date and time to the C<quarter>. | ||||||||||||||||||||
| 1414 | |||||||||||||||||||||
| 1415 | I<Since C<1.02>> | ||||||||||||||||||||
| 1416 | |||||||||||||||||||||
| 1417 | =over 4 | ||||||||||||||||||||
| 1418 | |||||||||||||||||||||
| 1419 | =item restart_quarter example 1 | ||||||||||||||||||||
| 1420 | |||||||||||||||||||||
| 1421 | # given: synopsis; | ||||||||||||||||||||
| 1422 | |||||||||||||||||||||
| 1423 | $date = $date->restart_quarter; | ||||||||||||||||||||
| 1424 | |||||||||||||||||||||
| 1425 | # $date->string; # 1988-01-01T00:00:00Z | ||||||||||||||||||||
| 1426 | |||||||||||||||||||||
| 1427 | # $date->epoch; # 567993600 | ||||||||||||||||||||
| 1428 | |||||||||||||||||||||
| 1429 | =back | ||||||||||||||||||||
| 1430 | |||||||||||||||||||||
| 1431 | =cut | ||||||||||||||||||||
| 1432 | |||||||||||||||||||||
| 1433 | =head2 restart_second | ||||||||||||||||||||
| 1434 | |||||||||||||||||||||
| 1435 | restart_second() (Venus::Date) | ||||||||||||||||||||
| 1436 | |||||||||||||||||||||
| 1437 | The restart_second method truncates the date and time to the C<second>. | ||||||||||||||||||||
| 1438 | |||||||||||||||||||||
| 1439 | I<Since C<1.02>> | ||||||||||||||||||||
| 1440 | |||||||||||||||||||||
| 1441 | =over 4 | ||||||||||||||||||||
| 1442 | |||||||||||||||||||||
| 1443 | =item restart_second example 1 | ||||||||||||||||||||
| 1444 | |||||||||||||||||||||
| 1445 | # given: synopsis; | ||||||||||||||||||||
| 1446 | |||||||||||||||||||||
| 1447 | $date = $date->restart_second; | ||||||||||||||||||||
| 1448 | |||||||||||||||||||||
| 1449 | # $date->string; # 1988-02-01T00:00:00Z | ||||||||||||||||||||
| 1450 | |||||||||||||||||||||
| 1451 | # $date->epoch; # 570672000 | ||||||||||||||||||||
| 1452 | |||||||||||||||||||||
| 1453 | =back | ||||||||||||||||||||
| 1454 | |||||||||||||||||||||
| 1455 | =cut | ||||||||||||||||||||
| 1456 | |||||||||||||||||||||
| 1457 | =head2 restart_year | ||||||||||||||||||||
| 1458 | |||||||||||||||||||||
| 1459 | restart_year() (Venus::Date) | ||||||||||||||||||||
| 1460 | |||||||||||||||||||||
| 1461 | The restart_year method truncates the date and time to the C<year>. | ||||||||||||||||||||
| 1462 | |||||||||||||||||||||
| 1463 | I<Since C<1.02>> | ||||||||||||||||||||
| 1464 | |||||||||||||||||||||
| 1465 | =over 4 | ||||||||||||||||||||
| 1466 | |||||||||||||||||||||
| 1467 | =item restart_year example 1 | ||||||||||||||||||||
| 1468 | |||||||||||||||||||||
| 1469 | # given: synopsis; | ||||||||||||||||||||
| 1470 | |||||||||||||||||||||
| 1471 | $date = $date->restart_year; | ||||||||||||||||||||
| 1472 | |||||||||||||||||||||
| 1473 | # $date->string; # 1988-01-01T00:00:00Z | ||||||||||||||||||||
| 1474 | |||||||||||||||||||||
| 1475 | # $date->epoch; # 567993600 | ||||||||||||||||||||
| 1476 | |||||||||||||||||||||
| 1477 | =back | ||||||||||||||||||||
| 1478 | |||||||||||||||||||||
| 1479 | =cut | ||||||||||||||||||||
| 1480 | |||||||||||||||||||||
| 1481 | =head2 rfc1123 | ||||||||||||||||||||
| 1482 | |||||||||||||||||||||
| 1483 | rfc1123() (string) | ||||||||||||||||||||
| 1484 | |||||||||||||||||||||
| 1485 | The rfc1123 method returns the date and time formatted as an RFC1123 string. | ||||||||||||||||||||
| 1486 | |||||||||||||||||||||
| 1487 | I<Since C<0.01>> | ||||||||||||||||||||
| 1488 | |||||||||||||||||||||
| 1489 | =over 4 | ||||||||||||||||||||
| 1490 | |||||||||||||||||||||
| 1491 | =item rfc1123 example 1 | ||||||||||||||||||||
| 1492 | |||||||||||||||||||||
| 1493 | # given: synopsis; | ||||||||||||||||||||
| 1494 | |||||||||||||||||||||
| 1495 | my $rfc1123 = $date->rfc1123; | ||||||||||||||||||||
| 1496 | |||||||||||||||||||||
| 1497 | # Mon, 01 Feb 1988 00:00:00 GMT | ||||||||||||||||||||
| 1498 | |||||||||||||||||||||
| 1499 | =back | ||||||||||||||||||||
| 1500 | |||||||||||||||||||||
| 1501 | =cut | ||||||||||||||||||||
| 1502 | |||||||||||||||||||||
| 1503 | =head2 rfc3339 | ||||||||||||||||||||
| 1504 | |||||||||||||||||||||
| 1505 | rfc3339() (string) | ||||||||||||||||||||
| 1506 | |||||||||||||||||||||
| 1507 | The rfc3339 method returns the date and time formatted as an RFC3339 string. | ||||||||||||||||||||
| 1508 | |||||||||||||||||||||
| 1509 | I<Since C<0.01>> | ||||||||||||||||||||
| 1510 | |||||||||||||||||||||
| 1511 | =over 4 | ||||||||||||||||||||
| 1512 | |||||||||||||||||||||
| 1513 | =item rfc3339 example 1 | ||||||||||||||||||||
| 1514 | |||||||||||||||||||||
| 1515 | # given: synopsis; | ||||||||||||||||||||
| 1516 | |||||||||||||||||||||
| 1517 | my $rfc3339 = $date->rfc3339; | ||||||||||||||||||||
| 1518 | |||||||||||||||||||||
| 1519 | # 1988-02-01T00:00:00Z | ||||||||||||||||||||
| 1520 | |||||||||||||||||||||
| 1521 | =back | ||||||||||||||||||||
| 1522 | |||||||||||||||||||||
| 1523 | =cut | ||||||||||||||||||||
| 1524 | |||||||||||||||||||||
| 1525 | =head2 rfc7231 | ||||||||||||||||||||
| 1526 | |||||||||||||||||||||
| 1527 | rfc7231() (string) | ||||||||||||||||||||
| 1528 | |||||||||||||||||||||
| 1529 | The rfc7231 method returns the date and time formatted as an RFC7231 string. | ||||||||||||||||||||
| 1530 | |||||||||||||||||||||
| 1531 | I<Since C<0.01>> | ||||||||||||||||||||
| 1532 | |||||||||||||||||||||
| 1533 | =over 4 | ||||||||||||||||||||
| 1534 | |||||||||||||||||||||
| 1535 | =item rfc7231 example 1 | ||||||||||||||||||||
| 1536 | |||||||||||||||||||||
| 1537 | # given: synopsis; | ||||||||||||||||||||
| 1538 | |||||||||||||||||||||
| 1539 | my $rfc7231 = $date->rfc7231; | ||||||||||||||||||||
| 1540 | |||||||||||||||||||||
| 1541 | # Mon, 01 Feb 1988 00:00:00 UTC | ||||||||||||||||||||
| 1542 | |||||||||||||||||||||
| 1543 | =back | ||||||||||||||||||||
| 1544 | |||||||||||||||||||||
| 1545 | =cut | ||||||||||||||||||||
| 1546 | |||||||||||||||||||||
| 1547 | =head2 rfc822 | ||||||||||||||||||||
| 1548 | |||||||||||||||||||||
| 1549 | rfc822() (string) | ||||||||||||||||||||
| 1550 | |||||||||||||||||||||
| 1551 | The rfc822 method returns the date and time formatted as an RFC822 string. | ||||||||||||||||||||
| 1552 | |||||||||||||||||||||
| 1553 | I<Since C<0.01>> | ||||||||||||||||||||
| 1554 | |||||||||||||||||||||
| 1555 | =over 4 | ||||||||||||||||||||
| 1556 | |||||||||||||||||||||
| 1557 | =item rfc822 example 1 | ||||||||||||||||||||
| 1558 | |||||||||||||||||||||
| 1559 | # given: synopsis; | ||||||||||||||||||||
| 1560 | |||||||||||||||||||||
| 1561 | my $rfc822 = $date->rfc822; | ||||||||||||||||||||
| 1562 | |||||||||||||||||||||
| 1563 | # Mon, 01 Feb 1988 00:00:00 +0000 | ||||||||||||||||||||
| 1564 | |||||||||||||||||||||
| 1565 | =back | ||||||||||||||||||||
| 1566 | |||||||||||||||||||||
| 1567 | =cut | ||||||||||||||||||||
| 1568 | |||||||||||||||||||||
| 1569 | =head2 set | ||||||||||||||||||||
| 1570 | |||||||||||||||||||||
| 1571 | set(hashref $data) (Venus::Date) | ||||||||||||||||||||
| 1572 | |||||||||||||||||||||
| 1573 | The set method sets the date and time attributes specified. | ||||||||||||||||||||
| 1574 | |||||||||||||||||||||
| 1575 | I<Since C<0.01>> | ||||||||||||||||||||
| 1576 | |||||||||||||||||||||
| 1577 | =over 4 | ||||||||||||||||||||
| 1578 | |||||||||||||||||||||
| 1579 | =item set example 1 | ||||||||||||||||||||
| 1580 | |||||||||||||||||||||
| 1581 | # given: synopsis; | ||||||||||||||||||||
| 1582 | |||||||||||||||||||||
| 1583 | $date = $date->set({ | ||||||||||||||||||||
| 1584 | day => 1, | ||||||||||||||||||||
| 1585 | month => 1, | ||||||||||||||||||||
| 1586 | year => 2000, | ||||||||||||||||||||
| 1587 | }); | ||||||||||||||||||||
| 1588 | |||||||||||||||||||||
| 1589 | # $date->string; # 2000-01-01T00:00:00Z | ||||||||||||||||||||
| 1590 | |||||||||||||||||||||
| 1591 | # $date->epoch; # 946684800 | ||||||||||||||||||||
| 1592 | |||||||||||||||||||||
| 1593 | =back | ||||||||||||||||||||
| 1594 | |||||||||||||||||||||
| 1595 | =over 4 | ||||||||||||||||||||
| 1596 | |||||||||||||||||||||
| 1597 | =item set example 2 | ||||||||||||||||||||
| 1598 | |||||||||||||||||||||
| 1599 | # given: synopsis; | ||||||||||||||||||||
| 1600 | |||||||||||||||||||||
| 1601 | $date = $date->set({ | ||||||||||||||||||||
| 1602 | day => 1, | ||||||||||||||||||||
| 1603 | month => 12, | ||||||||||||||||||||
| 1604 | }); | ||||||||||||||||||||
| 1605 | |||||||||||||||||||||
| 1606 | # $date->string; # 1988-12-01T00:00:00Z | ||||||||||||||||||||
| 1607 | |||||||||||||||||||||
| 1608 | # $date->epoch; # 596937600 | ||||||||||||||||||||
| 1609 | |||||||||||||||||||||
| 1610 | =back | ||||||||||||||||||||
| 1611 | |||||||||||||||||||||
| 1612 | =over 4 | ||||||||||||||||||||
| 1613 | |||||||||||||||||||||
| 1614 | =item set example 3 | ||||||||||||||||||||
| 1615 | |||||||||||||||||||||
| 1616 | # given: synopsis; | ||||||||||||||||||||
| 1617 | |||||||||||||||||||||
| 1618 | $date = $date->set({ | ||||||||||||||||||||
| 1619 | day => 1, | ||||||||||||||||||||
| 1620 | month => 12, | ||||||||||||||||||||
| 1621 | year => 1979, | ||||||||||||||||||||
| 1622 | }); | ||||||||||||||||||||
| 1623 | |||||||||||||||||||||
| 1624 | # $date->string; # 1979-12-01T00:00:00Z | ||||||||||||||||||||
| 1625 | |||||||||||||||||||||
| 1626 | # $date->epoch; # 312854400 | ||||||||||||||||||||
| 1627 | |||||||||||||||||||||
| 1628 | =back | ||||||||||||||||||||
| 1629 | |||||||||||||||||||||
| 1630 | =cut | ||||||||||||||||||||
| 1631 | |||||||||||||||||||||
| 1632 | =head2 set_hms | ||||||||||||||||||||
| 1633 | |||||||||||||||||||||
| 1634 | set_hms(maybe[number] $hours, maybe[number] $minutes, maybe[number] $seconds) (Venus::Date) | ||||||||||||||||||||
| 1635 | |||||||||||||||||||||
| 1636 | The set_hms method sets the C<hour>, C<minute>, and C<second> attributes. | ||||||||||||||||||||
| 1637 | |||||||||||||||||||||
| 1638 | I<Since C<0.01>> | ||||||||||||||||||||
| 1639 | |||||||||||||||||||||
| 1640 | =over 4 | ||||||||||||||||||||
| 1641 | |||||||||||||||||||||
| 1642 | =item set_hms example 1 | ||||||||||||||||||||
| 1643 | |||||||||||||||||||||
| 1644 | # given: synopsis; | ||||||||||||||||||||
| 1645 | |||||||||||||||||||||
| 1646 | $date = $date->set_hms(1, 0, 0); | ||||||||||||||||||||
| 1647 | |||||||||||||||||||||
| 1648 | # $date->string; # 1988-02-01T01:00:00Z | ||||||||||||||||||||
| 1649 | |||||||||||||||||||||
| 1650 | # $date->epoch; # 570675600 | ||||||||||||||||||||
| 1651 | |||||||||||||||||||||
| 1652 | =back | ||||||||||||||||||||
| 1653 | |||||||||||||||||||||
| 1654 | =over 4 | ||||||||||||||||||||
| 1655 | |||||||||||||||||||||
| 1656 | =item set_hms example 2 | ||||||||||||||||||||
| 1657 | |||||||||||||||||||||
| 1658 | # given: synopsis; | ||||||||||||||||||||
| 1659 | |||||||||||||||||||||
| 1660 | $date = $date->set_hms(undef, 30, 30); | ||||||||||||||||||||
| 1661 | |||||||||||||||||||||
| 1662 | # $date->string; # 1988-02-01T00:30:30Z | ||||||||||||||||||||
| 1663 | |||||||||||||||||||||
| 1664 | # $date->epoch; # 570673830 | ||||||||||||||||||||
| 1665 | |||||||||||||||||||||
| 1666 | =back | ||||||||||||||||||||
| 1667 | |||||||||||||||||||||
| 1668 | =over 4 | ||||||||||||||||||||
| 1669 | |||||||||||||||||||||
| 1670 | =item set_hms example 3 | ||||||||||||||||||||
| 1671 | |||||||||||||||||||||
| 1672 | # given: synopsis; | ||||||||||||||||||||
| 1673 | |||||||||||||||||||||
| 1674 | $date = $date->set_hms(0, 59, 59); | ||||||||||||||||||||
| 1675 | |||||||||||||||||||||
| 1676 | # $date->string; # 1988-02-01T00:59:59Z | ||||||||||||||||||||
| 1677 | |||||||||||||||||||||
| 1678 | # $date->epoch; # 570675599 | ||||||||||||||||||||
| 1679 | |||||||||||||||||||||
| 1680 | =back | ||||||||||||||||||||
| 1681 | |||||||||||||||||||||
| 1682 | =cut | ||||||||||||||||||||
| 1683 | |||||||||||||||||||||
| 1684 | =head2 set_mdy | ||||||||||||||||||||
| 1685 | |||||||||||||||||||||
| 1686 | set_mdy(maybe[number] $months, maybe[number] $days, maybe[number] $years) (Venus::Date) | ||||||||||||||||||||
| 1687 | |||||||||||||||||||||
| 1688 | The set_mdy method sets the C<month>, C<day>, and C<year> attributes. | ||||||||||||||||||||
| 1689 | |||||||||||||||||||||
| 1690 | |||||||||||||||||||||
| 1691 | |||||||||||||||||||||
| 1692 | |||||||||||||||||||||
| 1693 | I<Since C<0.01>> | ||||||||||||||||||||
| 1694 | |||||||||||||||||||||
| 1695 | =over 4 | ||||||||||||||||||||
| 1696 | |||||||||||||||||||||
| 1697 | =item set_mdy example 1 | ||||||||||||||||||||
| 1698 | |||||||||||||||||||||
| 1699 | # given: synopsis; | ||||||||||||||||||||
| 1700 | |||||||||||||||||||||
| 1701 | $date = $date->set_mdy(4, 30, 1990); | ||||||||||||||||||||
| 1702 | |||||||||||||||||||||
| 1703 | # $date->string; # 1990-04-30T00:00:00Z | ||||||||||||||||||||
| 1704 | |||||||||||||||||||||
| 1705 | # $date->epoch; # 641433600 | ||||||||||||||||||||
| 1706 | |||||||||||||||||||||
| 1707 | =back | ||||||||||||||||||||
| 1708 | |||||||||||||||||||||
| 1709 | =over 4 | ||||||||||||||||||||
| 1710 | |||||||||||||||||||||
| 1711 | =item set_mdy example 2 | ||||||||||||||||||||
| 1712 | |||||||||||||||||||||
| 1713 | # given: synopsis; | ||||||||||||||||||||
| 1714 | |||||||||||||||||||||
| 1715 | $date = $date->set_mdy(4, 30, undef); | ||||||||||||||||||||
| 1716 | |||||||||||||||||||||
| 1717 | # $date->string; # 1988-04-30T00:00:00Z | ||||||||||||||||||||
| 1718 | |||||||||||||||||||||
| 1719 | # $date->epoch; # 578361600 | ||||||||||||||||||||
| 1720 | |||||||||||||||||||||
| 1721 | =back | ||||||||||||||||||||
| 1722 | |||||||||||||||||||||
| 1723 | =over 4 | ||||||||||||||||||||
| 1724 | |||||||||||||||||||||
| 1725 | =item set_mdy example 3 | ||||||||||||||||||||
| 1726 | |||||||||||||||||||||
| 1727 | # given: synopsis; | ||||||||||||||||||||
| 1728 | |||||||||||||||||||||
| 1729 | $date = $date->set_mdy(undef, 15, undef); | ||||||||||||||||||||
| 1730 | |||||||||||||||||||||
| 1731 | # $date->string; # 1988-02-15T00:00:00Z | ||||||||||||||||||||
| 1732 | |||||||||||||||||||||
| 1733 | # $date->epoch; # 571881600 | ||||||||||||||||||||
| 1734 | |||||||||||||||||||||
| 1735 | =back | ||||||||||||||||||||
| 1736 | |||||||||||||||||||||
| 1737 | =cut | ||||||||||||||||||||
| 1738 | |||||||||||||||||||||
| 1739 | =head2 string | ||||||||||||||||||||
| 1740 | |||||||||||||||||||||
| 1741 | string() (string) | ||||||||||||||||||||
| 1742 | |||||||||||||||||||||
| 1743 | The string method returns a date and time string, and is an alias for | ||||||||||||||||||||
| 1744 | L</rfc3339>. | ||||||||||||||||||||
| 1745 | |||||||||||||||||||||
| 1746 | I<Since C<0.01>> | ||||||||||||||||||||
| 1747 | |||||||||||||||||||||
| 1748 | =over 4 | ||||||||||||||||||||
| 1749 | |||||||||||||||||||||
| 1750 | =item string example 1 | ||||||||||||||||||||
| 1751 | |||||||||||||||||||||
| 1752 | # given: synopsis; | ||||||||||||||||||||
| 1753 | |||||||||||||||||||||
| 1754 | my $string = $date->string; | ||||||||||||||||||||
| 1755 | |||||||||||||||||||||
| 1756 | # 1988-02-01T00:00:00Z | ||||||||||||||||||||
| 1757 | |||||||||||||||||||||
| 1758 | =back | ||||||||||||||||||||
| 1759 | |||||||||||||||||||||
| 1760 | =cut | ||||||||||||||||||||
| 1761 | |||||||||||||||||||||
| 1762 | =head2 sub | ||||||||||||||||||||
| 1763 | |||||||||||||||||||||
| 1764 | sub(hashref $data) (Venus::Date) | ||||||||||||||||||||
| 1765 | |||||||||||||||||||||
| 1766 | The sub method method decrements the date and time attributes specified. | ||||||||||||||||||||
| 1767 | |||||||||||||||||||||
| 1768 | I<Since C<0.01>> | ||||||||||||||||||||
| 1769 | |||||||||||||||||||||
| 1770 | =over 4 | ||||||||||||||||||||
| 1771 | |||||||||||||||||||||
| 1772 | =item sub example 1 | ||||||||||||||||||||
| 1773 | |||||||||||||||||||||
| 1774 | # given: synopsis; | ||||||||||||||||||||
| 1775 | |||||||||||||||||||||
| 1776 | $date = $date->sub({ | ||||||||||||||||||||
| 1777 | days => 1, | ||||||||||||||||||||
| 1778 | months => 1, | ||||||||||||||||||||
| 1779 | years => 1, | ||||||||||||||||||||
| 1780 | }); | ||||||||||||||||||||
| 1781 | |||||||||||||||||||||
| 1782 | # $date->string; # 1986-12-31T07:42:06Z | ||||||||||||||||||||
| 1783 | |||||||||||||||||||||
| 1784 | # $date->epoch; # 536398926 | ||||||||||||||||||||
| 1785 | |||||||||||||||||||||
| 1786 | =back | ||||||||||||||||||||
| 1787 | |||||||||||||||||||||
| 1788 | =over 4 | ||||||||||||||||||||
| 1789 | |||||||||||||||||||||
| 1790 | =item sub example 2 | ||||||||||||||||||||
| 1791 | |||||||||||||||||||||
| 1792 | # given: synopsis; | ||||||||||||||||||||
| 1793 | |||||||||||||||||||||
| 1794 | $date = $date->sub({ | ||||||||||||||||||||
| 1795 | hours => 1, | ||||||||||||||||||||
| 1796 | minutes => 1, | ||||||||||||||||||||
| 1797 | seconds => 1, | ||||||||||||||||||||
| 1798 | }); | ||||||||||||||||||||
| 1799 | |||||||||||||||||||||
| 1800 | # $date->string; # 1988-01-31T22:58:59Z | ||||||||||||||||||||
| 1801 | |||||||||||||||||||||
| 1802 | # $date->epoch; # 570668339 | ||||||||||||||||||||
| 1803 | |||||||||||||||||||||
| 1804 | =back | ||||||||||||||||||||
| 1805 | |||||||||||||||||||||
| 1806 | =cut | ||||||||||||||||||||
| 1807 | |||||||||||||||||||||
| 1808 | =head2 sub_days | ||||||||||||||||||||
| 1809 | |||||||||||||||||||||
| 1810 | sub_days(number $days) (Venus::Date) | ||||||||||||||||||||
| 1811 | |||||||||||||||||||||
| 1812 | The sub_days method decrements the C<day> attribute. | ||||||||||||||||||||
| 1813 | |||||||||||||||||||||
| 1814 | I<Since C<0.01>> | ||||||||||||||||||||
| 1815 | |||||||||||||||||||||
| 1816 | =over 4 | ||||||||||||||||||||
| 1817 | |||||||||||||||||||||
| 1818 | =item sub_days example 1 | ||||||||||||||||||||
| 1819 | |||||||||||||||||||||
| 1820 | # given: synopsis; | ||||||||||||||||||||
| 1821 | |||||||||||||||||||||
| 1822 | $date = $date->sub_days(1); | ||||||||||||||||||||
| 1823 | |||||||||||||||||||||
| 1824 | # $date->string; # 1988-01-31T00:00:00Z | ||||||||||||||||||||
| 1825 | |||||||||||||||||||||
| 1826 | # $date->epoch; # 570585600 | ||||||||||||||||||||
| 1827 | |||||||||||||||||||||
| 1828 | =back | ||||||||||||||||||||
| 1829 | |||||||||||||||||||||
| 1830 | =over 4 | ||||||||||||||||||||
| 1831 | |||||||||||||||||||||
| 1832 | =item sub_days example 2 | ||||||||||||||||||||
| 1833 | |||||||||||||||||||||
| 1834 | # given: synopsis; | ||||||||||||||||||||
| 1835 | |||||||||||||||||||||
| 1836 | $date = $date->sub_days(32); | ||||||||||||||||||||
| 1837 | |||||||||||||||||||||
| 1838 | # $date->string; # 1987-12-31T00:00:00Z | ||||||||||||||||||||
| 1839 | |||||||||||||||||||||
| 1840 | # $date->epoch; # 567907200 | ||||||||||||||||||||
| 1841 | |||||||||||||||||||||
| 1842 | =back | ||||||||||||||||||||
| 1843 | |||||||||||||||||||||
| 1844 | =over 4 | ||||||||||||||||||||
| 1845 | |||||||||||||||||||||
| 1846 | =item sub_days example 3 | ||||||||||||||||||||
| 1847 | |||||||||||||||||||||
| 1848 | # given: synopsis; | ||||||||||||||||||||
| 1849 | |||||||||||||||||||||
| 1850 | $date = $date->sub_days(-1); | ||||||||||||||||||||
| 1851 | |||||||||||||||||||||
| 1852 | # $date->string; # 1988-02-02T00:00:00Z | ||||||||||||||||||||
| 1853 | |||||||||||||||||||||
| 1854 | # $date->epoch; # 570758400 | ||||||||||||||||||||
| 1855 | |||||||||||||||||||||
| 1856 | =back | ||||||||||||||||||||
| 1857 | |||||||||||||||||||||
| 1858 | =cut | ||||||||||||||||||||
| 1859 | |||||||||||||||||||||
| 1860 | =head2 sub_hms | ||||||||||||||||||||
| 1861 | |||||||||||||||||||||
| 1862 | sub_hms(maybe[number] $hours, maybe[number] $minutes, maybe[number] $seconds) (Venus::Date) | ||||||||||||||||||||
| 1863 | |||||||||||||||||||||
| 1864 | The sub_hms method decrements the C<hour>, C<minute>, and C<second> attributes. | ||||||||||||||||||||
| 1865 | |||||||||||||||||||||
| 1866 | I<Since C<0.01>> | ||||||||||||||||||||
| 1867 | |||||||||||||||||||||
| 1868 | =over 4 | ||||||||||||||||||||
| 1869 | |||||||||||||||||||||
| 1870 | =item sub_hms example 1 | ||||||||||||||||||||
| 1871 | |||||||||||||||||||||
| 1872 | # given: synopsis; | ||||||||||||||||||||
| 1873 | |||||||||||||||||||||
| 1874 | $date = $date->sub_hms(1, 0, 0); | ||||||||||||||||||||
| 1875 | |||||||||||||||||||||
| 1876 | # $date->string; # 1988-01-31T23:00:00Z | ||||||||||||||||||||
| 1877 | |||||||||||||||||||||
| 1878 | # $date->epoch; # 570668400 | ||||||||||||||||||||
| 1879 | |||||||||||||||||||||
| 1880 | =back | ||||||||||||||||||||
| 1881 | |||||||||||||||||||||
| 1882 | =over 4 | ||||||||||||||||||||
| 1883 | |||||||||||||||||||||
| 1884 | =item sub_hms example 2 | ||||||||||||||||||||
| 1885 | |||||||||||||||||||||
| 1886 | # given: synopsis; | ||||||||||||||||||||
| 1887 | |||||||||||||||||||||
| 1888 | $date = $date->sub_hms(undef, 1, 1); | ||||||||||||||||||||
| 1889 | |||||||||||||||||||||
| 1890 | # $date->string; # 1988-01-31T23:58:59Z | ||||||||||||||||||||
| 1891 | |||||||||||||||||||||
| 1892 | # $date->epoch; # 570671939 | ||||||||||||||||||||
| 1893 | |||||||||||||||||||||
| 1894 | =back | ||||||||||||||||||||
| 1895 | |||||||||||||||||||||
| 1896 | =over 4 | ||||||||||||||||||||
| 1897 | |||||||||||||||||||||
| 1898 | =item sub_hms example 3 | ||||||||||||||||||||
| 1899 | |||||||||||||||||||||
| 1900 | # given: synopsis; | ||||||||||||||||||||
| 1901 | |||||||||||||||||||||
| 1902 | $date = $date->sub_hms(1, 1); | ||||||||||||||||||||
| 1903 | |||||||||||||||||||||
| 1904 | # $date->string; # 1988-01-31T22:59:00Z | ||||||||||||||||||||
| 1905 | |||||||||||||||||||||
| 1906 | # $date->epoch; # 570668340 | ||||||||||||||||||||
| 1907 | |||||||||||||||||||||
| 1908 | =back | ||||||||||||||||||||
| 1909 | |||||||||||||||||||||
| 1910 | =cut | ||||||||||||||||||||
| 1911 | |||||||||||||||||||||
| 1912 | =head2 sub_hours | ||||||||||||||||||||
| 1913 | |||||||||||||||||||||
| 1914 | sub_hours(number $hours) (any) | ||||||||||||||||||||
| 1915 | |||||||||||||||||||||
| 1916 | The sub_hours method decrements the C<hour> attribute. | ||||||||||||||||||||
| 1917 | |||||||||||||||||||||
| 1918 | I<Since C<0.01>> | ||||||||||||||||||||
| 1919 | |||||||||||||||||||||
| 1920 | =over 4 | ||||||||||||||||||||
| 1921 | |||||||||||||||||||||
| 1922 | =item sub_hours example 1 | ||||||||||||||||||||
| 1923 | |||||||||||||||||||||
| 1924 | # given: synopsis; | ||||||||||||||||||||
| 1925 | |||||||||||||||||||||
| 1926 | $date = $date->sub_hours(1); | ||||||||||||||||||||
| 1927 | |||||||||||||||||||||
| 1928 | # $date->string; # 1988-01-31T23:00:00Z | ||||||||||||||||||||
| 1929 | |||||||||||||||||||||
| 1930 | # $date->epoch; # 570668400 | ||||||||||||||||||||
| 1931 | |||||||||||||||||||||
| 1932 | =back | ||||||||||||||||||||
| 1933 | |||||||||||||||||||||
| 1934 | =over 4 | ||||||||||||||||||||
| 1935 | |||||||||||||||||||||
| 1936 | =item sub_hours example 2 | ||||||||||||||||||||
| 1937 | |||||||||||||||||||||
| 1938 | # given: synopsis; | ||||||||||||||||||||
| 1939 | |||||||||||||||||||||
| 1940 | $date = $date->sub_hours(25); | ||||||||||||||||||||
| 1941 | |||||||||||||||||||||
| 1942 | # $date->string; # 1988-01-30T23:00:00Z | ||||||||||||||||||||
| 1943 | |||||||||||||||||||||
| 1944 | # $date->epoch; # 570582000 | ||||||||||||||||||||
| 1945 | |||||||||||||||||||||
| 1946 | =back | ||||||||||||||||||||
| 1947 | |||||||||||||||||||||
| 1948 | =over 4 | ||||||||||||||||||||
| 1949 | |||||||||||||||||||||
| 1950 | =item sub_hours example 3 | ||||||||||||||||||||
| 1951 | |||||||||||||||||||||
| 1952 | # given: synopsis; | ||||||||||||||||||||
| 1953 | |||||||||||||||||||||
| 1954 | $date = $date->sub_hours(-1); | ||||||||||||||||||||
| 1955 | |||||||||||||||||||||
| 1956 | # $date->string; # 1988-02-01T01:00:00Z | ||||||||||||||||||||
| 1957 | |||||||||||||||||||||
| 1958 | # $date->epoch; # 570675600 | ||||||||||||||||||||
| 1959 | |||||||||||||||||||||
| 1960 | =back | ||||||||||||||||||||
| 1961 | |||||||||||||||||||||
| 1962 | =cut | ||||||||||||||||||||
| 1963 | |||||||||||||||||||||
| 1964 | =head2 sub_mdy | ||||||||||||||||||||
| 1965 | |||||||||||||||||||||
| 1966 | sub_mdy(maybe[number] $months, maybe[number] $days, maybe[number] $years) (Venus::Date) | ||||||||||||||||||||
| 1967 | |||||||||||||||||||||
| 1968 | The sub_mdy method decrements the C<month>, C<day>, and C<year> attributes. | ||||||||||||||||||||
| 1969 | |||||||||||||||||||||
| 1970 | I<Since C<0.01>> | ||||||||||||||||||||
| 1971 | |||||||||||||||||||||
| 1972 | =over 4 | ||||||||||||||||||||
| 1973 | |||||||||||||||||||||
| 1974 | =item sub_mdy example 1 | ||||||||||||||||||||
| 1975 | |||||||||||||||||||||
| 1976 | # given: synopsis; | ||||||||||||||||||||
| 1977 | |||||||||||||||||||||
| 1978 | $date = $date->sub_mdy(1, 1, 1); | ||||||||||||||||||||
| 1979 | |||||||||||||||||||||
| 1980 | # $date->string; # 1986-12-31T07:42:06Z | ||||||||||||||||||||
| 1981 | |||||||||||||||||||||
| 1982 | # $date->epoch; # 536398926 | ||||||||||||||||||||
| 1983 | |||||||||||||||||||||
| 1984 | =back | ||||||||||||||||||||
| 1985 | |||||||||||||||||||||
| 1986 | =over 4 | ||||||||||||||||||||
| 1987 | |||||||||||||||||||||
| 1988 | =item sub_mdy example 2 | ||||||||||||||||||||
| 1989 | |||||||||||||||||||||
| 1990 | # given: synopsis; | ||||||||||||||||||||
| 1991 | |||||||||||||||||||||
| 1992 | $date = $date->sub_mdy(1, 1, undef); | ||||||||||||||||||||
| 1993 | |||||||||||||||||||||
| 1994 | # $date->string; # 1987-12-31T13:30:56Z | ||||||||||||||||||||
| 1995 | |||||||||||||||||||||
| 1996 | # $date->epoch; # 567955856 | ||||||||||||||||||||
| 1997 | |||||||||||||||||||||
| 1998 | =back | ||||||||||||||||||||
| 1999 | |||||||||||||||||||||
| 2000 | =over 4 | ||||||||||||||||||||
| 2001 | |||||||||||||||||||||
| 2002 | =item sub_mdy example 3 | ||||||||||||||||||||
| 2003 | |||||||||||||||||||||
| 2004 | # given: synopsis; | ||||||||||||||||||||
| 2005 | |||||||||||||||||||||
| 2006 | $date = $date->sub_mdy(1, 1); | ||||||||||||||||||||
| 2007 | |||||||||||||||||||||
| 2008 | # $date->string; # 1987-12-31T13:30:56Z | ||||||||||||||||||||
| 2009 | |||||||||||||||||||||
| 2010 | # $date->epoch; # 567955856 | ||||||||||||||||||||
| 2011 | |||||||||||||||||||||
| 2012 | =back | ||||||||||||||||||||
| 2013 | |||||||||||||||||||||
| 2014 | =cut | ||||||||||||||||||||
| 2015 | |||||||||||||||||||||
| 2016 | =head2 sub_minutes | ||||||||||||||||||||
| 2017 | |||||||||||||||||||||
| 2018 | sub_minutes(number $minutes) (Venus::Date) | ||||||||||||||||||||
| 2019 | |||||||||||||||||||||
| 2020 | The sub_minutes method decrements the C<minute> attribute. | ||||||||||||||||||||
| 2021 | |||||||||||||||||||||
| 2022 | I<Since C<0.01>> | ||||||||||||||||||||
| 2023 | |||||||||||||||||||||
| 2024 | =over 4 | ||||||||||||||||||||
| 2025 | |||||||||||||||||||||
| 2026 | =item sub_minutes example 1 | ||||||||||||||||||||
| 2027 | |||||||||||||||||||||
| 2028 | # given: synopsis; | ||||||||||||||||||||
| 2029 | |||||||||||||||||||||
| 2030 | $date = $date->sub_minutes(1); | ||||||||||||||||||||
| 2031 | |||||||||||||||||||||
| 2032 | # $date->string; # 1988-01-31T23:59:00Z | ||||||||||||||||||||
| 2033 | |||||||||||||||||||||
| 2034 | # $date->epoch; # 570671940 | ||||||||||||||||||||
| 2035 | |||||||||||||||||||||
| 2036 | =back | ||||||||||||||||||||
| 2037 | |||||||||||||||||||||
| 2038 | =over 4 | ||||||||||||||||||||
| 2039 | |||||||||||||||||||||
| 2040 | =item sub_minutes example 2 | ||||||||||||||||||||
| 2041 | |||||||||||||||||||||
| 2042 | # given: synopsis; | ||||||||||||||||||||
| 2043 | |||||||||||||||||||||
| 2044 | $date = $date->sub_minutes(61); | ||||||||||||||||||||
| 2045 | |||||||||||||||||||||
| 2046 | # $date->string; # 1988-01-31T22:59:00Z | ||||||||||||||||||||
| 2047 | |||||||||||||||||||||
| 2048 | # $date->epoch; # 570668340 | ||||||||||||||||||||
| 2049 | |||||||||||||||||||||
| 2050 | =back | ||||||||||||||||||||
| 2051 | |||||||||||||||||||||
| 2052 | =over 4 | ||||||||||||||||||||
| 2053 | |||||||||||||||||||||
| 2054 | =item sub_minutes example 3 | ||||||||||||||||||||
| 2055 | |||||||||||||||||||||
| 2056 | # given: synopsis; | ||||||||||||||||||||
| 2057 | |||||||||||||||||||||
| 2058 | $date = $date->sub_minutes(-1); | ||||||||||||||||||||
| 2059 | |||||||||||||||||||||
| 2060 | # $date->string; # 1988-02-01T00:01:00Z | ||||||||||||||||||||
| 2061 | |||||||||||||||||||||
| 2062 | # $date->epoch; # 570672060 | ||||||||||||||||||||
| 2063 | |||||||||||||||||||||
| 2064 | =back | ||||||||||||||||||||
| 2065 | |||||||||||||||||||||
| 2066 | =cut | ||||||||||||||||||||
| 2067 | |||||||||||||||||||||
| 2068 | =head2 sub_months | ||||||||||||||||||||
| 2069 | |||||||||||||||||||||
| 2070 | sub_months(number $months) (Venus::Date) | ||||||||||||||||||||
| 2071 | |||||||||||||||||||||
| 2072 | The sub_months method decrements the C<month> attribute. | ||||||||||||||||||||
| 2073 | |||||||||||||||||||||
| 2074 | I<Since C<0.01>> | ||||||||||||||||||||
| 2075 | |||||||||||||||||||||
| 2076 | =over 4 | ||||||||||||||||||||
| 2077 | |||||||||||||||||||||
| 2078 | =item sub_months example 1 | ||||||||||||||||||||
| 2079 | |||||||||||||||||||||
| 2080 | # given: synopsis; | ||||||||||||||||||||
| 2081 | |||||||||||||||||||||
| 2082 | $date = $date->sub_months(1); | ||||||||||||||||||||
| 2083 | |||||||||||||||||||||
| 2084 | # $date->string; # 1988-01-01T13:30:56Z | ||||||||||||||||||||
| 2085 | |||||||||||||||||||||
| 2086 | # $date->epoch; # 568042256 | ||||||||||||||||||||
| 2087 | |||||||||||||||||||||
| 2088 | =back | ||||||||||||||||||||
| 2089 | |||||||||||||||||||||
| 2090 | =over 4 | ||||||||||||||||||||
| 2091 | |||||||||||||||||||||
| 2092 | =item sub_months example 2 | ||||||||||||||||||||
| 2093 | |||||||||||||||||||||
| 2094 | # given: synopsis; | ||||||||||||||||||||
| 2095 | |||||||||||||||||||||
| 2096 | $date = $date->sub_months(13); | ||||||||||||||||||||
| 2097 | |||||||||||||||||||||
| 2098 | # $date->string; # 1987-01-01T07:42:08Z | ||||||||||||||||||||
| 2099 | |||||||||||||||||||||
| 2100 | # $date->epoch; # 536485328 | ||||||||||||||||||||
| 2101 | |||||||||||||||||||||
| 2102 | =back | ||||||||||||||||||||
| 2103 | |||||||||||||||||||||
| 2104 | =over 4 | ||||||||||||||||||||
| 2105 | |||||||||||||||||||||
| 2106 | =item sub_months example 3 | ||||||||||||||||||||
| 2107 | |||||||||||||||||||||
| 2108 | # given: synopsis; | ||||||||||||||||||||
| 2109 | |||||||||||||||||||||
| 2110 | $date = $date->sub_months(-1); | ||||||||||||||||||||
| 2111 | |||||||||||||||||||||
| 2112 | # $date->string; # 1988-03-02T10:29:04Z | ||||||||||||||||||||
| 2113 | |||||||||||||||||||||
| 2114 | # $date->epoch; # 573301744 | ||||||||||||||||||||
| 2115 | |||||||||||||||||||||
| 2116 | =back | ||||||||||||||||||||
| 2117 | |||||||||||||||||||||
| 2118 | =cut | ||||||||||||||||||||
| 2119 | |||||||||||||||||||||
| 2120 | =head2 sub_seconds | ||||||||||||||||||||
| 2121 | |||||||||||||||||||||
| 2122 | sub_seconds(number $seconds) (Venus::Date) | ||||||||||||||||||||
| 2123 | |||||||||||||||||||||
| 2124 | The sub_seconds method decrements the C<second> attribute. | ||||||||||||||||||||
| 2125 | |||||||||||||||||||||
| 2126 | I<Since C<0.01>> | ||||||||||||||||||||
| 2127 | |||||||||||||||||||||
| 2128 | =over 4 | ||||||||||||||||||||
| 2129 | |||||||||||||||||||||
| 2130 | =item sub_seconds example 1 | ||||||||||||||||||||
| 2131 | |||||||||||||||||||||
| 2132 | # given: synopsis; | ||||||||||||||||||||
| 2133 | |||||||||||||||||||||
| 2134 | $date = $date->sub_seconds(1); | ||||||||||||||||||||
| 2135 | |||||||||||||||||||||
| 2136 | # $date->string; # 1988-01-31T23:59:59Z | ||||||||||||||||||||
| 2137 | |||||||||||||||||||||
| 2138 | # $date->epoch; # 570671999 | ||||||||||||||||||||
| 2139 | |||||||||||||||||||||
| 2140 | =back | ||||||||||||||||||||
| 2141 | |||||||||||||||||||||
| 2142 | =over 4 | ||||||||||||||||||||
| 2143 | |||||||||||||||||||||
| 2144 | =item sub_seconds example 2 | ||||||||||||||||||||
| 2145 | |||||||||||||||||||||
| 2146 | # given: synopsis; | ||||||||||||||||||||
| 2147 | |||||||||||||||||||||
| 2148 | $date = $date->sub_seconds(61); | ||||||||||||||||||||
| 2149 | |||||||||||||||||||||
| 2150 | # $date->string; # 1988-01-31T23:58:59Z | ||||||||||||||||||||
| 2151 | |||||||||||||||||||||
| 2152 | # $date->epoch; # 570671939 | ||||||||||||||||||||
| 2153 | |||||||||||||||||||||
| 2154 | =back | ||||||||||||||||||||
| 2155 | |||||||||||||||||||||
| 2156 | =over 4 | ||||||||||||||||||||
| 2157 | |||||||||||||||||||||
| 2158 | =item sub_seconds example 3 | ||||||||||||||||||||
| 2159 | |||||||||||||||||||||
| 2160 | # given: synopsis; | ||||||||||||||||||||
| 2161 | |||||||||||||||||||||
| 2162 | $date = $date->sub_seconds(-1); | ||||||||||||||||||||
| 2163 | |||||||||||||||||||||
| 2164 | # $date->string; # 1988-02-01T00:00:01Z | ||||||||||||||||||||
| 2165 | |||||||||||||||||||||
| 2166 | # $date->epoch; # 570672001 | ||||||||||||||||||||
| 2167 | |||||||||||||||||||||
| 2168 | =back | ||||||||||||||||||||
| 2169 | |||||||||||||||||||||
| 2170 | =cut | ||||||||||||||||||||
| 2171 | |||||||||||||||||||||
| 2172 | =head2 sub_years | ||||||||||||||||||||
| 2173 | |||||||||||||||||||||
| 2174 | sub_years(number $years) (Venus::Date) | ||||||||||||||||||||
| 2175 | |||||||||||||||||||||
| 2176 | The sub_years method decrements the C<years> attribute. | ||||||||||||||||||||
| 2177 | |||||||||||||||||||||
| 2178 | I<Since C<0.01>> | ||||||||||||||||||||
| 2179 | |||||||||||||||||||||
| 2180 | =over 4 | ||||||||||||||||||||
| 2181 | |||||||||||||||||||||
| 2182 | =item sub_years example 1 | ||||||||||||||||||||
| 2183 | |||||||||||||||||||||
| 2184 | # given: synopsis; | ||||||||||||||||||||
| 2185 | |||||||||||||||||||||
| 2186 | $date = $date->sub_years(1); | ||||||||||||||||||||
| 2187 | |||||||||||||||||||||
| 2188 | # $date->string; # 1987-01-31T18:11:10Z | ||||||||||||||||||||
| 2189 | |||||||||||||||||||||
| 2190 | # $date->epoch; # 539115070 | ||||||||||||||||||||
| 2191 | |||||||||||||||||||||
| 2192 | =back | ||||||||||||||||||||
| 2193 | |||||||||||||||||||||
| 2194 | =over 4 | ||||||||||||||||||||
| 2195 | |||||||||||||||||||||
| 2196 | =item sub_years example 2 | ||||||||||||||||||||
| 2197 | |||||||||||||||||||||
| 2198 | # given: synopsis; | ||||||||||||||||||||
| 2199 | |||||||||||||||||||||
| 2200 | $date = $date->sub_years(25); | ||||||||||||||||||||
| 2201 | |||||||||||||||||||||
| 2202 | # $date->string; # 1963-01-31T22:39:10Z | ||||||||||||||||||||
| 2203 | |||||||||||||||||||||
| 2204 | # $date->epoch; # -218251250 | ||||||||||||||||||||
| 2205 | |||||||||||||||||||||
| 2206 | =back | ||||||||||||||||||||
| 2207 | |||||||||||||||||||||
| 2208 | =over 4 | ||||||||||||||||||||
| 2209 | |||||||||||||||||||||
| 2210 | =item sub_years example 3 | ||||||||||||||||||||
| 2211 | |||||||||||||||||||||
| 2212 | # given: synopsis; | ||||||||||||||||||||
| 2213 | |||||||||||||||||||||
| 2214 | $date = $date->sub_years(-1); | ||||||||||||||||||||
| 2215 | |||||||||||||||||||||
| 2216 | # $date->string; # 1989-01-31T05:48:50Z | ||||||||||||||||||||
| 2217 | |||||||||||||||||||||
| 2218 | # $date->epoch; # 602228930 | ||||||||||||||||||||
| 2219 | |||||||||||||||||||||
| 2220 | =back | ||||||||||||||||||||
| 2221 | |||||||||||||||||||||
| 2222 | =cut | ||||||||||||||||||||
| 2223 | |||||||||||||||||||||
| 2224 | =head1 OPERATORS | ||||||||||||||||||||
| 2225 | |||||||||||||||||||||
| 2226 | This package overloads the following operators: | ||||||||||||||||||||
| 2227 | |||||||||||||||||||||
| 2228 | =cut | ||||||||||||||||||||
| 2229 | |||||||||||||||||||||
| 2230 | =over 4 | ||||||||||||||||||||
| 2231 | |||||||||||||||||||||
| 2232 | =item operation: C<(!=)> | ||||||||||||||||||||
| 2233 | |||||||||||||||||||||
| 2234 | This package overloads the C<!=> operator. | ||||||||||||||||||||
| 2235 | |||||||||||||||||||||
| 2236 | B<example 1> | ||||||||||||||||||||
| 2237 | |||||||||||||||||||||
| 2238 | # given: synopsis; | ||||||||||||||||||||
| 2239 | |||||||||||||||||||||
| 2240 | my $result = $date != 570672001; | ||||||||||||||||||||
| 2241 | |||||||||||||||||||||
| 2242 | # 1 | ||||||||||||||||||||
| 2243 | |||||||||||||||||||||
| 2244 | =back | ||||||||||||||||||||
| 2245 | |||||||||||||||||||||
| 2246 | =over 4 | ||||||||||||||||||||
| 2247 | |||||||||||||||||||||
| 2248 | =item operation: C<("")> | ||||||||||||||||||||
| 2249 | |||||||||||||||||||||
| 2250 | This package overloads the C<""> operator. | ||||||||||||||||||||
| 2251 | |||||||||||||||||||||
| 2252 | B<example 1> | ||||||||||||||||||||
| 2253 | |||||||||||||||||||||
| 2254 | # given: synopsis; | ||||||||||||||||||||
| 2255 | |||||||||||||||||||||
| 2256 | my $result = "$date"; | ||||||||||||||||||||
| 2257 | |||||||||||||||||||||
| 2258 | # "570672000" | ||||||||||||||||||||
| 2259 | |||||||||||||||||||||
| 2260 | =back | ||||||||||||||||||||
| 2261 | |||||||||||||||||||||
| 2262 | =over 4 | ||||||||||||||||||||
| 2263 | |||||||||||||||||||||
| 2264 | =item operation: C<(+)> | ||||||||||||||||||||
| 2265 | |||||||||||||||||||||
| 2266 | This package overloads the C<+> operator. | ||||||||||||||||||||
| 2267 | |||||||||||||||||||||
| 2268 | B<example 1> | ||||||||||||||||||||
| 2269 | |||||||||||||||||||||
| 2270 | # given: synopsis; | ||||||||||||||||||||
| 2271 | |||||||||||||||||||||
| 2272 | my $result = $date + 0; | ||||||||||||||||||||
| 2273 | |||||||||||||||||||||
| 2274 | # 570672000 | ||||||||||||||||||||
| 2275 | |||||||||||||||||||||
| 2276 | =back | ||||||||||||||||||||
| 2277 | |||||||||||||||||||||
| 2278 | =over 4 | ||||||||||||||||||||
| 2279 | |||||||||||||||||||||
| 2280 | =item operation: C<(-)> | ||||||||||||||||||||
| 2281 | |||||||||||||||||||||
| 2282 | This package overloads the C<-> operator. | ||||||||||||||||||||
| 2283 | |||||||||||||||||||||
| 2284 | B<example 1> | ||||||||||||||||||||
| 2285 | |||||||||||||||||||||
| 2286 | # given: synopsis; | ||||||||||||||||||||
| 2287 | |||||||||||||||||||||
| 2288 | my $result = $date - 0; | ||||||||||||||||||||
| 2289 | |||||||||||||||||||||
| 2290 | # 570672000 | ||||||||||||||||||||
| 2291 | |||||||||||||||||||||
| 2292 | =back | ||||||||||||||||||||
| 2293 | |||||||||||||||||||||
| 2294 | =over 4 | ||||||||||||||||||||
| 2295 | |||||||||||||||||||||
| 2296 | =item operation: C<(0+)> | ||||||||||||||||||||
| 2297 | |||||||||||||||||||||
| 2298 | This package overloads the C<0+> operator. | ||||||||||||||||||||
| 2299 | |||||||||||||||||||||
| 2300 | B<example 1> | ||||||||||||||||||||
| 2301 | |||||||||||||||||||||
| 2302 | # given: synopsis; | ||||||||||||||||||||
| 2303 | |||||||||||||||||||||
| 2304 | my $result = 0 + $date; | ||||||||||||||||||||
| 2305 | |||||||||||||||||||||
| 2306 | # 570672000 | ||||||||||||||||||||
| 2307 | |||||||||||||||||||||
| 2308 | =back | ||||||||||||||||||||
| 2309 | |||||||||||||||||||||
| 2310 | =over 4 | ||||||||||||||||||||
| 2311 | |||||||||||||||||||||
| 2312 | =item operation: C<(==)> | ||||||||||||||||||||
| 2313 | |||||||||||||||||||||
| 2314 | This package overloads the C<==> operator. | ||||||||||||||||||||
| 2315 | |||||||||||||||||||||
| 2316 | B<example 1> | ||||||||||||||||||||
| 2317 | |||||||||||||||||||||
| 2318 | # given: synopsis; | ||||||||||||||||||||
| 2319 | |||||||||||||||||||||
| 2320 | my $result = $date == 570672000; | ||||||||||||||||||||
| 2321 | |||||||||||||||||||||
| 2322 | # 1 | ||||||||||||||||||||
| 2323 | |||||||||||||||||||||
| 2324 | =back | ||||||||||||||||||||
| 2325 | |||||||||||||||||||||
| 2326 | =over 4 | ||||||||||||||||||||
| 2327 | |||||||||||||||||||||
| 2328 | =item operation: C<(E<gt>)> | ||||||||||||||||||||
| 2329 | |||||||||||||||||||||
| 2330 | This package overloads the C<E<gt>> operator. | ||||||||||||||||||||
| 2331 | |||||||||||||||||||||
| 2332 | B<example 1> | ||||||||||||||||||||
| 2333 | |||||||||||||||||||||
| 2334 | # given: synopsis; | ||||||||||||||||||||
| 2335 | |||||||||||||||||||||
| 2336 | my $result = $date > 570671999; | ||||||||||||||||||||
| 2337 | |||||||||||||||||||||
| 2338 | # 1 | ||||||||||||||||||||
| 2339 | |||||||||||||||||||||
| 2340 | =back | ||||||||||||||||||||
| 2341 | |||||||||||||||||||||
| 2342 | =over 4 | ||||||||||||||||||||
| 2343 | |||||||||||||||||||||
| 2344 | =item operation: C<(E<gt>=)> | ||||||||||||||||||||
| 2345 | |||||||||||||||||||||
| 2346 | This package overloads the C<E<gt>=> operator. | ||||||||||||||||||||
| 2347 | |||||||||||||||||||||
| 2348 | B<example 1> | ||||||||||||||||||||
| 2349 | |||||||||||||||||||||
| 2350 | # given: synopsis; | ||||||||||||||||||||
| 2351 | |||||||||||||||||||||
| 2352 | my $result = $date >= 570672000; | ||||||||||||||||||||
| 2353 | |||||||||||||||||||||
| 2354 | # 1 | ||||||||||||||||||||
| 2355 | |||||||||||||||||||||
| 2356 | =back | ||||||||||||||||||||
| 2357 | |||||||||||||||||||||
| 2358 | =over 4 | ||||||||||||||||||||
| 2359 | |||||||||||||||||||||
| 2360 | =item operation: C<(E<lt>)> | ||||||||||||||||||||
| 2361 | |||||||||||||||||||||
| 2362 | This package overloads the C<E<lt>> operator. | ||||||||||||||||||||
| 2363 | |||||||||||||||||||||
| 2364 | B<example 1> | ||||||||||||||||||||
| 2365 | |||||||||||||||||||||
| 2366 | # given: synopsis; | ||||||||||||||||||||
| 2367 | |||||||||||||||||||||
| 2368 | my $result = $date < 570672001; | ||||||||||||||||||||
| 2369 | |||||||||||||||||||||
| 2370 | # 1 | ||||||||||||||||||||
| 2371 | |||||||||||||||||||||
| 2372 | =back | ||||||||||||||||||||
| 2373 | |||||||||||||||||||||
| 2374 | =over 4 | ||||||||||||||||||||
| 2375 | |||||||||||||||||||||
| 2376 | =item operation: C<(E<lt>=)> | ||||||||||||||||||||
| 2377 | |||||||||||||||||||||
| 2378 | This package overloads the C<E<lt>=> operator. | ||||||||||||||||||||
| 2379 | |||||||||||||||||||||
| 2380 | B<example 1> | ||||||||||||||||||||
| 2381 | |||||||||||||||||||||
| 2382 | # given: synopsis; | ||||||||||||||||||||
| 2383 | |||||||||||||||||||||
| 2384 | my $result = $date <= 570672000; | ||||||||||||||||||||
| 2385 | |||||||||||||||||||||
| 2386 | # 1 | ||||||||||||||||||||
| 2387 | |||||||||||||||||||||
| 2388 | =back | ||||||||||||||||||||
| 2389 | |||||||||||||||||||||
| 2390 | =over 4 | ||||||||||||||||||||
| 2391 | |||||||||||||||||||||
| 2392 | =item operation: C<(eq)> | ||||||||||||||||||||
| 2393 | |||||||||||||||||||||
| 2394 | This package overloads the C<eq> operator. | ||||||||||||||||||||
| 2395 | |||||||||||||||||||||
| 2396 | B<example 1> | ||||||||||||||||||||
| 2397 | |||||||||||||||||||||
| 2398 | # given: synopsis; | ||||||||||||||||||||
| 2399 | |||||||||||||||||||||
| 2400 | my $result = $date eq '570672000'; | ||||||||||||||||||||
| 2401 | |||||||||||||||||||||
| 2402 | # 1 | ||||||||||||||||||||
| 2403 | |||||||||||||||||||||
| 2404 | =back | ||||||||||||||||||||
| 2405 | |||||||||||||||||||||
| 2406 | =over 4 | ||||||||||||||||||||
| 2407 | |||||||||||||||||||||
| 2408 | =item operation: C<(ne)> | ||||||||||||||||||||
| 2409 | |||||||||||||||||||||
| 2410 | This package overloads the C<ne> operator. | ||||||||||||||||||||
| 2411 | |||||||||||||||||||||
| 2412 | B<example 1> | ||||||||||||||||||||
| 2413 | |||||||||||||||||||||
| 2414 | # given: synopsis; | ||||||||||||||||||||
| 2415 | |||||||||||||||||||||
| 2416 | my $result = $date ne '560672000'; | ||||||||||||||||||||
| 2417 | |||||||||||||||||||||
| 2418 | # 1 | ||||||||||||||||||||
| 2419 | |||||||||||||||||||||
| 2420 | =back | ||||||||||||||||||||
| 2421 | |||||||||||||||||||||
| 2422 | =over 4 | ||||||||||||||||||||
| 2423 | |||||||||||||||||||||
| 2424 | =item operation: C<(~~)> | ||||||||||||||||||||
| 2425 | |||||||||||||||||||||
| 2426 | This package overloads the C<~~> operator. | ||||||||||||||||||||
| 2427 | |||||||||||||||||||||
| 2428 | B<example 1> | ||||||||||||||||||||
| 2429 | |||||||||||||||||||||
| 2430 | # given: synopsis; | ||||||||||||||||||||
| 2431 | |||||||||||||||||||||
| 2432 | my $result = $date ~~ '570672000'; | ||||||||||||||||||||
| 2433 | |||||||||||||||||||||
| 2434 | # 1 | ||||||||||||||||||||
| 2435 | |||||||||||||||||||||
| 2436 | =back | ||||||||||||||||||||
| 2437 | |||||||||||||||||||||
| 2438 | =head1 AUTHORS | ||||||||||||||||||||
| 2439 | |||||||||||||||||||||
| 2440 | Awncorp, C<awncorp@cpan.org> | ||||||||||||||||||||
| 2441 | |||||||||||||||||||||
| 2442 | =cut | ||||||||||||||||||||
| 2443 | |||||||||||||||||||||
| 2444 | =head1 LICENSE | ||||||||||||||||||||
| 2445 | |||||||||||||||||||||
| 2446 | Copyright (C) 2000, Awncorp, C<awncorp@cpan.org>. | ||||||||||||||||||||
| 2447 | |||||||||||||||||||||
| 2448 | This program is free software, you can redistribute it and/or modify it under | ||||||||||||||||||||
| 2449 | the terms of the Apache license version 2.0. | ||||||||||||||||||||
| 2450 | |||||||||||||||||||||
| 2451 | =cut | ||||||||||||||||||||