RST/ChangeLog.pm

filter: Statementstmt 61.9% 13 / 21 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 57.1% 4 / 7 Podpod 66.6% 2 / 3 totaltotal 57.5% 19 / 33 CC 2 SCAR 9.2
CC
2
Cov
57%
new
6.0
date
2.0
changes
2.0
CRAP 2.5
« RST/Base.pm ↑ Summary RST/Resource.pm »
1 package ICANN::RST::ChangeLog;
2 # ABSTRACT: an object representing a set of changes.
3 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use base qw(ICANN::RST::Base);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
9 0 my ($package, $id, $ref, $spec) = @_;
10  
11 0 ▶ croak(sprintf("invalid date format '%s', must be YYYY-MM-DD", $id)) unless ($id =~ /^\d{4}-\d{2}-\d{2}$/);
Branch: 1 branch
BranchTrueFalseTotal
unless $id =~ /^\d{4}-\d{2}-\d{2}$/ 0 0 0
12  
13 #
14 # the ICANN::RST::Base constructor expects $ref to be a hashref so we need
15 # to wrap it
16 #
17 0 return $package->SUPER::new(
18 $id,
19 {'changes' => $ref},
20 $spec,
21 );
22 }
23  
24 0 ▶sub date {
Subroutine date: not called CC=1 SCAR=6.9
Pod documented
25 0 my $self = shift;
26  
27 0 return DateTime->new(
28 'year' => int(substr($self->id, 0, 4)),
29 'month' => int(substr($self->id, 5, 2)),
30 'day' => int(substr($self->id, 8, 2)),
31 );
32 }
33  
34 0 ▶sub changes { map { ICANN::RST::Text->new($_) } @{$_[0]->{'changes'}} }
Subroutine changes: not called CC=1 SCAR=6.9
Pod documented
35  
36 1 1;
37  
38 __END__
« RST/Base.pm ↑ Summary RST/Resource.pm »