scan_identifier();
}
- last if ($id_scan_state);
+ if ($id_scan_state) {
+
+ # Still scanning ...
+ # Check for side comment between sub and prototype (c061)
+
+ # done if nothing left to scan on this line
+ last if ( $i > $max_token_index );
+
+ my ( $next_nonblank_token, $i_next ) =
+ find_next_nonblank_token_on_this_line( $i, $rtokens,
+ $max_token_index );
+
+ # done if it was just some trailing space
+ last if ( $i_next > $max_token_index );
+
+ # something remains on the line ... must be a side comment
+ next;
+ }
+
next if ( ( $i > 0 ) || $type );
# didn't find any token; start over
=over 4
+=item B<Correct parsing error, case c061>
+
+Testing with random input produced an error condition involving a
+side comment placed between a sub name and prototype, as in the
+following snippet:
+
+ sub
+ witch # sc
+ () # prototype may be on new line ...
+ { print "which?\n" }
+ witch();
+
+The current version of perltidy makes an error:
+
+ # OLD: perltidy
+ sub witch # sc () # prototype may be on new line ...
+ { print "which?\n" }
+ witch();
+
+This update corrects the problem:
+
+ # NEW: perltidy
+ sub witch # sc
+ () # prototype may be on new line ...
+ { print "which?\n" }
+ witch();
+
+This fixes case c061;
+
+18 Aug 2021.
+
=item B<Improved line break, case c060>
The default formatting produced an undesirable line break at the last '&&' term