my $line_proto = $indent.$nl_post;
PART: foreach my $idx (0..$#parts) {
my $p = $parts[$idx];
+#::DwarnT STARTPART => $p, \@res, $line, $line_orig;
my $pre = ($line ne $line_orig ? $join : '');
my $j_part = $pre.(my $j = ref($p) ? $self->_join(@$p) : $p);
if (length($j_part) + length($line) + $join_len <= $w) {
$line .= $j_part;
next PART;
}
+ my $innerdent = @res
+ ? $next_indent
+ : $indent0.$self->indent_by;
if (ref($p) and $p->[1] eq '(' and $p->[-1] eq ')') {
my $already = !($line eq $indent0 or $line eq $line_orig);
- my $innerdent = @res
- ? $next_indent
- : $indent0.$self->indent_by;
push @res, $line.($already ? $join : '').'('."\n";
my (undef, undef, $inner) = @$p;
my $folded = $self->_fold_sql($innerdent, $innerdent, @$inner);
if (length($line = $line_proto.$j) <= $w) {
next PART;
}
- my $innerdent = @res ? $indent : $next_indent;
my $folded = $self->_fold_sql($line_proto, $innerdent, @$p);
$folded =~ s/\n\Z//;
push @res, $folded.($idx == $#parts ? '' : $nl_pre)."\n";
$line_orig = $line = $idx == $#parts ? '' : $line_proto;
+ } continue {
+#::DwarnT ENDPART => $parts[$idx], \@res, $line, $line_orig;
}
return join '', @res, $line;
}