DateTime/Parser.pm

filter: Statementstmt 89.7% 35 / 39 Branchbran 85.7% 12 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 9 / 9 Podpod 60.0% 3 / 5 totaltotal 88.0% 59 / 67 CC 8 SCAR 10.3
CC
8
Cov
89%
european
5.0
parse_date
3.1
parse_european_date
2.3
CRAP 2.8
« DateTime/Util.pm ↑ Summary DateTime.pm »
1 package Rose::DateTime::Parser;
2  
3 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 1 ▶use Rose::DateTime::Util();
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶use Rose::Object;
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 our @ISA = qw(Rose::Object);
9  
10 use Rose::Object::MakeMethods::Generic
11 1 ▶(
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 scalar => 'error',
13 'scalar --get_set_init' => 'time_zone',
14 1 );
15  
16 1 our $VERSION = '0.50';
17  
18 1 ▶sub init_time_zone { Rose::DateTime::Util->time_zone }
Subroutine init_time_zone: called CC=1 SCAR=0.0
Pod undocumented
19 3 ▶sub init_european { Rose::DateTime::Util->european_dates }
Subroutine init_european: called CC=1 SCAR=0.0
Pod undocumented
20  
21 sub european
22 12 ▶{
Subroutine european: called CC=5 SCAR=16.1
Pod documented
23 12 my($self) = shift;
24  
25 12 ▶ if(@_)
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 3 9 12
26 {
27 3 ▶ if(defined $_[0])
Branch: 1 branch
BranchTrueFalseTotal
if (defined $_[0]) { } 2 1 3
28 {
29 2 ▶ return $self->{'european'} = $_[0] ? 1 : 0;
Branch: 1 branch
BranchTrueFalseTotal
$_[0] ? : 1 1 2
30 }
31 1 else { $self->{'european'} = undef }
32 }
33  
34 10 ▶ return $self->{'european'} if(defined $self->{'european'});
Branch: 1 branch
BranchTrueFalseTotal
if defined $self->{"european"} 7 3 10
35 3 $self->{'european'} = $self->init_european;
36 }
37  
38 sub parse_date
39 7 ▶{
Subroutine parse_date: called CC=3 SCAR=11.3
Pod documented
40 7 my($self) = shift;
41  
42 7 my $date;
43  
44 7 ▶ if($self->european)
Branch: 1 branch
BranchTrueFalseTotal
if ($self->european) { } 3 4 7
45 {
46 3 $date = Rose::DateTime::Util::parse_european_date(shift, $self->time_zone);
47 }
48 else
49 {
50 4 local $Rose::DateTime::Util::European_Dates = 0;
51 4 $date = Rose::DateTime::Util::parse_date(shift, $self->time_zone);
52 }
53  
54 7 ▶ return $date if($date);
Branch: 1 branch
BranchTrueFalseTotal
if $date 7 0 7
55 0 $self->error(Rose::DateTime::Util->error);
56 0 return $date;
57 }
58  
59 1 *parse_datetime = \&parse_date;
60  
61 sub parse_european_date
62 1 ▶{
Subroutine parse_european_date: called CC=2 SCAR=8.4
Pod documented
63 1 my($self) = shift;
64 1 my $date = Rose::DateTime::Util::parse_european_date(shift, $self->time_zone);
65 1 ▶ return $date if($date);
Branch: 1 branch
BranchTrueFalseTotal
if $date 1 0 1
66 0 $self->error(Rose::DateTime::Util->error);
67 0 return $date;
68 }
69  
70 1 1;
71  
72 __END__
« DateTime/Util.pm ↑ Summary DateTime.pm »