From: Matt S Trout Date: Wed, 9 Oct 2019 01:38:31 +0000 (+0000) Subject: picked the wrong regexp escape X-Git-Tag: v1.90_01~5 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2f34721312623730be284f31818825b45f072c70;p=dbsrgits%2FSQL-Abstract.git picked the wrong regexp escape --- diff --git a/lib/SQL/Abstract/Formatter.pm b/lib/SQL/Abstract/Formatter.pm index 0f0daf3..cd7eef8 100644 --- a/lib/SQL/Abstract/Formatter.pm +++ b/lib/SQL/Abstract/Formatter.pm @@ -30,8 +30,8 @@ sub _fold_sql { my @res; my $w = $self->max_width; my $join_len = 0; - (s/, \Z/,\n/ and $join_len = 1) - or s/\A /\n/ + (s/, \z/,\n/ and $join_len = 1) + or s/\a /\n/ or $_ = "\n" for my $line_join = $join; my ($nl_pre, $nl_post) = split "\n", $line_join; @@ -55,7 +55,7 @@ sub _fold_sql { push @res, $line.($already ? $join : '').'('."\n"; my (undef, undef, $inner) = @$p; my $folded = $self->_fold_sql($innerdent, $innerdent, @$inner); - $folded =~ s/\n\Z//; + $folded =~ s/\n\z//; push @res, $folded."\n"; $line_orig = $line = $indent0.')'.($idx == $#parts ? '' : $join); @@ -68,7 +68,7 @@ sub _fold_sql { next PART; } my $folded = $self->_fold_sql($line_proto, $innerdent, @$p); - $folded =~ s/\n\Z//; + $folded =~ s/\n\z//; push @res, $folded.($idx == $#parts ? '' : $nl_pre)."\n"; $line_orig = $line = $idx == $#parts ? '' : $line_proto; } continue {