Data-Printer icon indicating copy to clipboard operation
Data-Printer copied to clipboard

[doc] Clarify the scalar_quotes option

Open rwp0 opened this issue 3 years ago • 3 comments

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 avatar Oct 21 '22 09:10 rwp0

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

rwp0 avatar Oct 24 '22 07:10 rwp0

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.

garu avatar Nov 22 '22 02:11 garu

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.

grr avatar Dec 19 '22 15:12 grr