If formatted in this way, the program will not run (at least with recent versions of perl) because the $x is taken to be a filehandle and / is assumed to start a quote. In a complex program, there might happen to be a / which terminates the multiline quote without a syntax error, allowing the program to run, but not as intended.
-Related issues arise with other binary operator symbols, such as + and -, and in older versions of perl there could be problems with ternary operators. So to avoid changing program behavior, perltidy has the simple rule that whitespace around possible filehandles is left unchanged. Likewise, whitespace around barewords is left unchanged. The reason is that if the barewords are defined in other modules, or in code that has not even been written yet, perltidy will not have seen their prototypes and must treat them cautiously.
+Related issues arise with other binary operator symbols, such as + and -, and in older versions of perl there could be problems with ternary operators. So to avoid changing program behavior, perltidy has the simple rule that whitespace around possible filehandles is left unchanged. Likewise, whitespace around unknown barewords is left unchanged. The reason is that if the barewords are defined in other modules, or in code that has not even been written yet, perltidy will not have seen their prototypes and must treat them cautiously.
In perltidy this is implemented in the tokenizer by marking token following a
B<print> keyword as a special type B<Z>. When formatting is being done,
--want-trailing-commas='h'
--delete-trailing-commas
+==> b1481.in <==
+$hr
+ ->set_uri_schemes
+ ([
+ 'http','https',
+ undef,'ftp'
+ ]);
+$hr->set_uri_schemes([
+ 'http','https',
+ undef,'ftp'
+] );
+
+
+==> b1481.par <==
+--maximum-line-length=22
+--indent-columns=1
+--continuation-indentation=10
+--weld-nested-containers
+--noadd-whitespace
+--paren-vertical-tightness-closing=1
+--delete-old-whitespace
+--stack-opening-square-bracket
+
==> b148.in <==
# state 1
@yydgoto=(
);
+==> b1481 <==
+$hr->set_uri_schemes([
+ 'http','https',
+ undef,'ftp'
+] );
+$hr->set_uri_schemes([
+ 'http','https',
+ undef,'ftp'
+] );
+
+
==> b156 <==
# State 1
{
});
# S2
-my$cmb=CPAN::Mirrored::By->new({
- continent=>"continent",
- country=>"country",
- http=>"http",
- ftp=>"ftp",
-});
+my$cmb=
+ CPAN::Mirrored::By->new(
+ {
+ continent=>"continent",
+ country=>"country",
+ http=>"http",
+ ftp=>"ftp",
+ }
+ );
==> b753 <==
# S1
my $inner_level = $inner_opening->[_LEVEL_];
if ( $inner_level >= $high_stress_level ) { next }
+ # extra tolerance added under high stress to fix b1481
+ my $stress_tol = ( $high_stress_level - $inner_level <= 1 ) ? 1 : 0;
+
# Set flag saying if this pair starts a new weld
my $starting_new_weld = !( @welds && $outer_seqno == $welds[-1]->[0] );
$is_one_line_weld || $is_multiline_weld
? $single_line_tol
: $multiline_tol;
+ $tol += $stress_tol;
# By how many characters does this exceed the text window?
my $excess =