From 9c3fafb33cbe33b7a4f570fd4dff45e6303a2255 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sun, 5 Feb 2023 07:32:52 -0800 Subject: [PATCH] initialize global var %matching_token in BEGIN block --- lib/Perl/Tidy/Formatter.pm | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index ee11a84f..37d61b28 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -258,6 +258,7 @@ my ( %is_counted_type, %is_opening_sequence_token, %is_closing_sequence_token, + %matching_token, %is_container_label_type, %is_die_confess_croak_warn, %is_my_our_local, @@ -312,7 +313,6 @@ my ( %space_after_keyword, %tightness, - %matching_token, %opening_vertical_tightness, %closing_vertical_tightness, @@ -723,6 +723,18 @@ BEGIN { @q = qw< } ) ] : >; @is_closing_sequence_token{@q} = (1) x scalar(@q); + %matching_token = ( + '{' => '}', + '(' => ')', + '[' => ']', + '?' => ':', + + '}' => '{', + ')' => '(', + ']' => '[', + ':' => '?', + ); + # a hash needed by sub break_lists for labeling containers @q = qw( k => && || ? : . ); @is_container_label_type{@q} = (1) x scalar(@q); @@ -1664,17 +1676,6 @@ EOM '[' => $rOpts->{'square-bracket-tightness'}, ']' => $rOpts->{'square-bracket-tightness'}, ); - %matching_token = ( - '{' => '}', - '(' => ')', - '[' => ']', - '?' => ':', - - '}' => '{', - ')' => '(', - ']' => '[', - ':' => '?', - ); if ( $rOpts->{'ignore-old-breakpoints'} ) { -- 2.39.5