1Text::Diff::Table(3) User Contributed Perl Documentation Text::Diff::Table(3)
2
3
4
6 Text::Diff::Table - Text::Diff plugin to generate "table" format output
7
9 use Text::Diff;
10
11 diff \@a, $b { STYLE => "Table" };
12
14 This is a plugin output formatter for Text::Diff that generates "table"
15 style diffs:
16
17 +--+----------------------------------+--+------------------------------+
18 | |../Test-Differences-0.2/MANIFEST | |../Test-Differences/MANIFEST |
19 | |Thu Dec 13 15:38:49 2001 | |Sat Dec 15 02:09:44 2001 |
20 +--+----------------------------------+--+------------------------------+
21 | | * 1|Changes *
22 | 1|Differences.pm | 2|Differences.pm |
23 | 2|MANIFEST | 3|MANIFEST |
24 | | * 4|MANIFEST.SKIP *
25 | 3|Makefile.PL | 5|Makefile.PL |
26 | | * 6|t/00escape.t *
27 | 4|t/00flatten.t | 7|t/00flatten.t |
28 | 5|t/01text_vs_data.t | 8|t/01text_vs_data.t |
29 | 6|t/10test.t | 9|t/10test.t |
30 +--+----------------------------------+--+------------------------------+
31
32 This format also goes to some pains to highlight "invisible" characters
33 on differing elements by selectively escaping whitespace. Each element
34 is split in to three segments (leading whitespace, body, trailing
35 whitespace). If whitespace differs in a segement, that segment is
36 whitespace escaped.
37
38 Here is an example of the selective whitespace.
39
40 +--+--------------------------+--------------------------+
41 | |demo_ws_A.txt |demo_ws_B.txt |
42 | |Fri Dec 21 08:36:32 2001 |Fri Dec 21 08:36:50 2001 |
43 +--+--------------------------+--------------------------+
44 | 1|identical |identical |
45 * 2| spaced in | also spaced in *
46 * 3|embedded space |embedded tab *
47 | 4|identical |identical |
48 * 5| spaced in |\ttabbed in *
49 * 6|trailing spaces\s\s\n |trailing tabs\t\t\n *
50 | 7|identical |identical |
51 * 8|lf line\n |crlf line\r\n *
52 * 9|embedded ws |embedded\tws *
53 +--+--------------------------+--------------------------+
54
55 Here's why the lines do or do not have whitespace escaped:
56
57 lines 1, 4, 7 don't differ, no need.
58 lines 2, 3 differ in non-whitespace, no need.
59 lines 5, 6, 8, 9 all have subtle ws changes.
60
61 Whether or not line 3 should have that tab character escaped is a
62 judgement call; so far I'm choosing not to.
63
65 To output the raw unicode chracters consult the documentation of
66 Text::Diff::Config. You can set the "DIFF_OUTPUT_UNICODE" environment
67 variable to 1 to output it from the command line. For more information,
68 consult this bug: <https://rt.cpan.org/Ticket/Display.html?id=54214> .
69
71 Table formatting requires buffering the entire diff in memory in order
72 to calculate column widths. This format should only be used for
73 smaller diffs.
74
75 Assumes tab stops every 8 characters, as $DIETY intended.
76
77 Assumes all character codes >= 127 need to be escaped as hex codes, ie
78 that the user's terminal is ASCII, and not even "high bit ASCII",
79 capable. This can be made an option when the need arises.
80
81 Assumes that control codes (character codes 0..31) that don't have
82 slash-letter escapes ("\n", "\r", etc) in Perl are best presented as
83 hex escapes ("\x01") instead of octal ("\001") or control-code ("\cA")
84 escapes.
85
87 Barrie Slaymaker <barries@slaysys.com>
88
90 Copyright 2001 Barrie Slaymaker, All Rights Reserved.
91
92 You may use this software under the terms of the GNU public license,
93 any version, or the Artistic license.
94
95
96
97perl v5.16.3 2011-04-17 Text::Diff::Table(3)