On Sun Dec 29 06:59:11 2019, nomad@null.net wrote:
Show quoted text> Perl compiles and runs the attached .pm file just fine, but Perl::Tidy
> has an issue on both Cygwin and Linux.
>
Thanks for the bug report.
The parsing problem can be reduced to the following three lines:
sub OptArgs2::STYLE_FULL { 3 }
$style == OptArgs2::STYLE_FULL ? 'FullUsage' : 'NormalUsage',
'usage: ' . $usage . "\n";
What happened is that perltidy doesn't know that OptArgs2::STYLE_FULL is a constant, so it may be looking for args. The ? can either start a ternary or it can start a pattern, so the parser has to guess. It guessed wrong in this case. I will fix this. But here are two workarounds:
Fix 1 (best): declare an empty prototype so perltidy knows there are no args:
sub OptArgs2::STYLE_FULL () { 3 }
$style == OptArgs2::STYLE_FULL ? 'FullUsage' : 'NormalUsage',
'usage: ' . $usage . "\n";
Fix 2: give an empty list call args:
sub OptArgs2::STYLE_FULL { 3 }
$style == OptArgs2::STYLE_FULL() ? 'FullUsage' : 'NormalUsage',
'usage: ' . $usage . "\n";
Steve
~
-- VISUAL LINE -- 17,1 All