Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Thanks for the reply, 2teez! Apologies that I wasn't clear enough. Say I have the one-liner, which is not what I'm really trying to do and only to demonstrate the behaviors,
perl -MText::Diff -e '$size = 10; @a = sort map { int rand(100) } 1..$ +size; @b = sort map { int rand(100) } 1..$size; print diff \@a, \@b, +{ STYLE => "Table" };'
I don't quite understand how it's supposed to work without the comma after the 2nd item to compare. If you try that in the one-liner, you'll get the error Not a HASH reference at /usr/local/share/perl/5.18.2/Text/Diff.pm line 46. Pressing on anyway, if I run the one-liner with small size which yields many differences and few matching chunks, I do see all the lines as I want to.
+--+----+--+----+
* 0|12  * 0|0   *
* 1|2   * 1|42  *
* 2|24  * 2|43  *
* 3|26  *  |    |
* 4|29  *  |    |
* 5|3   *  |    |
* 6|4   *  |    |
* 7|48  *  |    |
| 8|49  | 3|49  |
* 9|63  * 4|5   *
|  |    * 5|59  *
|  |    * 6|6   *
|  |    * 7|77  *
|  |    * 8|9   *
|  |    * 9|95  *
+--+----+--+----+
However, when you start running with $size=1000 or $size=10000, you'll see breaks in the output where there are large chunks of identical entries in the lists and only the differences and surrounding context is shown. For example,
...
|     |    * 8127|81  *
|     |    * 8128|81  *
| 8157|82  | 8129|82  |
| 8158|82  | 8130|82  |
| 8159|82  | 8131|82  |
+-----+----+-----+----+  <--- lots of identical entries hidden in that break
| 8255|82  | 8227|82  |
| 8256|82  | 8228|82  |
| 8257|82  | 8229|82  |
* 8258|82  *     |    |
* 8259|82  *     |    |
...
For the normal use of diff, hiding the large identical chunks and showing only the differences with context is desirable (arguably, it's the whole point!) But for what I'm working on now, I want to show all of the roughly 6000 lines even if large chunks are identical. I'm hoping there's a way of forcing that behavior or of controlling whatever the chunk break setting is. :)

In reply to Re^2: Text::Diff::Table output, but want to show all lines by Solo
in thread Text::Diff::Table output, but want to show all lines by Solo

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (3)
As of 2024-04-24 19:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found