You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The title nearly says it all. The two additional points are that I would like also keys to be single-quoted and would prefer that keys/values containing only ASCII alphanumerics and SPACE would be exempt.
The text was updated successfully, but these errors were encountered:
Sorry for the late answer, I have been extremely busy.
There are no options to customize quoting like that yet.
What you can do is to preprocess the structure yourself and create objects that preserve quoting style:
use YAML::PP;
use YAML::PP::Common qw/ PRESERVE_SCALAR_STYLE YAML_SINGLE_QUOTED_SCALAR_STYLE /;
my $yp = YAML::PP->new( preserve => PRESERVE_SCALAR_STYLE );
my $h = $yp->preserved_mapping({}); # We need this to be able to store objects as keys
my $scalar = $yp->preserved_scalar("my special string", style => YAML_SINGLE_QUOTED_SCALAR_STYLE );
$h->{ $scalar } = $scalar;
my $dump = $yp->dump_string($h);
say $dump;
__END__
---
'my special string': 'my special string'
Let me know if this works for you and if you find it useful or not.
The title nearly says it all. The two additional points are that I would like also keys to be single-quoted and would prefer that keys/values containing only ASCII alphanumerics and SPACE would be exempt.
The text was updated successfully, but these errors were encountered: