Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the YAML CPAN distribution.

Report information
The Basics
Id: 3015
Status: open
Priority: 0/
Queue: YAML

People
Owner: Nobody in particular
Requestors: simonhf [...] web.de
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.35
Fixed in: (no value)



Subject: wish: folding length option for YAML
YAML.pm, line 557, currently has a folding value of 50 hard-coded. It would be great if this value became an option... for those who prefer not to fold, or fold less.
From: Smylers <smylers [...] cpan.org>
[guest - Wed Jul 23 05:57:17 2003]: Show quoted text
> YAML.pm, line 557, currently has a folding value of 50 hard-coded. > It would be great if this value became an option... for those who > prefer not to fold, or fold less.
I wanted that too. The attached patch adds in the $YAML::FoldLimit config variable to achieve this. I've also got a doc patch which describes this, but 'RT' only has one file-upload field so that'll be in the next comment ... Smylers
--- /usr/local/lib/perl5/site_perl/5.8.2/YAML.pm Tue Jun 25 06:02:09 2002 +++ ./YAML.pm Wed May 25 12:00:20 2005 @@ -55,6 +55,7 @@ $ForceBlock = 0 unless defined $ForceBlock; $UseBlock = 0 unless defined $UseBlock; $UseFold = 0 unless defined $UseFold; + $FoldLimit = 50 unless defined $FoldLimit; $CompressSeries = 1 unless defined $CompressSeries; $InlineSeries = 0 unless defined $InlineSeries; $UseAliases = 1 unless defined $UseAliases; @@ -97,6 +98,7 @@ ForceBlock => $YAML::ForceBlock, UseBlock => $YAML::UseBlock, UseFold => $YAML::UseFold, + FoldLimit => $YAML::FoldLimit, CompressSeries => $YAML::CompressSeries, InlineSeries => $YAML::InlineSeries, UseAliases => $YAML::UseAliases, @@ -554,8 +556,8 @@ if (defined $_[0] and $_[0] !~ /$ESCAPE_CHAR/ and - (length($_[0]) > 50 or $_[0] =~ /\n\s/ or - ($o->{ForceBlock} and $type != KEY) + (($o->{FoldLimit} and length($_[0]) > $o->{FoldLimit}) or + $_[0] =~ /\n\s/ or ($o->{ForceBlock} and $type != KEY) ) ) { $o->{stream} .= ($type == KEY) ? '? ' : ' ';
From: Smylers <smylers [...] cpan.org>
Here's that promised doc patch. Smylers
--- /usr/local/lib/perl5/site_perl/5.8.2/YAML.pod Mon Jun 24 07:52:51 2002 +++ ./YAML.pod Wed May 25 12:07:11 2005 @@ -389,6 +389,14 @@ Force every possible scalar to be block formatted. NOTE: Escape characters cannot be formatted in a block scalar. +=item FoldLimit + +The maximum length a simple string can be without being folded. Defaults to 50. +Note that this doesn't take indentation into account: a string 50 characters +long inside a nested data structure will not fit into a window that's only 50 +characters wide. Set $FoldLimit to 0 to allow strings of arbitrary length to +avoid folding. + =item UseFold If you want to force YAML to use the 'folded' style for all multiline
This issue has been copied to: https://github.com/ingydotnet/yaml-pm/issues/37 please take all future correspondence there. This ticket will remain open but please do not reply here. This ticket will be closed when the github issue is dealt with.