Hey,
Found the error, or the difference at least.
In Perl::Tidy::Formatter version 20200110, the $SUB_PATTERN is defined in the BEGIN block, at line 441. However, this chunk (434..442) appears to have been removed from the BEGIN block of version 20200619, and is in make_sub_matching_pattern().
Hope this helps!
Smile,
Steve
PS -- to test my theory, I did a backup and modified the file like this:
diff -wu /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm.* /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm
--- /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm.20200807_172243 2020-08-07 17:22:43.190403952 -0700
+++ /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm 2020-08-07 17:23:05.695249002 -0700
@@ -373,6 +373,16 @@
@q = qw< } ) ] >;
@is_closing_token{@q} = (1) x scalar(@q);
+ # Patterns for standardizing matches to block types for regular subs and
+ # anonymous subs. Examples
+ # 'sub process' is a named sub
+ # 'sub ::m' is a named sub
+ # 'sub' is an anonymous sub
+ # 'sub:' is a label, not a sub
+ # 'substr' is a keyword
+ $SUB_PATTERN = '^sub\s+(::|\w)'; # match normal sub
+ $ASUB_PATTERN = '^sub$'; # match anonymous sub
+ $ANYSUB_PATTERN = '^sub\b'; # match either type of sub
}
# whitespace codes
The patched file works correctly. __ Not sure if that is how you would want to do it, but it follows the pattern of the previous verison.
Cheers!
On 07/Aug/20, 8:04 PM, "Bugs in Perl-Tidy via RT" <bug-Perl-Tidy@rt.cpan.org> wrote:
Greetings,
This message has been automatically generated in response to the
creation of a trouble ticket regarding:
"Bug in latest version, 20200619",
a summary of which appears below.
There is no need to reply to this message right now. Your ticket has been
assigned an ID of [rt.cpan.org #133130]. Your ticket is accessible
on the web at:
https://nam05.safelinks.protection.outlook.com/?url=https%3A%2F%2Frt.cpan.org%2FTicket%2FDisplay.html%3Fid%3D133130&data=02%7C01%7CShriverSteve%40prahs.com%7C4418817a29a2414b5b2e08d83b2ea283%7C1cef9a5962ec418a96662b3afc2d2cb0%7C0%7C1%7C637324418772547135&sdata=afJc6xAOxrZrQrw%2FvnNImfHIuTBUXoS%2BYBuUMHeJCnM%3D&reserved=0
Please include the string:
[rt.cpan.org #133130]
in the subject line of all future correspondence about this issue. To do so,
you may reply to this message.
Thank you,
bug-Perl-Tidy@rt.cpan.org
-------------------------------------------------------------------------
Greetings,
Using the latest version available from CPAN
cpanm --local-lib=~/perl5 Perl::Tidy
--> Working on Perl::Tidy
Fetching
https://nam05.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.cpan.org%2Fauthors%2Fid%2FS%2FSH%2FSHANCOCK%2FPerl-Tidy-20200619.tar.gz&data=02%7C01%7CShriverSteve%40prahs.com%7C4418817a29a2414b5b2e08d83b2ea283%7C1cef9a5962ec418a96662b3afc2d2cb0%7C0%7C1%7C637324418772547135&sdata=euwqjNv6ySZmsnW1M3IxK%2FIPKWkWIPR3Hbg6L%2BXcPM8%3D&reserved=0 ... OK
Configuring Perl-Tidy-20200619 ... OK
Building and testing Perl-Tidy-20200619 ... OK
Successfully installed Perl-Tidy-20200619 (upgraded from 20191203)
1 distribution installed
Making sure to run the new version:
~/perl5/bin/perltidy --version
This is perltidy, v20200619
I run the command against a file and get the following error:
~/perl5/bin/perltidy -b -bext="/" -log -pro=.../perltidyrc load_data
Use of uninitialized value $Perl::Tidy::Formatter::SUB_PATTERN in concatenation (.) or string at /home/shriversteve/perl5/lib/perl5/Perl/Tidy/Formatter.pm line 6581.
However, the previous version of perltidy works,
/opt/prism/perl5/perlbrew/perls/current/bin/perltidy --version
This is perltidy, v20191203
/opt/prism/perl5/perlbrew/perls/current/bin/perltidy -b -bext='/' -log -pro=.../perltidyrc load_data
ls -lart load*
-rw-r--r-- 1 shriversteve domain users 1.6K Aug 7 16:20 load_data.LOG
-rwxr-xr-x 1 shriversteve domain users 5.9K Aug 7 16:20 load_data*
I have not defined sub-alias-list in my perltidyrc file. Do you need to see my config file?
(reading the module)
Just guessing, but is it possible that make_block_pattern() (where the error occurs) is getting called before make_sub_matching_pattern()? (read the file more) Well, in check_options(), make_closing_side_comment_list_pattern() is called earlier. Dunno, just a thought.
Hope this helps.
Smile,
Steve