| 1 | package HTML::Shakan::Inflator::DateTime; | ||||||||||
| 2 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 3 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 2 | ▶ | use Mouse; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use DateTime; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | 2 | ▶ | use DateTime::Format::HTTP; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 2 | has 'time_zone' => ( | |||||||||
| 9 | is => 'ro', | ||||||||||
| 10 | isa => 'Str', | ||||||||||
| 11 | ); | ||||||||||
| 12 | |||||||||||
| 13 | sub inflate { | ||||||||||
| 14 | 3 | ▶ | my ($self, $val) = @_; | ||||||||
|
Subroutine
inflate: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||
| 15 | |||||||||||
| 16 | 3 | my $dt = DateTime::Format::HTTP->parse_datetime($val); | |||||||||
| 17 | 3 | ▶ | if (my $tz = $self->time_zone) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 18 | 1 | $dt->set_time_zone($tz); | |||||||||
| 19 | } | ||||||||||
| 20 | 3 | return $dt; | |||||||||
| 21 | } | ||||||||||
| 22 | |||||||||||
| 23 | 2 | ▶ | no Mouse; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 24 | 2 | __PACKAGE__->meta->make_immutable; | |||||||||
| 25 | __END__ | ||||||||||
| 26 | |||||||||||
| 27 | =head1 NAME | ||||||||||
| 28 | |||||||||||
| 29 | HTML::Shakan::Inflator::DateTime - inflate field value to DateTime instance | ||||||||||
| 30 | |||||||||||
| 31 | =head1 AUTHOR | ||||||||||
| 32 | |||||||||||
| 33 | Tokuhiro Matsuno | ||||||||||
| 34 | |||||||||||
| 35 | =head1 SEE ALSO | ||||||||||
| 36 | |||||||||||
| 37 | L<DateTime> | ||||||||||
| 38 | |||||||||||