line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
# ABSTRACT: Represents one addition or deletion in a diff |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
package Pinto::DifferenceEntry; |
4
|
|
|
|
|
|
|
|
5
|
7
|
|
|
7
|
|
45
|
use Moose; |
|
7
|
|
|
|
|
16
|
|
|
7
|
|
|
|
|
43
|
|
6
|
7
|
|
|
7
|
|
41867
|
use MooseX::StrictConstructor; |
|
7
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
69
|
|
7
|
7
|
|
|
7
|
|
20875
|
use MooseX::MarkAsMethods ( autoclean => 1 ); |
|
7
|
|
|
|
|
24
|
|
|
7
|
|
|
|
|
67
|
|
8
|
7
|
|
|
7
|
|
23458
|
use MooseX::Types::Moose qw(Str); |
|
7
|
|
|
|
|
22
|
|
|
7
|
|
|
|
|
71
|
|
9
|
|
|
|
|
|
|
|
10
|
7
|
|
|
7
|
|
31199
|
use String::Format; |
|
7
|
|
|
|
|
1287
|
|
|
7
|
|
|
|
|
529
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
use overload ( |
15
|
7
|
|
|
|
|
74
|
q{""} => 'to_string', |
16
|
|
|
|
|
|
|
'cmp' => 'string_compare', |
17
|
7
|
|
|
7
|
|
48
|
); |
|
7
|
|
|
|
|
15
|
|
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
our $VERSION = '0.13'; # VERSION |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# TODO: Consider breaking this into separate Addition and Deletion subclasses, |
26
|
|
|
|
|
|
|
# rather than using an "op" attribute to indicate which kind it is. That sort |
27
|
|
|
|
|
|
|
# of "type" flag is always a code smell to me. |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
has op => ( |
32
|
|
|
|
|
|
|
is => 'ro', |
33
|
|
|
|
|
|
|
isa => Str, |
34
|
|
|
|
|
|
|
required => 1 |
35
|
|
|
|
|
|
|
); |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
has registration => ( |
38
|
|
|
|
|
|
|
is => 'ro', |
39
|
|
|
|
|
|
|
isa => 'Pinto::Schema::Result::Registration', |
40
|
|
|
|
|
|
|
required => 1, |
41
|
|
|
|
|
|
|
); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
44
|
|
|
|
|
|
|
|
45
|
8
|
|
|
8
|
0
|
203
|
sub is_addition { shift->op eq '+' } |
46
|
|
|
|
|
|
|
|
47
|
0
|
|
|
0
|
0
|
0
|
sub is_deletion { shift->op eq '-' } |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
50
|
|
|
|
|
|
|
|
51
|
|
|
|
|
|
|
sub to_string { |
52
|
35
|
|
|
35
|
0
|
278
|
my ( $self, $format ) = @_; |
53
|
|
|
|
|
|
|
|
54
|
35
|
|
|
|
|
833
|
my %fspec = ( o => $self->op ); |
55
|
|
|
|
|
|
|
|
56
|
35
|
|
33
|
|
|
104
|
$format ||= $self->default_format; |
57
|
35
|
|
|
|
|
847
|
return $self->registration->to_string( String::Format::stringf($format, %fspec) ); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
sub default_format { |
63
|
0
|
|
|
0
|
0
|
0
|
my ($self) = @_; |
64
|
|
|
|
|
|
|
|
65
|
0
|
|
|
|
|
0
|
return '%o[%F] %-40p %12v %a/%f', |
66
|
|
|
|
|
|
|
} |
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
sub string_compare { |
71
|
18
|
|
|
18
|
0
|
2311
|
my ( $self, $other ) = @_; |
72
|
|
|
|
|
|
|
|
73
|
18
|
|
|
|
|
582
|
return $self->registration->distribution->name |
74
|
|
|
|
|
|
|
cmp $other->registration->distribution->name; |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
|
77
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
#------------------------------------------------------------------------------ |
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
|
84
|
|
|
|
|
|
|
__END__ |
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
=pod |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=encoding UTF-8 |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=for :stopwords Jeffrey Ryan Thalhammer |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 NAME |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
Pinto::DifferenceEntry - Represents one addition or deletion in a diff |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 VERSION |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
version 0.13 |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 AUTHOR |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
Jeffrey Ryan Thalhammer <jeff@stratopan.com> |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
105
|
|
|
|
|
|
|
|
106
|
|
|
|
|
|
|
This software is copyright (c) 2015 by Jeffrey Ryan Thalhammer. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
109
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=cut |