File Coverage

blib/lib/Module/Changes/Release.pm
Criterion Covered Total %
statement 23 26 88.4
branch 2 4 50.0
condition 3 3 100.0
subroutine 8 9 88.8
pod 4 4 100.0
total 40 46 86.9


line stmt bran cond sub pod time code
1             package Module::Changes::Release;
2              
3 2     2   1285 use warnings;
  2         6  
  2         61  
4 2     2   9 use strict;
  2         4  
  2         61  
5 2     2   4502 use DateTime;
  2         393995  
  2         12  
6 2     2   2473 use Perl::Version;
  2         5105  
  2         21  
7              
8              
9             our $VERSION = '0.05';
10              
11              
12 2     2   88 use base 'Module::Changes::Base';
  2         4  
  2         615  
13              
14              
15             __PACKAGE__
16             ->mk_scalar_accessors(qw(version date author))
17             ->mk_array_accessors(qw(changes tags));
18              
19              
20             # Perl::Version offers ->normal() and ->numify(), but I don't like either for
21             # Changes, so here is my format.
22              
23             sub version_as_string {
24 7     7 1 236 my $self = shift;
25              
26             # How many fields to show? Don't show a subversion of '0'.
27 7         24 my @components = $self->version->components;
28 7 100 100     142 $self->version->components(2) if @components == 3 && $components[2] == 0;
29              
30 7         44 $self->version->_format({
31             prefix => '',
32             printf => ['%d'],
33             extend => '.%02d',
34             alpha => '_%02d',
35             suffix => '',
36             fields => scalar($self->version->components),
37             });
38             }
39              
40              
41             sub touch_date {
42 5     5 1 626 my $self = shift;
43 5         30 $self->date(DateTime->now);
44             }
45              
46              
47             sub clone_version {
48 4     4 1 6 my $self = shift;
49 4         13 Perl::Version->new($self->version);
50             }
51              
52              
53             sub remove_tag {
54 0     0 1   my ($self, $tag) = @_;
55 0 0         $self->tags(grep { defined($_) && $_ ne $tag } $self->tags);
  0            
56             }
57              
58              
59             1;
60              
61             __END__