| 1 | package Text::Diff; | ||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||
| 3 | 6 | ▶ | use 5.006; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use Carp qw/ croak confess /; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 7 | 6 | ▶ | use Exporter (); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 8 | 6 | ▶ | use Algorithm::Diff (); | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||
| 10 | 6 | our $VERSION = '1.46'; | |||||||||||||||||||||||||||||||||||
| 11 | 6 | our @ISA = qw/ Exporter /; | |||||||||||||||||||||||||||||||||||
| 12 | 6 | our @EXPORT = qw/ diff /; | |||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||
| 14 | ## Hunks are made of ops. An op is the starting index for each | ||||||||||||||||||||||||||||||||||||
| 15 | ## sequence and the opcode: | ||||||||||||||||||||||||||||||||||||
| 16 | 6 | ▶ | use constant A => 0; # Array index before match/discard | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 17 | 6 | ▶ | use constant B => 1; | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 18 | 6 | ▶ | use constant OPCODE => 2; # "-", " ", "+" | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 19 | 6 | ▶ | use constant FLAG => 3; # What to display if not OPCODE "!" | ||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||
| 21 | 6 | my %internal_styles = ( | |||||||||||||||||||||||||||||||||||
| 22 | Unified => undef, | ||||||||||||||||||||||||||||||||||||
| 23 | Context => undef, | ||||||||||||||||||||||||||||||||||||
| 24 | OldStyle => undef, | ||||||||||||||||||||||||||||||||||||
| 25 | Table => undef, ## "internal", but in another module | ||||||||||||||||||||||||||||||||||||
| 26 | ); | ||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||
| 28 | 32 | ▶ | sub diff { | ||||||||||||||||||||||||||||||||||
|
Subroutine
diff: called CC=36 SCAR=36.6
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||
| 29 | 32 | my @seqs = ( shift, shift ); | |||||||||||||||||||||||||||||||||||
| 30 | 32 | ▶ | my $options = shift || {}; | ||||||||||||||||||||||||||||||||||
|
Condition100%2/2
shift() || {}
MC/DC100%1/1
shift() || {}
shift()
Truth table100%2/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||
| 32 | 32 | for my $i ( 0 .. 1 ) { | |||||||||||||||||||||||||||||||||||
| 33 | 64 | my $seq = $seqs[$i]; | |||||||||||||||||||||||||||||||||||
| 34 | 64 | my $type = ref $seq; | |||||||||||||||||||||||||||||||||||
| 35 | |||||||||||||||||||||||||||||||||||||
| 36 | 64 | ▶ | while ( $type eq "CODE" ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 37 | 4 | $seqs[$i] = $seq = $seq->( $options ); | |||||||||||||||||||||||||||||||||||
| 38 | 4 | $type = ref $seq; | |||||||||||||||||||||||||||||||||||
| 39 | } | ||||||||||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||||||||||
| 41 | 64 | ▶ | my $AorB = !$i ? "A" : "B"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||
| 43 | 64 | ▶ | if ( $type eq "ARRAY" ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 4 branches
| |||||||||||||||||||||||||||||||||||||
| 44 | ## This is most efficient :) | ||||||||||||||||||||||||||||||||||||
| 45 | $options->{"OFFSET_$AorB"} = 0 | ||||||||||||||||||||||||||||||||||||
| 46 | 32 | ▶ | unless defined $options->{"OFFSET_$AorB"}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 47 | } | ||||||||||||||||||||||||||||||||||||
| 48 | elsif ( $type eq "SCALAR" ) { | ||||||||||||||||||||||||||||||||||||
| 49 | 24 | $seqs[$i] = [split( /^/m, $$seq )]; | |||||||||||||||||||||||||||||||||||
| 50 | $options->{"OFFSET_$AorB"} = 1 | ||||||||||||||||||||||||||||||||||||
| 51 | 24 | ▶ | unless defined $options->{"OFFSET_$AorB"}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 52 | } | ||||||||||||||||||||||||||||||||||||
| 53 | elsif ( ! $type ) { | ||||||||||||||||||||||||||||||||||||
| 54 | $options->{"OFFSET_$AorB"} = 1 | ||||||||||||||||||||||||||||||||||||
| 55 | 4 | ▶ | unless defined $options->{"OFFSET_$AorB"}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 56 | $options->{"FILENAME_$AorB"} = $seq | ||||||||||||||||||||||||||||||||||||
| 57 | 4 | ▶ | unless defined $options->{"FILENAME_$AorB"}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 58 | $options->{"MTIME_$AorB"} = (stat($seq))[9] | ||||||||||||||||||||||||||||||||||||
| 59 | 4 | ▶ | unless defined $options->{"MTIME_$AorB"}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||||||||||
| 61 | 4 | local $/ = "\n"; | |||||||||||||||||||||||||||||||||||
| 62 | 4 | ▶ | open F, "<$seq" or croak "$!: $seq"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 63 | 4 | $seqs[$i] = [<F>]; | |||||||||||||||||||||||||||||||||||
| 64 | 4 | close F; | |||||||||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||||||||||
| 66 | } | ||||||||||||||||||||||||||||||||||||
| 67 | ▶ | elsif ( $type eq "GLOB" || UNIVERSAL::isa( $seq, "IO::Handle" ) ) { | |||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$type eq "GLOB" or UNIVERSAL::isa($seq, "IO::Handle")
MC/DC0%0/2
$type eq "GLOB" or UNIVERSAL::isa($seq, "IO::Handle")
$type eq "GLOB"
UNIVERSAL::isa($seq, "IO::Handle")
Truth table33%1/3
A or B
A= $type eq "GLOB"B= UNIVERSAL::isa($seq, "IO::Handle")
| |||||||||||||||||||||||||||||||||||||
| 68 | $options->{"OFFSET_$AorB"} = 1 | ||||||||||||||||||||||||||||||||||||
| 69 | 4 | ▶ | unless defined $options->{"OFFSET_$AorB"}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 70 | 4 | local $/ = "\n"; | |||||||||||||||||||||||||||||||||||
| 71 | 4 | $seqs[$i] = [<$seq>]; | |||||||||||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||||||||||
| 73 | else { | ||||||||||||||||||||||||||||||||||||
| 74 | 0 | confess "Can't handle input of type ", ref; | |||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||||||||||
| 78 | ## Config vars | ||||||||||||||||||||||||||||||||||||
| 79 | 32 | my $output; | |||||||||||||||||||||||||||||||||||
| 80 | 32 | my $output_handler = $options->{OUTPUT}; | |||||||||||||||||||||||||||||||||||
| 81 | 32 | my $type = ref $output_handler ; | |||||||||||||||||||||||||||||||||||
| 82 | 32 | ▶ | if ( ! defined $output_handler ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||
| 83 | 28 | $output = ""; | |||||||||||||||||||||||||||||||||||
| 84 | 28 | ▶ | $output_handler = sub { $output .= shift }; | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||
| 86 | elsif ( $type eq "CODE" ) { | ||||||||||||||||||||||||||||||||||||
| 87 | ## No problems, mate. | ||||||||||||||||||||||||||||||||||||
| 88 | } | ||||||||||||||||||||||||||||||||||||
| 89 | elsif ( $type eq "SCALAR" ) { | ||||||||||||||||||||||||||||||||||||
| 90 | 0 | my $out_ref = $output_handler; | |||||||||||||||||||||||||||||||||||
| 91 | 0 | ▶ | $output_handler = sub { $$out_ref .= shift }; | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||
| 92 | } | ||||||||||||||||||||||||||||||||||||
| 93 | elsif ( $type eq "ARRAY" ) { | ||||||||||||||||||||||||||||||||||||
| 94 | 1 | my $out_ref = $output_handler; | |||||||||||||||||||||||||||||||||||
| 95 | 1 | ▶ | $output_handler = sub { push @$out_ref, shift }; | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||
| 97 | ▶ | elsif ( $type eq "GLOB" || UNIVERSAL::isa $output_handler, "IO::Handle" ) { | |||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$type eq "GLOB" or UNIVERSAL::isa($output_handler, "IO::Handle")
MC/DC0%0/2
$type eq "GLOB" or UNIVERSAL::isa($output_handler, "IO::Handle")
$type eq "GLOB"
UNIVERSAL::isa($output_handler, "IO::Handle")
Truth table66%2/3
A or B
A= $type eq "GLOB"B= UNIVERSAL::isa($output_handler, "IO::Handle")
| |||||||||||||||||||||||||||||||||||||
| 98 | 2 | my $output_handle = $output_handler; | |||||||||||||||||||||||||||||||||||
| 99 | 2 | ▶ | $output_handler = sub { print $output_handle shift }; | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 100 | } | ||||||||||||||||||||||||||||||||||||
| 101 | else { | ||||||||||||||||||||||||||||||||||||
| 102 | 0 | croak "Unrecognized output type: $type"; | |||||||||||||||||||||||||||||||||||
| 103 | } | ||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||
| 105 | 32 | my $style = $options->{STYLE}; | |||||||||||||||||||||||||||||||||||
| 106 | 32 | ▶ | $style = "Unified" unless defined $options->{STYLE}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 107 | 32 | ▶ | $style = "Text::Diff::$style" if exists $internal_styles{$style}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||
| 109 | 32 | ▶ | if ( ! $style->can( "hunk" ) ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 110 | 2 | ▶ | eval "require $style; 1" or die $@; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||
| 113 | 32 | ▶ | $style = $style->new if ! ref $style && $style->can( "new" ); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
not ref $style and $style->can("new")
MC/DC50%1/2
not ref $style and $style->can("new")
not ref $style
$style->can("new")
Truth table66%2/3
not(A) and B
A= not ref $styleB= $style->can("new")
| |||||||||||||||||||||||||||||||||||||
| 114 | |||||||||||||||||||||||||||||||||||||
| 115 | 32 | my $ctx_lines = $options->{CONTEXT}; | |||||||||||||||||||||||||||||||||||
| 116 | 32 | ▶ | $ctx_lines = 3 unless defined $ctx_lines; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 117 | 32 | ▶ | $ctx_lines = 0 if $style->isa( "Text::Diff::OldStyle" ); | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 118 | |||||||||||||||||||||||||||||||||||||
| 119 | my @keygen_args = $options->{KEYGEN_ARGS} | ||||||||||||||||||||||||||||||||||||
| 120 | 32 | ▶ | ? @{$options->{KEYGEN_ARGS}} | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 121 | : (); | ||||||||||||||||||||||||||||||||||||
| 122 | |||||||||||||||||||||||||||||||||||||
| 123 | ## State vars | ||||||||||||||||||||||||||||||||||||
| 124 | 32 | my $diffs = 0; ## Number of discards this hunk | |||||||||||||||||||||||||||||||||||
| 125 | 32 | my $ctx = 0; ## Number of " " (ctx_lines) ops pushed after last diff. | |||||||||||||||||||||||||||||||||||
| 126 | 32 | my @ops; ## ops (" ", +, -) in this hunk | |||||||||||||||||||||||||||||||||||
| 127 | 32 | my $hunks = 0; ## Number of hunks | |||||||||||||||||||||||||||||||||||
| 128 | |||||||||||||||||||||||||||||||||||||
| 129 | 31 | ▶ | my $emit_ops = sub { | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||
| 130 | 31 | ▶ | $output_handler->( $style->file_header( @seqs, $options ) ) | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 131 | unless $hunks++; | ||||||||||||||||||||||||||||||||||||
| 132 | 31 | $output_handler->( $style->hunk_header( @seqs, @_, $options ) ); | |||||||||||||||||||||||||||||||||||
| 133 | 31 | $output_handler->( $style->hunk ( @seqs, @_, $options ) ); | |||||||||||||||||||||||||||||||||||
| 134 | 31 | $output_handler->( $style->hunk_footer( @seqs, @_, $options ) ); | |||||||||||||||||||||||||||||||||||
| 135 | 32 | }; | |||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||
| 137 | ## We keep 2*ctx_lines so that if a diff occurs | ||||||||||||||||||||||||||||||||||||
| 138 | ## at 2*ctx_lines we continue to grow the hunk instead | ||||||||||||||||||||||||||||||||||||
| 139 | ## of emitting diffs and context as we go. We | ||||||||||||||||||||||||||||||||||||
| 140 | ## need to know the total length of both of the two | ||||||||||||||||||||||||||||||||||||
| 141 | ## subsequences so the line count can be printed in the | ||||||||||||||||||||||||||||||||||||
| 142 | ## header. | ||||||||||||||||||||||||||||||||||||
| 143 | 32 | ▶ | my $dis_a = sub {push @ops, [@_[0,1],"-"]; ++$diffs ; $ctx = 0 }; | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 144 | 32 | ▶ | my $dis_b = sub {push @ops, [@_[0,1],"+"]; ++$diffs ; $ctx = 0 }; | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||
| 146 | Algorithm::Diff::traverse_sequences( | ||||||||||||||||||||||||||||||||||||
| 147 | @seqs, | ||||||||||||||||||||||||||||||||||||
| 148 | { | ||||||||||||||||||||||||||||||||||||
| 149 | 118 | ▶ | MATCH => sub { | ||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=16.1
| |||||||||||||||||||||||||||||||||||||
| 150 | 118 | push @ops, [@_[0,1]," "]; | |||||||||||||||||||||||||||||||||||
| 151 | |||||||||||||||||||||||||||||||||||||
| 152 | 118 | ▶ | if ( $diffs && ++$ctx > $ctx_lines * 2 ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$diffs and ++$ctx > $ctx_lines * 2
MC/DC100%2/2
$diffs and ++$ctx > $ctx_lines * 2
$diffs
++$ctx > $ctx_lines * 2
Truth table100%3/3
A and B
A= $diffsB= ++$ctx > $ctx_lines * 2
| |||||||||||||||||||||||||||||||||||||
| 153 | 11 | $emit_ops->( [ splice @ops, 0, $#ops - $ctx_lines ] ); | |||||||||||||||||||||||||||||||||||
| 154 | 11 | $ctx = $diffs = 0; | |||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||
| 157 | ## throw away context lines that aren't needed any more | ||||||||||||||||||||||||||||||||||||
| 158 | 118 | ▶ | shift @ops if ! $diffs && @ops > $ctx_lines; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
not $diffs and @ops > $ctx_lines
MC/DC100%2/2
not $diffs and @ops > $ctx_lines
not $diffs
@ops > $ctx_lines
Truth table100%3/3
not(A) and B
A= not $diffsB= @ops > $ctx_lines
| |||||||||||||||||||||||||||||||||||||
| 159 | }, | ||||||||||||||||||||||||||||||||||||
| 160 | DISCARD_A => $dis_a, | ||||||||||||||||||||||||||||||||||||
| 161 | DISCARD_B => $dis_b, | ||||||||||||||||||||||||||||||||||||
| 162 | }, | ||||||||||||||||||||||||||||||||||||
| 163 | $options->{KEYGEN}, # pass in user arguments for key gen function | ||||||||||||||||||||||||||||||||||||
| 164 | 32 | @keygen_args, | |||||||||||||||||||||||||||||||||||
| 165 | ); | ||||||||||||||||||||||||||||||||||||
| 166 | |||||||||||||||||||||||||||||||||||||
| 167 | 32 | ▶ | if ( $diffs ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 168 | 20 | ▶ | $#ops -= $ctx - $ctx_lines if $ctx > $ctx_lines; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 169 | 20 | $emit_ops->( \@ops ); | |||||||||||||||||||||||||||||||||||
| 170 | } | ||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||
| 172 | 32 | ▶ | $output_handler->( $style->file_footer( @seqs, $options ) ) if $hunks; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||
| 174 | 32 | ▶ | return defined $output ? $output : $hunks; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 175 | } | ||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||
| 177 | 14 | ▶ | sub _header { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_header: called CC=5 SCAR=16.6
| |||||||||||||||||||||||||||||||||||||
| 178 | 14 | my ( $h ) = @_; | |||||||||||||||||||||||||||||||||||
| 179 | 14 | my ( $p1, $fn1, $t1, $p2, $fn2, $t2 ) = @{$h}{ | |||||||||||||||||||||||||||||||||||
| 180 | 14 | "FILENAME_PREFIX_A", | |||||||||||||||||||||||||||||||||||
| 181 | "FILENAME_A", | ||||||||||||||||||||||||||||||||||||
| 182 | "MTIME_A", | ||||||||||||||||||||||||||||||||||||
| 183 | "FILENAME_PREFIX_B", | ||||||||||||||||||||||||||||||||||||
| 184 | "FILENAME_B", | ||||||||||||||||||||||||||||||||||||
| 185 | "MTIME_B" | ||||||||||||||||||||||||||||||||||||
| 186 | }; | ||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||
| 188 | ## remember to change Text::Diff::Table if this logic is tweaked. | ||||||||||||||||||||||||||||||||||||
| 189 | 14 | ▶ | return "" unless defined $fn1 && defined $fn2; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
defined $fn1 and defined $fn2
MC/DC50%1/2
defined $fn1 and defined $fn2
defined $fn1
defined $fn2
Truth table66%2/3
A and B
A= defined $fn1B= defined $fn2
| |||||||||||||||||||||||||||||||||||||
| 190 | |||||||||||||||||||||||||||||||||||||
| 191 | 5 | ▶ | return join( "", | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 192 | $p1, " ", $fn1, defined $t1 ? "\t" . localtime $t1 : (), "\n", | ||||||||||||||||||||||||||||||||||||
| 193 | $p2, " ", $fn2, defined $t2 ? "\t" . localtime $t2 : (), "\n", | ||||||||||||||||||||||||||||||||||||
| 194 | ); | ||||||||||||||||||||||||||||||||||||
| 195 | } | ||||||||||||||||||||||||||||||||||||
| 196 | |||||||||||||||||||||||||||||||||||||
| 197 | ## _range encapsulates the building of, well, ranges. Turns out there are | ||||||||||||||||||||||||||||||||||||
| 198 | ## a few nuances. | ||||||||||||||||||||||||||||||||||||
| 199 | 42 | ▶ | sub _range { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_range: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||
| 200 | 42 | my ( $ops, $a_or_b, $format ) = @_; | |||||||||||||||||||||||||||||||||||
| 201 | |||||||||||||||||||||||||||||||||||||
| 202 | 42 | my $start = $ops->[ 0]->[$a_or_b]; | |||||||||||||||||||||||||||||||||||
| 203 | 42 | my $after = $ops->[-1]->[$a_or_b]; | |||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||
| 205 | ## The sequence indexes in the lines are from *before* the OPCODE is | ||||||||||||||||||||||||||||||||||||
| 206 | ## executed, so we bump the last index up unless the OP indicates | ||||||||||||||||||||||||||||||||||||
| 207 | ## it didn't change. | ||||||||||||||||||||||||||||||||||||
| 208 | 42 | ▶ | ++$after | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 209 | unless $ops->[-1]->[OPCODE] eq ( $a_or_b == A ? "+" : "-" ); | ||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||
| 211 | ## convert from 0..n index to 1..(n+1) line number. The unless modifier | ||||||||||||||||||||||||||||||||||||
| 212 | ## handles diffs with no context, where only one file is affected. In this | ||||||||||||||||||||||||||||||||||||
| 213 | ## case $start == $after indicates an empty range, and the $start must | ||||||||||||||||||||||||||||||||||||
| 214 | ## not be incremented. | ||||||||||||||||||||||||||||||||||||
| 215 | 42 | my $empty_range = $start == $after; | |||||||||||||||||||||||||||||||||||
| 216 | 42 | ▶ | ++$start unless $empty_range; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||
| 218 | return | ||||||||||||||||||||||||||||||||||||
| 219 | 42 | ▶ | $start == $after | ||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
Condition100%3/3
$format eq "unified" and $empty_range
MC/DC100%2/2
$format eq "unified" and $empty_range
$format eq "unified"
$empty_range
Truth table100%3/3
A and B
A= $format eq "unified"B= $empty_range
| |||||||||||||||||||||||||||||||||||||
| 220 | ? $format eq "unified" && $empty_range | ||||||||||||||||||||||||||||||||||||
| 221 | ? "$start,0" | ||||||||||||||||||||||||||||||||||||
| 222 | : $start | ||||||||||||||||||||||||||||||||||||
| 223 | : $format eq "unified" | ||||||||||||||||||||||||||||||||||||
| 224 | ? "$start,".($after-$start+1) | ||||||||||||||||||||||||||||||||||||
| 225 | : "$start,$after"; | ||||||||||||||||||||||||||||||||||||
| 226 | } | ||||||||||||||||||||||||||||||||||||
| 227 | |||||||||||||||||||||||||||||||||||||
| 228 | 115 | ▶ | sub _op_to_line { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_op_to_line: called CC=7 SCAR=19.6
| |||||||||||||||||||||||||||||||||||||
| 229 | 115 | my ( $seqs, $op, $a_or_b, $op_prefixes ) = @_; | |||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||
| 231 | 115 | my $opcode = $op->[OPCODE]; | |||||||||||||||||||||||||||||||||||
| 232 | 115 | ▶ | return () unless defined $op_prefixes->{$opcode}; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 233 | |||||||||||||||||||||||||||||||||||||
| 234 | 103 | ▶ | my $op_sym = defined $op->[FLAG] ? $op->[FLAG] : $opcode; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 235 | 103 | $op_sym = $op_prefixes->{$op_sym}; | |||||||||||||||||||||||||||||||||||
| 236 | 103 | ▶ | return () unless defined $op_sym; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 237 | |||||||||||||||||||||||||||||||||||||
| 238 | 103 | ▶ | $a_or_b = $op->[OPCODE] ne "+" ? 0 : 1 unless defined $a_or_b; | ||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||
| 239 | 103 | my @line = ( $op_sym, $seqs->[$a_or_b][$op->[$a_or_b]] ); | |||||||||||||||||||||||||||||||||||
| 240 | 103 | ▶ | unless ( $line[1] =~ /(?:\n|\r\n)$/ ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 241 | 0 | $line[1] .= "\n\\ No newline at end of file\n"; | |||||||||||||||||||||||||||||||||||
| 242 | } | ||||||||||||||||||||||||||||||||||||
| 243 | 103 | return @line; | |||||||||||||||||||||||||||||||||||
| 244 | } | ||||||||||||||||||||||||||||||||||||
| 245 | |||||||||||||||||||||||||||||||||||||
| 246 | SCOPE: { | ||||||||||||||||||||||||||||||||||||
| 247 | package Text::Diff::Base; | ||||||||||||||||||||||||||||||||||||
| 248 | |||||||||||||||||||||||||||||||||||||
| 249 | 23 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=8.1
| |||||||||||||||||||||||||||||||||||||
| 250 | 23 | my $proto = shift; | |||||||||||||||||||||||||||||||||||
| 251 | 23 | ▶ | return bless { @_ }, ref $proto || $proto; | ||||||||||||||||||||||||||||||||||
|
Condition33%1/3
ref $proto || $proto
MC/DC0%0/2
ref $proto || $proto
ref $proto
$proto
Truth table33%1/3
A || B
A= ref $protoB= $proto
| |||||||||||||||||||||||||||||||||||||
| 252 | } | ||||||||||||||||||||||||||||||||||||
| 253 | |||||||||||||||||||||||||||||||||||||
| 254 | 9 | ▶ | sub file_header { return "" } | ||||||||||||||||||||||||||||||||||
|
Subroutine
file_header: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 255 | |||||||||||||||||||||||||||||||||||||
| 256 | 8 | ▶ | sub hunk_header { return "" } | ||||||||||||||||||||||||||||||||||
|
Subroutine
hunk_header: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 257 | |||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | sub hunk { return "" } | ||||||||||||||||||||||||||||||||||
|
Subroutine
hunk: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||
| 259 | |||||||||||||||||||||||||||||||||||||
| 260 | 29 | ▶ | sub hunk_footer { return "" } | ||||||||||||||||||||||||||||||||||
|
Subroutine
hunk_footer: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 261 | |||||||||||||||||||||||||||||||||||||
| 262 | 15 | ▶ | sub file_footer { return "" } | ||||||||||||||||||||||||||||||||||
|
Subroutine
file_footer: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||
| 265 | 6 | @Text::Diff::Unified::ISA = qw( Text::Diff::Base ); | |||||||||||||||||||||||||||||||||||
| 266 | |||||||||||||||||||||||||||||||||||||
| 267 | 12 | ▶ | sub Text::Diff::Unified::file_header { | ||||||||||||||||||||||||||||||||||
|
Subroutine
file_header: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 268 | 12 | shift; ## No instance data | |||||||||||||||||||||||||||||||||||
| 269 | 12 | my $options = pop ; | |||||||||||||||||||||||||||||||||||
| 270 | |||||||||||||||||||||||||||||||||||||
| 271 | 12 | _header( | |||||||||||||||||||||||||||||||||||
| 272 | { FILENAME_PREFIX_A => "---", FILENAME_PREFIX_B => "+++", %$options } | ||||||||||||||||||||||||||||||||||||
| 273 | ); | ||||||||||||||||||||||||||||||||||||
| 274 | } | ||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||
| 276 | 14 | ▶ | sub Text::Diff::Unified::hunk_header { | ||||||||||||||||||||||||||||||||||
|
Subroutine
hunk_header: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 277 | 14 | shift; ## No instance data | |||||||||||||||||||||||||||||||||||
| 278 | 14 | pop; ## Ignore options | |||||||||||||||||||||||||||||||||||
| 279 | 14 | my $ops = pop; | |||||||||||||||||||||||||||||||||||
| 280 | |||||||||||||||||||||||||||||||||||||
| 281 | 14 | return join( "", | |||||||||||||||||||||||||||||||||||
| 282 | "@@ -", | ||||||||||||||||||||||||||||||||||||
| 283 | _range( $ops, A, "unified" ), | ||||||||||||||||||||||||||||||||||||
| 284 | " +", | ||||||||||||||||||||||||||||||||||||
| 285 | _range( $ops, B, "unified" ), | ||||||||||||||||||||||||||||||||||||
| 286 | " @@\n", | ||||||||||||||||||||||||||||||||||||
| 287 | ); | ||||||||||||||||||||||||||||||||||||
| 288 | } | ||||||||||||||||||||||||||||||||||||
| 289 | |||||||||||||||||||||||||||||||||||||
| 290 | 14 | ▶ | sub Text::Diff::Unified::hunk { | ||||||||||||||||||||||||||||||||||
|
Subroutine
hunk: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 291 | 14 | shift; ## No instance data | |||||||||||||||||||||||||||||||||||
| 292 | 14 | pop; ## Ignore options | |||||||||||||||||||||||||||||||||||
| 293 | 14 | my $ops = pop; | |||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||
| 295 | 14 | my $prefixes = { "+" => "+", " " => " ", "-" => "-" }; | |||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||
| 297 | 14 | return join "", map _op_to_line( \@_, $_, undef, $prefixes ), @$ops | |||||||||||||||||||||||||||||||||||
| 298 | } | ||||||||||||||||||||||||||||||||||||
| 299 | |||||||||||||||||||||||||||||||||||||
| 300 | 6 | @Text::Diff::Context::ISA = qw( Text::Diff::Base ); | |||||||||||||||||||||||||||||||||||
| 301 | |||||||||||||||||||||||||||||||||||||
| 302 | 2 | ▶ | sub Text::Diff::Context::file_header { | ||||||||||||||||||||||||||||||||||
|
Subroutine
file_header: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 303 | 2 | _header { FILENAME_PREFIX_A=>"***", FILENAME_PREFIX_B=>"---", %{$_[-1]} }; | |||||||||||||||||||||||||||||||||||
| 304 | } | ||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||
| 306 | 4 | ▶ | sub Text::Diff::Context::hunk_header { | ||||||||||||||||||||||||||||||||||
|
Subroutine
hunk_header: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 307 | 4 | return "***************\n"; | |||||||||||||||||||||||||||||||||||
| 308 | } | ||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||
| 310 | 4 | ▶ | sub Text::Diff::Context::hunk { | ||||||||||||||||||||||||||||||||||
|
Subroutine
hunk: called CC=8 SCAR=20.8
| |||||||||||||||||||||||||||||||||||||
| 311 | 4 | shift; ## No instance data | |||||||||||||||||||||||||||||||||||
| 312 | 4 | pop; ## Ignore options | |||||||||||||||||||||||||||||||||||
| 313 | 4 | my $ops = pop; | |||||||||||||||||||||||||||||||||||
| 314 | ## Leave the sequences in @_[0,1] | ||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||
| 316 | 4 | my $a_range = _range( $ops, A, "" ); | |||||||||||||||||||||||||||||||||||
| 317 | 4 | my $b_range = _range( $ops, B, "" ); | |||||||||||||||||||||||||||||||||||
| 318 | |||||||||||||||||||||||||||||||||||||
| 319 | ## Sigh. Gotta make sure that differences that aren't adds/deletions | ||||||||||||||||||||||||||||||||||||
| 320 | ## get prefixed with "!", and that the old opcodes are removed. | ||||||||||||||||||||||||||||||||||||
| 321 | 4 | my $after; | |||||||||||||||||||||||||||||||||||
| 322 | 4 | ▶ | for ( my $start = 0; $start <= $#$ops ; $start = $after ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 323 | ## Scan until next difference | ||||||||||||||||||||||||||||||||||||
| 324 | 17 | $after = $start + 1; | |||||||||||||||||||||||||||||||||||
| 325 | 17 | my $opcode = $ops->[$start]->[OPCODE]; | |||||||||||||||||||||||||||||||||||
| 326 | 17 | ▶ | next if $opcode eq " "; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||
| 328 | 6 | my $bang_it; | |||||||||||||||||||||||||||||||||||
| 329 | 6 | ▶ | while ( $after <= $#$ops && $ops->[$after]->[OPCODE] ne " " ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
$after <= $ops->$#* and $ops->[$after][2] ne " "
MC/DC100%2/2
$after <= $ops->$#* and $ops->[$after][2] ne " "
$after <= $ops->$#*
$ops->[$after][2] ne " "
Truth table100%3/3
A and B
A= $after <= $ops->$#*B= $ops->[$after][2] ne " "
| |||||||||||||||||||||||||||||||||||||
| 330 | 2 | ▶ | $bang_it ||= $ops->[$after]->[OPCODE] ne $opcode; | ||||||||||||||||||||||||||||||||||
|
Condition33%1/3
$bang_it ||= $ops->[$after][2] ne $opcode
MC/DC0%0/2
$bang_it ||= $ops->[$after][2] ne $opcode
$bang_it
$ops->[$after][2] ne $opcode
Truth table33%1/3
A ||= B
A= $bang_itB= $ops->[$after][2] ne $opcode
| |||||||||||||||||||||||||||||||||||||
| 331 | 2 | ++$after; | |||||||||||||||||||||||||||||||||||
| 332 | } | ||||||||||||||||||||||||||||||||||||
| 333 | |||||||||||||||||||||||||||||||||||||
| 334 | 6 | ▶ | if ( $bang_it ) { | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 335 | 2 | for my $i ( $start..($after-1) ) { | |||||||||||||||||||||||||||||||||||
| 336 | 4 | $ops->[$i]->[FLAG] = "!"; | |||||||||||||||||||||||||||||||||||
| 337 | } | ||||||||||||||||||||||||||||||||||||
| 338 | } | ||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||
| 341 | 4 | my $b_prefixes = { "+" => "+ ", " " => " ", "-" => undef, "!" => "! " }; | |||||||||||||||||||||||||||||||||||
| 342 | 4 | my $a_prefixes = { "+" => undef, " " => " ", "-" => "- ", "!" => "! " }; | |||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||
| 344 | 4 | return join( "", | |||||||||||||||||||||||||||||||||||
| 345 | "*** ", $a_range, " ****\n", | ||||||||||||||||||||||||||||||||||||
| 346 | map( _op_to_line( \@_, $_, A, $a_prefixes ), @$ops ), | ||||||||||||||||||||||||||||||||||||
| 347 | "--- ", $b_range, " ----\n", | ||||||||||||||||||||||||||||||||||||
| 348 | map( _op_to_line( \@_, $_, B, $b_prefixes ), @$ops ), | ||||||||||||||||||||||||||||||||||||
| 349 | ); | ||||||||||||||||||||||||||||||||||||
| 350 | } | ||||||||||||||||||||||||||||||||||||
| 351 | |||||||||||||||||||||||||||||||||||||
| 352 | 6 | @Text::Diff::OldStyle::ISA = qw( Text::Diff::Base ); | |||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||
| 354 | 6 | ▶ | sub _op { | ||||||||||||||||||||||||||||||||||
|
Subroutine
_op: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||
| 355 | 6 | my $ops = shift; | |||||||||||||||||||||||||||||||||||
| 356 | 6 | my $op = $ops->[0]->[OPCODE]; | |||||||||||||||||||||||||||||||||||
| 357 | 6 | ▶ | $op = "c" if grep $_->[OPCODE] ne $op, @$ops; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 358 | 6 | ▶ | $op = "a" if $op eq "+"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 359 | 6 | ▶ | $op = "d" if $op eq "-"; | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 360 | 6 | return $op; | |||||||||||||||||||||||||||||||||||
| 361 | } | ||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||
| 363 | 3 | ▶ | sub Text::Diff::OldStyle::hunk_header { | ||||||||||||||||||||||||||||||||||
|
Subroutine
hunk_header: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||
| 364 | 3 | shift; ## No instance data | |||||||||||||||||||||||||||||||||||
| 365 | 3 | pop; ## ignore options | |||||||||||||||||||||||||||||||||||
| 366 | 3 | my $ops = pop; | |||||||||||||||||||||||||||||||||||
| 367 | |||||||||||||||||||||||||||||||||||||
| 368 | 3 | my $op = _op $ops; | |||||||||||||||||||||||||||||||||||
| 369 | |||||||||||||||||||||||||||||||||||||
| 370 | 3 | return join "", _range( $ops, A, "" ), $op, _range( $ops, B, "" ), "\n"; | |||||||||||||||||||||||||||||||||||
| 371 | } | ||||||||||||||||||||||||||||||||||||
| 372 | |||||||||||||||||||||||||||||||||||||
| 373 | 3 | ▶ | sub Text::Diff::OldStyle::hunk { | ||||||||||||||||||||||||||||||||||
|
Subroutine
hunk: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||
| 374 | 3 | shift; ## No instance data | |||||||||||||||||||||||||||||||||||
| 375 | 3 | pop; ## ignore options | |||||||||||||||||||||||||||||||||||
| 376 | 3 | my $ops = pop; | |||||||||||||||||||||||||||||||||||
| 377 | ## Leave the sequences in @_[0,1] | ||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||
| 379 | 3 | my $a_prefixes = { "+" => undef, " " => undef, "-" => "< " }; | |||||||||||||||||||||||||||||||||||
| 380 | 3 | my $b_prefixes = { "+" => "> ", " " => undef, "-" => undef }; | |||||||||||||||||||||||||||||||||||
| 381 | |||||||||||||||||||||||||||||||||||||
| 382 | 3 | my $op = _op $ops; | |||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||
| 384 | 3 | ▶ | return join( "", | ||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||
| 385 | map( _op_to_line( \@_, $_, A, $a_prefixes ), @$ops ), | ||||||||||||||||||||||||||||||||||||
| 386 | $op eq "c" ? "---\n" : (), | ||||||||||||||||||||||||||||||||||||
| 387 | map( _op_to_line( \@_, $_, B, $b_prefixes ), @$ops ), | ||||||||||||||||||||||||||||||||||||
| 388 | ); | ||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||
| 391 | 6 | 1; | |||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||
| 393 | __END__ | ||||||||||||||||||||||||||||||||||||