Subject: | PerlTidy does not understand the new postfix dereferencing |
Using the new dereferencing syntax introduced in 5.20 produces errors in PerlTidy.
The attached badtidy.pl script is syntactically valid and runs (if dev_data.json is a valid jason file).
In addition to the errors reported for the foreach loop, if it is commented perltidy will change the line my $e = $jdata->[1]->%*; to my $e = $jdata->[1]->% *; seperating the % from the * will cause the script to not run.
Subject: | PerlTidy.output.txt |
PerlTidy: Errors reported by perltidy during last run
=====================================================
9: foreach my $j ( $jdata->@* ) { process_element( $j->%* ); }
--^
found Array where operator expected (previous token underlined)
9: foreach my $j ( $jdata->@* ) { process_element( $j->%* ); }
^
9: foreach my $j ( $jdata->@* ) { process_element( $j->%* ); }
^
9: foreach my $j ( $jdata->@* ) { process_element( $j->%* ); }
^
Found 1 extra '(' between '{' on line 9 and '}' on line 9
The most recent un-matched '(' is on line 9
11: final indentation level: 1
Final nesting depth of '('s is 1
The most recent un-matched '(' is on line 9
9: foreach my $j ( $jdata->@* ) { process_element( $j->%* ); }
^
11: To save a full .LOG file rerun with -g
Subject: | badtidy.pl |
use 5.020;
use experimental qw / autoderef postderef signatures/;
use File::Slurp::Tiny 'read_file';
my $jsonfile = read_file('dev_data.json');
my $jdata = decode_json $jsonfile ;
sub processit ( %hashthing ) { 1; }
foreach my $j ( $jdata->@* ) { processit( $j->%* ); }
my $e = $jdata->[1]->%* ;