Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configurable newline character (take 2) #3

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

perlancar
Copy link

This is the continuation of issue #2.

I've sorted out the issues previously mentioned.

  1. Comment '# tied Class' now not shown in single-line dumps.
  2. Tests added for comment (in NL.t) and tied (in tied.t).
  3. 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.

@gisle
Copy link
Owner

gisle commented Mar 4, 2012

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.

@perlancar
Copy link
Author

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).

@garu
Copy link

garu commented Jun 26, 2021

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants