blib/lib/DBIx/Class/InflateColumn/TimePiece.pm

filter: Statementstmt 100% 25 / 25 Branchbran 100% 2 / 2 Conditioncond 100% 8 / 8 MC/DCmcdc 100% 5 / 5 Subroutinesub 100% 8 / 8 Podpod 0.0% 0 / 1 totaltotal 97.9% 48 / 49 CC 5 SCAR 9.8
CC
5
Cov
100%
register_column
5.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.7
↑ Summary
1 package DBIx::Class::InflateColumn::TimePiece;
2  
3 # ABSTRACT: Auto-create Time::Piece objects from integer (number of seconds since epoch) columns
4  
5 2 ▶use v5.10;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 2 our $VERSION = '0.03'; # VERSION
11  
12 2 ▶use parent 'DBIx::Class';
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 2 ▶use Time::Piece;
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 14 ▶sub register_column {
Subroutine register_column: called CC=5 SCAR=16.1
Pod undocumented
17 14 my ($self, $column, $info, @rest) = @_;
18  
19 14 $self->next::method( $column, $info, @rest );
20  
21 14 ▶ my $data_type = $info->{data_type} || '';
Condition100%2/2
$info->{'data_type'} || ''
l!l
104
MC/DC100%1/1
$info->{'data_type'} || ''
$info->{'data_type'}
Truth table100%2/2
A
A= $info->{'data_type'}
Aresult
11
00
22 14 ▶ my $is_integer = $data_type eq 'integer' || $data_type eq 'int';
Condition100%3/3
$data_type eq 'integer' || $data_type eq 'int'
l!l&&r!l&&!r
248
MC/DC100%2/2
$data_type eq 'integer' || $data_type eq 'int'
$data_type eq 'integer' $data_type eq 'int'
Truth table100%3/3
A || B
A= $data_type eq 'integer'B= $data_type eq 'int'
ABresult
1X1
011
000
23  
24 14 ▶ return if !$info->{inflate_time_piece} || !$is_integer;
Branch: 1 branch
BranchTrueFalseTotal
unless $info->{"inflate_time_piece"} and $is_integer 10 4 14
Condition100%3/3
$info->{"inflate_time_piece"} and $is_integer
!ll&&!rl&&r
644
MC/DC100%2/2
$info->{"inflate_time_piece"} and $is_integer
$info->{"inflate_time_piece"} $is_integer
Truth table100%3/3
A and B
A= $info->{"inflate_time_piece"}B= $is_integer
ABresult
0X0
100
111
25  
26 $self->inflate_column(
27 $column => {
28 6 ▶ inflate => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
29 6 my $dt = localtime shift;
30 6 return $dt;
31 },
32 6 ▶ deflate => sub {
Subroutine __ANON__: called CC=1 SCAR=0.0
33 6 return shift->epoch;
34 },
35 }
36 4 );
37 }
38  
39 2 1;
40  
41 __END__
↑ Summary