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 sub new {
9 0 ▶ my ($package, $id, $ref, $spec) = @_;
Subroutine new: not called CC=2 SCAR=17.9
Pod undocumented
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 sub date {
25 0 ▶ my $self = shift;
Subroutine date: not called CC=1 SCAR=6.9
Pod documented
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__
39  
40 =pod
41  
42 =encoding UTF-8
43  
44 =head1 NAME
45  
46 ICANN::RST::ChangeLog - an object representing a set of changes.
47  
48 =head1 VERSION
49  
50 version 0.03
51  
52 =head1 NAME
53  
54 This class inherits from L<ICANN::RST::Base> (so it has the C<id()> and
55 C<spec()> methods).
56  
57 =head1 METHODS
58  
59 =head2 date()
60  
61 Returns a L<DateTime> representing the date of the changes.
62  
63 =head2 changes()
64  
65 Returns an array of L<ICANN::RST::Text> objects.
66  
67 =head1 AUTHOR
68  
69 Gavin Brown <gavin.brown@icann.org>
70  
71 =head1 COPYRIGHT AND LICENSE
72  
73 This software is copyright (c) 2025 by Internet Corporation for Assigned Names and Number (ICANN).
74  
75 This is free software; you can redistribute it and/or modify it under
76 the same terms as the Perl 5 programming language system itself.
77  
78 =cut
« RST/Base.pm ↑ Summary RST/Resource.pm »