+
+ if ($diff) {
+ if (eval { require Text::Diff; 1 }) {
+ $options->{show_diff} = 1;
+ } else {
+ error('Could not load Text::Diff. Sorry, no diffs for you.');
+ }
+ }
+}
+
+sub show_diff {
+ my ($text_a, $text_b) = @_;
+
+ my %colors = (
+ '+' => 'green',
+ '-' => 'red',
+ );
+
+ Text::Diff::diff($text_a, $text_b, { OUTPUT => sub {
+ for (split /\n/, $_[0]) {
+ print colored($_, $colors{substr($_, 0, 1)}), $/;
+ }
+ }});