From 7ec00f979b444ff97469de7c7243614769683ed5 Mon Sep 17 00:00:00 2001 From: Steve Hancock Date: Sun, 4 Jun 2023 18:50:54 -0700 Subject: [PATCH] fix undef when -dbs applied to script without subs --- CHANGES.md | 4 ++++ lib/Perl/Tidy/Formatter.pm | 6 +++--- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 8ac10a64..42c536c9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -21,6 +21,10 @@ -cpb and -bfvt=n. These work in version 20230309 but the pod documentation was missing and has been added. + - Fixed an undefined reference message when running with + --dump-block-summary on a file without any subs or other + selected block types. + - Some rare, minor issues with continuation indentation have been fixed. Most scripts will remain unchanged. The main change is that block comments which occur just before a closing brace, bracket or paren diff --git a/lib/Perl/Tidy/Formatter.pm b/lib/Perl/Tidy/Formatter.pm index f94790ab..ec1fa502 100644 --- a/lib/Perl/Tidy/Formatter.pm +++ b/lib/Perl/Tidy/Formatter.pm @@ -6298,13 +6298,14 @@ sub find_selected_packages { my ( $self, $rdump_block_types ) = @_; - # returns a list of all package statements in a file if requested + # returns a list of all selected package statements in a file + my @package_list; unless ( $rdump_block_types->{'*'} || $rdump_block_types->{'package'} || $rdump_block_types->{'class'} ) { - return; + return \@package_list; } my $rLL = $self->[_rLL_]; @@ -6312,7 +6313,6 @@ sub find_selected_packages { my $rlines = $self->[_rlines_]; my $K_closing_container = $self->[_K_closing_container_]; - my @package_list; my @package_sweep; foreach my $KK ( 0 .. $Klimit ) { my $item = $rLL->[$KK]; -- 2.39.5