line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Goo::Differ; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
############################################################################### |
4
|
|
|
|
|
|
|
# Nigel Hamilton |
5
|
|
|
|
|
|
|
# |
6
|
|
|
|
|
|
|
# Copyright Nigel Hamilton 2005 |
7
|
|
|
|
|
|
|
# All Rights Reserved |
8
|
|
|
|
|
|
|
# |
9
|
|
|
|
|
|
|
# Author: Nigel Hamilton |
10
|
|
|
|
|
|
|
# Filename: Goo::Differ.pm |
11
|
|
|
|
|
|
|
# Description: Take the diff! |
12
|
|
|
|
|
|
|
# |
13
|
|
|
|
|
|
|
# Date Change |
14
|
|
|
|
|
|
|
# ----------------------------------------------------------------------------- |
15
|
|
|
|
|
|
|
# 09/05/2005 Auto generated file |
16
|
|
|
|
|
|
|
# 09/05/2005 Need to remember the difference between two files |
17
|
|
|
|
|
|
|
# |
18
|
|
|
|
|
|
|
############################################################################### |
19
|
|
|
|
|
|
|
|
20
|
1
|
|
|
1
|
|
3586
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
32
|
|
21
|
|
|
|
|
|
|
|
22
|
1
|
|
|
1
|
|
5
|
use Goo::Object; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
23
|
|
23
|
1
|
|
|
1
|
|
10
|
use base qw(Goo::Object); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
289
|
|
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
############################################################################### |
27
|
|
|
|
|
|
|
# |
28
|
|
|
|
|
|
|
# diff - return those lines that have changed since list1 |
29
|
|
|
|
|
|
|
# |
30
|
|
|
|
|
|
|
############################################################################### |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
sub diff { |
33
|
|
|
|
|
|
|
|
34
|
0
|
|
|
0
|
1
|
|
my ($this, $list1, $list2) = @_; |
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
|
|
|
my %list1_member = map { $_ => 1; } @$list1; |
|
0
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
my $linecount = 0; |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
foreach my $line (@$list2) { |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
|
|
|
$linecount++; |
43
|
|
|
|
|
|
|
|
44
|
0
|
0
|
|
|
|
|
if (not exists $list1_member{$line}) { |
45
|
0
|
|
|
|
|
|
$this->{lines}->{$linecount} = $line; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
############################################################################### |
54
|
|
|
|
|
|
|
# |
55
|
|
|
|
|
|
|
# get_line_numbers - return the line numbers that are new or different |
56
|
|
|
|
|
|
|
# |
57
|
|
|
|
|
|
|
############################################################################### |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub get_line_numbers { |
60
|
|
|
|
|
|
|
|
61
|
0
|
|
|
0
|
1
|
|
my ($this) = @_; |
62
|
|
|
|
|
|
|
|
63
|
0
|
|
|
|
|
|
return keys %{ $this->{lines} }; |
|
0
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
} |
66
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
|
68
|
|
|
|
|
|
|
############################################################################### |
69
|
|
|
|
|
|
|
# |
70
|
|
|
|
|
|
|
# get_line - return the line found at |
71
|
|
|
|
|
|
|
# |
72
|
|
|
|
|
|
|
############################################################################### |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub get_line { |
75
|
|
|
|
|
|
|
|
76
|
0
|
|
|
0
|
1
|
|
my ($this, $line_number) = @_; |
77
|
|
|
|
|
|
|
|
78
|
0
|
|
|
|
|
|
return $this->{lines}->{$line_number}; |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
} |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
1; |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
__END__ |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
=head1 NAME |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
Goo::Differ - Take the diff! |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=head1 SYNOPSIS |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
use Goo::Differ; |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 DESCRIPTION |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
=head1 METHODS |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
=over |
102
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
=item diff |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
return those lines that have changed |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=item get_line_numbers |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
return the line numbers that are new or different |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
=item get_line |
112
|
|
|
|
|
|
|
|
113
|
|
|
|
|
|
|
return the line found at a given line number |
114
|
|
|
|
|
|
|
|
115
|
|
|
|
|
|
|
=back |
116
|
|
|
|
|
|
|
|
117
|
|
|
|
|
|
|
=head1 AUTHOR |
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
Nigel Hamilton <nigel@trexy.com> |
120
|
|
|
|
|
|
|
|
121
|
|
|
|
|
|
|
=head1 SEE ALSO |
122
|
|
|
|
|
|
|
|