From: Steve Hancock Date: Mon, 5 Jun 2023 01:50:54 +0000 (-0700) Subject: fix undef when -dbs applied to script without subs X-Git-Tag: 20230309.03~4 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=7ec00f979b444ff97469de7c7243614769683ed5;p=perltidy.git fix undef when -dbs applied to script without subs --- 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];