blib/lib/Text/WordDiff/HTMLTwoLines.pm | |||
---|---|---|---|
Criterion | Covered | Total | % |
statement | 41 | 41 | 100.0 |
branch | 4 | 6 | 66.6 |
condition | 2 | 3 | 66.6 |
subroutine | 10 | 10 | 100.0 |
pod | 0 | 7 | 0.0 |
total | 57 | 67 | 85.0 |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package Text::WordDiff::HTMLTwoLines; | ||||||
2 | |||||||
3 | 1 | 1 | 1275 | use strict; | |||
1 | 2 | ||||||
1 | 80 | ||||||
4 | 1 | 1 | 394 | use HTML::Entities qw(encode_entities); | |||
1 | 5210 | ||||||
1 | 135 | ||||||
5 | 1 | 1 | 10 | use vars qw($VERSION @ISA); | |||
1 | 2 | ||||||
1 | 648 | ||||||
6 | |||||||
7 | $VERSION = '0.09'; | ||||||
8 | @ISA = qw(Text::WordDiff::Base); | ||||||
9 | |||||||
10 | sub file_header { | ||||||
11 | 11 | 11 | 0 | 12 | my $self = shift; | ||
12 | 11 | 27 | my $fn1 = $self->filename_a; | ||||
13 | 11 | 21 | my $fn2 = $self->filename_b; | ||||
14 | |||||||
15 | 11 | 100 | 66 | 32 | if (defined $fn1 && defined $fn2) | ||
16 | 1 | 8 | { my $p1 = $self->filename_prefix_a; | ||||
17 | 1 | 5 | my $t1 = $self->mtime_a; | ||||
18 | 1 | 5 | my $p2 = $self->filename_prefix_b; | ||||
19 | 1 | 4 | my $t2 = $self->mtime_b; | ||||
20 | |||||||
21 | 1 | 50 | 27 | $self->{__str1} = ' ' |
|||
22 | . "$p1 $fn1" . (defined $t1 ? " " . localtime $t1 : '') . ''; | ||||||
23 | |||||||
24 | 1 | 50 | 20 | $self->{__str2} = ' ' |
|||
25 | . "$p2 $fn2" . (defined $t2 ? " " . localtime $t2 : '') . ''; | ||||||
26 | } | ||||||
27 | else | ||||||
28 | 10 | 25 | { $self->{__str1} = $self->{__str2} = ' '; |
||||
29 | } | ||||||
30 | 11 | 36 | return ''; | ||||
31 | } | ||||||
32 | |||||||
33 | sub hunk_header { | ||||||
34 | 55 | 55 | 0 | 112 | my $self = shift; | ||
35 | 55 | 87 | $self->{__str1} .= ''; | ||||
36 | 55 | 73 | $self->{__str2} .= ''; | ||||
37 | 55 | 114 | return ''; | ||||
38 | } | ||||||
39 | sub hunk_footer { | ||||||
40 | 55 | 55 | 0 | 65 | my $self = shift; | ||
41 | 55 | 66 | $self->{__str1} .= ''; | ||||
42 | 55 | 116 | $self->{__str2} .= ''; | ||||
43 | 55 | 88 | return ''; | ||||
44 | } | ||||||
45 | |||||||
46 | sub file_footer { | ||||||
47 | 11 | 11 | 0 | 16 | my $self = shift; | ||
48 | 11 | 100 | return $self->{__str1} . "\n" . $self->{__str2} . "\n"; | ||||
49 | } | ||||||
50 | |||||||
51 | sub same_items { | ||||||
52 | 29 | 29 | 0 | 38 | my $self = shift; | ||
53 | 29 | 77 | $self->{__str1} .= encode_entities( join '', @_ ); | ||||
54 | 29 | 357 | $self->{__str2} .= encode_entities( join '', @_ ); | ||||
55 | 29 | 385 | return ''; | ||||
56 | } | ||||||
57 | |||||||
58 | sub delete_items { | ||||||
59 | 26 | 26 | 0 | 33 | my $self = shift; | ||
60 | 26 | 65 | $self->{__str1} .= ' |
||||
61 | 26 | 374 | return ''; | ||||
62 | } | ||||||
63 | |||||||
64 | sub insert_items { | ||||||
65 | 26 | 26 | 0 | 35 | my $self = shift; | ||
66 | 26 | 88 | $self->{__str2} .= '' . encode_entities( join '', @_ ) . ''; | ||||
67 | 26 | 297 | return ''; | ||||
68 | } | ||||||
69 | |||||||
70 | 1; | ||||||
71 | |||||||
72 | __END__ |