]> git.donarmstrong.com Git - perltidy.git/commitdiff
fix undef when -dbs applied to script without subs
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 5 Jun 2023 01:50:54 +0000 (18:50 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 5 Jun 2023 01:50:54 +0000 (18:50 -0700)
CHANGES.md
lib/Perl/Tidy/Formatter.pm

index 8ac10a644d518e056827aeea282f28e65c27a9be..42c536c9d2820a4d64059b1f6f91ee19a7f3dc4c 100644 (file)
       -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
index f94790ab8e5bc670ad4e179d7e9a126c4263221f..ec1fa502b791e316a5519b4a06941f16e49e695a 100644 (file)
@@ -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];