Object/Metadata/Column/Datetime.pm

filter: Statementstmt 60.6% 20 / 33 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 15 MC/DCmcdc 0.0% 0 / 8 Subroutinesub 62.5% 5 / 8 Podpod 100% 4 / 4 totaltotal 36.2% 29 / 80 CC 12 SCAR 35.7
CC
12
Cov
33%
parse_value
72.0
should_inline_value
18.4
format_value
2.0
CRAP 35.5
« Object/Metadata/Column/Varchar.pm ↑ Summary Object/Metadata/Auto/Oracle.pm »
1 package Rose::DB::Object::Metadata::Column::Datetime;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Rose::DB::Object::MakeMethods::Date;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Rose::DB::Object::Metadata::Column::Date;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 our @ISA = qw(Rose::DB::Object::Metadata::Column::Date);
9  
10 1 our $VERSION = '0.788';
11  
12 1 __PACKAGE__->add_common_method_maker_argument_names
13 (
14 qw(time_zone)
15 );
16  
17 1 Rose::Object::MakeMethods::Generic->make_methods
18 (
19 { preserve_existing => 1 },
20 scalar => [ __PACKAGE__->common_method_maker_argument_names ]
21 );
22  
23 1 foreach my $type (__PACKAGE__->available_method_types)
24 {
25 3 __PACKAGE__->method_maker_type($type => 'datetime');
26 }
27  
28 2 ▶sub type { 'datetime' }
Subroutine type: called CC=1 SCAR=0.0
Pod documented
29  
30 sub should_inline_value
31 0 ▶{
Subroutine should_inline_value: not called CC=5 SCAR=29.1
Pod documented
32 0 my($self, $db, $value) = @_;
33 1 ▶ no warnings 'uninitialized';
Subroutine BEGIN: called CC=1 SCAR=0.0
34 0 ▶ return (($db->validate_datetime_keyword($value) && $db->should_inline_datetime_keyword($value)) ||
Branch: 1 branch
BranchTrueFalseTotal
$db->validate_datetime_keyword($value) && $db->should_inline_datetime_keyword($value) || $db->keyword_function_calls && $value =~ /^\w+\(.*\)$/ ? : 0 0 0
Condition0%0/9
$db->validate_datetime_keyword($value) and $db->should_inline_datetime_keyword($value) or $db->keyword_function_calls and $value =~ /^\w+\(.*\)$/
l!l&&r!l&&!r
000
$db->validate_datetime_keyword($value) and $db->should_inline_datetime_keyword($value)
!ll&&!rl&&r
000
$db->keyword_function_calls and $value =~ /^\w+\(.*\)$/
!ll&&!rl&&r
000
MC/DC0%0/4
$db->validate_datetime_keyword($value) and $db->should_inline_datetime_keyword($value) or $db->keyword_function_calls and $value =~ /^\w+\(.*\)$/
$db->validate_datetime_keyword($value) $db->should_inline_datetime_keyword($value) $db->keyword_function_calls $value =~ /^\w+\(.*\)$/
Truth table0%0/7
A and B or C and D
A= $db->validate_datetime_keyword($value)B= $db->should_inline_datetime_keyword($value)C= $db->keyword_function_callsD= $value =~ /^\w+\(.*\)$/
ABCDresult
11XX1
0X111
10111
0X0X0
0X100
100X0
10100
35 ($db->keyword_function_calls && $value =~ /^\w+\(.*\)$/)) ? 1 : 0;
36 }
37  
38 sub parse_value
39 0 ▶{
Subroutine parse_value: not called CC=8 SCAR=42.8
Pod documented
40 0 my($self, $db) = (shift, shift);
41  
42 0 $self->parse_error(undef);
43  
44 0 ▶ my $dt = (defined $_[0]) ? $db->parse_datetime(@_) : undef;
Branch: 1 branch
BranchTrueFalseTotal
defined $_[0] ? : 0 0 0
45  
46 0 ▶ if($dt)
Branch: 1 branch
BranchTrueFalseTotal
if ($dt) { } 0 0 0
47 {
48 0 ▶ $dt->set_time_zone($self->time_zone || $db->server_time_zone)
Branch: 1 branch
BranchTrueFalseTotal
if UNIVERSAL::isa($dt, "DateTime") 0 0 0
Condition0%0/3
$self->time_zone || $db->server_time_zone
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->time_zone || $db->server_time_zone
$self->time_zone $db->server_time_zone
Truth table0%0/3
A || B
A= $self->time_zoneB= $db->server_time_zone
ABresult
1X1
011
000
49 if(UNIVERSAL::isa($dt, 'DateTime'));
50 }
51 else
52 {
53 0 ▶ $dt = Rose::DateTime::Util::parse_date($_[0], $self->time_zone || $db->server_time_zone);
Condition0%0/3
$self->time_zone || $db->server_time_zone
l!l&&r!l&&!r
000
MC/DC0%0/2
$self->time_zone || $db->server_time_zone
$self->time_zone $db->server_time_zone
Truth table0%0/3
A || B
A= $self->time_zoneB= $db->server_time_zone
ABresult
1X1
011
000
54  
55 0 ▶ if(my $error = Rose::DateTime::Util->error)
Branch: 1 branch
BranchTrueFalseTotal
if (my $error = "Rose::DateTime::Util"->error) 0 0 0
56 {
57 0 ▶ $self->parse_error("Could not parse value '$_[0]' for column $self: $error")
Branch: 1 branch
BranchTrueFalseTotal
if defined $_[0] 0 0 0
58 if(defined $_[0]);
59 }
60 }
61  
62 0 return $dt;
63 }
64  
65 0 ▶sub format_value { shift; shift->format_datetime(@_) }
Subroutine format_value: not called CC=1 SCAR=6.9
Pod documented
66  
67 1 1;
68  
69 __END__
« Object/Metadata/Column/Varchar.pm ↑ Summary Object/Metadata/Auto/Oracle.pm »