Text::DiffU - Diff two sequences and print unified-style output
This document describes version 0.002 of Text::DiffU (from Perl distribution Text-DiffU), released on 2018-04-03.
Usage:
diff_u(%args) -> any
Diff two sequences and print unified-style output.
This function is not exported.
Arguments ('*' denotes required arguments):
ctx => uint (default: 3)
hook_format_diff_items => code
Hook will be called with these arguments:
(\@items1, \@items2)
The default hook will print this, i.e. items1 as lines where each line is prefixed by a - (minus) sign, followed by items2 as lines where each line is prefixed by a + (plus) sign:
-
+
-line1_from_items1 -line2_from_items1 ... +line1_from_items2 +line2_from_items2 ...
hook_format_hunk_header => code
($line1_start, $line2_start, $num_lines1, $num_lines2)
The default hook will print this:
@@ -<line1_start>,<num_lines1> +<line2_start>,<num_lines2> @@
hook_format_same_items => code
(\@items)
The default hook will print this (i.e. items as lines where each line is prefixed by a single space):
line1 line2 ...
hook_format_seq_header => code
($seq1_name, $seq2_name)
seq1* => array
seq1_name => str (default: "(seq1)")
seq2* => array
seq2_name => str (default: "(seq2)")
use_color => bool
Whether the default hooks should print ANSI color escape sequences.
The default is to use setting from COLOR environment variable, or check if program is run interactively.
COLOR
Return value: (any)
Please visit the project's homepage at https://metacpan.org/release/Text-DiffU.
Source repository is at https://github.com/perlancar/perl-Text-DiffU.
Please report any bugs or feature requests on the bugtracker website https://rt.cpan.org/Public/Dist/Display.html?Name=Text-DiffU
When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.
Text::Diff. Generally Text::Diff should be your go-to module if you want to produce diff ouput. The diff_u routine specifically produces unified-style output with hooks to be able to customize the output.
diff_u
perlancar <perlancar@cpan.org>
This software is copyright (c) 2018 by perlancar@cpan.org.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Text::DiffU, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Text::DiffU
CPAN shell
perl -MCPAN -e shell install Text::DiffU
For more information on module installation, please visit the detailed CPAN module installation guide.