Skip to content

[doc] Clarify the scalar_quotes option#171

Open
rwp0 wants to merge 1 commit into
garu:mainfrom
rwp0:patch-1
Open

[doc] Clarify the scalar_quotes option#171
rwp0 wants to merge 1 commit into
garu:mainfrom
rwp0:patch-1

Conversation

@rwp0

@rwp0 rwp0 commented Oct 21, 2022

Copy link
Copy Markdown
Contributor

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

rwp0 commented Oct 24, 2022

Copy link
Copy Markdown
Contributor Author

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

@garu

garu commented Nov 22, 2022

Copy link
Copy Markdown
Owner

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

grr commented Dec 19, 2022

Copy link
Copy Markdown

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