data-dump
data-dump copied to clipboard
Configurable newline character (take 2)
This is the continuation of issue #2.
I've sorted out the issues previously mentioned.
- Comment '# tied Class' now not shown in single-line dumps.
- Tests added for comment (in NL.t) and tied (in tied.t).
- As for proper spacing/indenting in refcnt and require cases, we just need to set $NL to ' ' (single space) and $INDENT to '' (empty string). This is already documented.
I examined your patch today. I didn't much like the fact that you now recommend setting $NL to a space together with $INDENT the empty string. These variables now seem too much connected. This also breaks formatting of hashes for the case where keys are indented (extra space show up after hash keys).
My suggestion now is that simply setting $INDENT to "" should have the effect of suppressing newlines in the dumped output. See my oneline branch.
If somebody really has a need for the old $INDENT = "" behaviour they would then have to run s/^\s+//gm on the dumped output.
I personally don't think they're much interconnected, except the fact that for a proper single-line dump we need to set both of them. $NL is simply the newline string (what you would print for newline). And $INDENT is the simply the indentation string. But I agree that asking Data::Dump for a single-line dump should probably be done with a single setting (a la $Data::Dumper::Indent).
Hi!
I have released Data-Dump 1.25 which includes a $LINEWIDTH variable. You can set it to a very big number to avoid linebreaks entirely (except, of course, for the times where Data::Dump will enforce a linebreak for other reasons).
Hopefully that fixes the issue. Otherwise, please file an issue on https://github.com/garu/data-dump/issues