Package/Change.pm untested

filter: Statementstmt 0.0% 0 / 33 Branchbran 0.0% 0 / 8 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 57 CC 5 SCAR 14.2
CC
5
Cov
0%
get_author
6.0
get_time
6.0
get_raw_text
6.0
CRAP 4.1
1 # $Id$
2 package Youri::Package::Change;
3  
4 =head1 NAME
5  
6 Youri::Package::Change - Package change class
7  
8 =head1 DESCRIPTION
9  
10 This class represent a package change.
11  
12 =cut
13  
14 use strict;
15 use warnings;
16 use Carp;
17  
18 use constant AUTHOR => 0;
19 use constant TIME => 1;
20 use constant TEXT => 2;
21  
22 =head1 CLASS METHODS
23  
24 =head2 new(%args)
25  
26 Creates and returns a new Youri::Package::Change object.
27  
28 =cut
29  
30 sub new {
31 my ($class, $author, $time, $text) = @_;
32  
33 return bless [
34 $author,
35 $time,
36 $text,
37 ], $class;
38 }
39  
40 =head2 get_author()
41  
42 Returns the author of this change.
43  
44 =cut
45  
46 sub get_author {
47 my ($self) = @_;
48 croak "Not a class method" unless ref $self;
49  
50 return $self->[AUTHOR];
51 }
52  
53 =head2 get_time()
54  
55 Return the time of this change.
56  
57 =cut
58  
59 sub get_time {
60 my ($self) = @_;
61 croak "Not a class method" unless ref $self;
62  
63 return $self->[TIME];
64 }
65  
66 =head2 get_raw_text()
67  
68 Returns the textual description of this change, as as string.
69  
70 =cut
71  
72 sub get_raw_text {
73 my ($self) = @_;
74 croak "Not a class method" unless ref $self;
75  
76 return $self->[TEXT];
77 }
78  
79 =head2 get_text_items()
80  
81 Returns the textual description of this change, as as array reference of
82 individual changes.
83  
84 =cut
85  
86 sub get_text_items {
87 my ($self) = @_;
88 croak "Not a class method" unless ref $self;
89  
90 return $self->[TEXT] =~ /
91 ^
92 [-+ ] \s+ # list token
93 (.*) # real text
94 $
95 /xmg;
96 }
97  
98 1;