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

[doc] Clarify the scalar_quotes option #171

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

rwp0
Copy link
Contributor

@rwp0 rwp0 commented Oct 21, 2022

Quoting of strings can be disabled as follows in .dataprinter (or similarly in code)

scalar_quotes = 0

See also:
https://metacpan.org/pod/Data::Printer::Object#quote_keys

Quoting of strings can be disabled as follows in `.dataprinter` (or similarly in code)

```
scalar_quotes = 0
```

See also:
https://metacpan.org/pod/Data::Printer::Object#quote_keys
@rwp0
Copy link
Contributor Author

rwp0 commented Oct 24, 2022

Setting to 0 also shows ASCII color escapes which can be annoying

@garu
Copy link
Owner

garu commented Nov 22, 2022

Hi! Thank you for taking the time to file this issue and provide a doc fix. The reason you're seeing ASCII color escapes is because when you say 'scalar_quotes => 0' you are not disabling quotes, you're turning them into "0", and adding a "0" to the start and end of a terminal color escape makes everything go crazy (this is a bug btw, thank you for spotting it!).

Right now, the proper way to disable quoting of scalar values is to make it undef or, in case of .dataprinter, setting it to the empty string:

    p $val, scalar_quotes => undef;

or, in .dataprinter:

    scalar_quotes = ' '

(note there is a space between single quotes above, because setting it to '' without a space in the rc file is also misbehaving. Another bug you spotted - thank you!)

I'm working on a fix right now and will update here as soon as it's done.

@grr
Copy link

grr commented Dec 19, 2022

Right now, the proper way to disable quoting of scalar values is to make it undef or, in case of .dataprinter, setting it to the empty string:

there's a similar bug with quote_keys. setting it via .dataprinter, only auto is recognized; any other values is interpreted as true. the only way to disable is to set it to undef when calling p.

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.

3 participants