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 | 1865 | use strict; | |||
1 | 3 | ||||||
1 | 45 | ||||||
4 | 1 | 1 | 890 | use HTML::Entities qw(encode_entities); | |||
1 | 7723 | ||||||
1 | 107 | ||||||
5 | 1 | 1 | 9 | use vars qw($VERSION @ISA); | |||
1 | 2 | ||||||
1 | 529 | ||||||
6 | |||||||
7 | $VERSION = '0.08'; | ||||||
8 | @ISA = qw(Text::WordDiff::Base); | ||||||
9 | |||||||
10 | sub file_header { | ||||||
11 | 11 | 11 | 0 | 16 | my $self = shift; | ||
12 | 11 | 35 | my $fn1 = $self->filename_a; | ||||
13 | 11 | 36 | my $fn2 = $self->filename_b; | ||||
14 | |||||||
15 | 11 | 100 | 66 | 37 | if (defined $fn1 && defined $fn2) | ||
16 | 1 | 8 | { my $p1 = $self->filename_prefix_a; | ||||
17 | 1 | 7 | my $t1 = $self->mtime_a; | ||||
18 | 1 | 17 | my $p2 = $self->filename_prefix_b; | ||||
19 | 1 | 7 | my $t2 = $self->mtime_b; | ||||
20 | |||||||
21 | 1 | 50 | 40 | $self->{__str1} = ' ' |
|||
22 | . "$p1 $fn1" . (defined $t1 ? " " . localtime $t1 : '') . ''; | ||||||
23 | |||||||
24 | 1 | 50 | 26 | $self->{__str2} = ' ' |
|||
25 | . "$p2 $fn2" . (defined $t2 ? " " . localtime $t2 : '') . ''; | ||||||
26 | } | ||||||
27 | else | ||||||
28 | 10 | 35 | { $self->{__str1} = $self->{__str2} = ' '; |
||||
29 | } | ||||||
30 | 11 | 35 | return ''; | ||||
31 | } | ||||||
32 | |||||||
33 | sub hunk_header { | ||||||
34 | 55 | 55 | 0 | 69 | my $self = shift; | ||
35 | 55 | 102 | $self->{__str1} .= ''; | ||||
36 | 55 | 86 | $self->{__str2} .= ''; | ||||
37 | 55 | 139 | return ''; | ||||
38 | } | ||||||
39 | sub hunk_footer { | ||||||
40 | 55 | 55 | 0 | 62 | my $self = shift; | ||
41 | 55 | 84 | $self->{__str1} .= ''; | ||||
42 | 55 | 78 | $self->{__str2} .= ''; | ||||
43 | 55 | 136 | return ''; | ||||
44 | } | ||||||
45 | |||||||
46 | sub file_footer { | ||||||
47 | 11 | 11 | 0 | 14 | my $self = shift; | ||
48 | 11 | 71 | return $self->{__str1} . "\n" . $self->{__str2} . "\n"; | ||||
49 | } | ||||||
50 | |||||||
51 | sub same_items { | ||||||
52 | 29 | 29 | 0 | 38 | my $self = shift; | ||
53 | 29 | 104 | $self->{__str1} .= encode_entities( join '', @_ ); | ||||
54 | 29 | 349 | $self->{__str2} .= encode_entities( join '', @_ ); | ||||
55 | 29 | 385 | return ''; | ||||
56 | } | ||||||
57 | |||||||
58 | sub delete_items { | ||||||
59 | 26 | 26 | 0 | 29 | my $self = shift; | ||
60 | 26 | 93 | $self->{__str1} .= ' |
||||
61 | 26 | 309 | return ''; | ||||
62 | } | ||||||
63 | |||||||
64 | sub insert_items { | ||||||
65 | 26 | 26 | 0 | 31 | my $self = shift; | ||
66 | 26 | 85 | $self->{__str2} .= '' . encode_entities( join '', @_ ) . ''; | ||||
67 | 26 | 299 | return ''; | ||||
68 | } | ||||||
69 | |||||||
70 | 1; | ||||||
71 | |||||||
72 | __END__ |