Perl-Tidy

 view release on metacpan or  search on metacpan

docs/BugLog.html  view on Meta::CPAN


</dd>
<dt id="Fix-edge-case-of-formatting-instability-b1189"><b>Fix edge case of formatting instability, b1189</b>.</dt>
<dd>

<p>Testing with random parameters produced a case of unstable formatting involving welding with parameter -notrim-qw. The problem was that the -notrim-qw flag converts a qw quote into a quote with fixed leading whitespace. The lines of these types of...

<p>For example, in the following snippet the terminal &#39;}&#39; is alone on a line:</p>

<pre><code>is eval(q{
    $[ = 3;
    BEGIN { my $x = &quot;foo\x{666}&quot;; $x =~ /foo\p{Alnum}/; }
    $t[3];
}
), &quot;a&quot;;</code></pre>

<p># In the previous version this was half-welded: # OLD: perltidy -wn -sil=0</p>

<pre><code>is eval( q{
    $[ = 3;
    BEGIN { my $x = &quot;foo\x{666}&quot;; $x =~ /foo\p{Alnum}/; }
    $t[3];
}
  ),
  &quot;a&quot;;</code></pre>

<p>The new check avoids welding in this case, giving</p>

<pre><code># NEW: perltidy -wn -sil=0
is eval(
    q{
    $[ = 3;
    BEGIN { my $x = &quot;foo\x{666}&quot;; $x =~ /foo\p{Alnum}/; }
    $t[3];
}
  ),
  &quot;a&quot;;</code></pre>

<p>Welding can still be done if the opening and closing container tokens have other code. For example, welding can be done for the following snippet:</p>

<pre><code>is eval(q{
    $[ = 3;
    BEGIN { my $x = &quot;foo\x{666}&quot;; $x =~ /foo\p{Alnum}/; }
    $t[3];
}), &quot;a&quot;;</code></pre>

<p>And welding can still be done on all qw quotes unless the -notrim-qw flag is set.</p>

<p>This fixes case b1189.</p>

<p>7 Aug 2021, e9c25f2.</p>



( run in 5.941 seconds using v1.01-cache-2.11-cpan-744e820c463 )