blib/lib/HTML/Shakan/Inflator/DateTime.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 7 / 7 Podpod 0.0% 0 / 1 totaltotal 97.1% 34 / 35 CC 2 SCAR 2.2
CC
2
Cov
100%
inflate
2.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.2
« blib/lib/HTML/Shakan/Declare.pm ↑ Summary blib/lib/HTML/Shakan/Field.pm »
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
BranchTrueFalseTotal
if (my $tz = $self->time_zone) 1 2 3
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  
« blib/lib/HTML/Shakan/Declare.pm ↑ Summary blib/lib/HTML/Shakan/Field.pm »