]> git.donarmstrong.com Git - perltidy.git/commitdiff
Added DESTROY subs to avoid AUTOLOAD calls in some versions of perl
authorSteve Hancock <perltidy@users.sourceforge.net>
Mon, 7 Sep 2020 01:21:41 +0000 (18:21 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Mon, 7 Sep 2020 01:21:41 +0000 (18:21 -0700)
lib/Perl/Tidy.pm
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/HtmlWriter.pm
lib/Perl/Tidy/VerticalAligner.pm

index 7db691aa9ad9922f947c7f01b3abc6f3f5f53abc..8a9958704ddcb181083d0f85de52b6664d8f7968 100644 (file)
@@ -113,6 +113,10 @@ BEGIN {
     $VERSION = '20200907';
 }
 
+sub DESTROY {
+    # required to avoid call to AUTOLOAD in some versions of perl
+}
+
 sub AUTOLOAD {
 
     # Catch any undefined sub calls so that we are sure to get
index a90370418bf3e71ef9f806a32e3a0ac92d70280b..187135666b86b6185258c974b3a264a51cee3e5b 100644 (file)
@@ -35,24 +35,6 @@ sub Exit {
     croak "unexpected return from Perl::Tidy::Exit";
 }
 
-sub AUTOLOAD {
-
-    # Catch any undefined sub calls so that we are sure to get
-    # some diagnostic information.  This sub should never be called
-    # except for a programming error.
-    our $AUTOLOAD;
-    my ( $pkg, $fname, $lno ) = caller();
-    print STDERR <<EOM;
-======================================================================
-Unexpected call to Autoload looking for sub $AUTOLOAD
-Called from package: '$pkg'  
-Called from File '$fname'  at line '$lno'
-This error is probably due to a recent programming change
-======================================================================
-EOM
-    Die("Error exit due to unexpected Autoload call to '$AUTOLOAD'\n");
-}
-
 BEGIN {
 
     # Codes for insertion and deletion of blanks
@@ -631,18 +613,36 @@ sub get_added_semicolon_count {
     return $self->[_added_semicolon_count_];
 }
 
-sub DESTROY {
-    my $self = shift;
-    $self->_decrement_count();
-    return;
-}
-
 sub get_output_line_number {
     my ($self) = @_;
     my $vao = $self->[_vertical_aligner_object_];
     return $vao->get_output_line_number();
 }
 
+sub AUTOLOAD {
+
+    # Catch any undefined sub calls so that we are sure to get
+    # some diagnostic information.  This sub should never be called
+    # except for a programming error.
+    our $AUTOLOAD;
+    my ( $pkg, $fname, $lno ) = caller();
+    print STDERR <<EOM;
+======================================================================
+Unexpected call to Autoload looking for sub $AUTOLOAD
+Called from package: '$pkg'  
+Called from File '$fname'  at line '$lno'
+This error is probably due to a recent programming change
+======================================================================
+EOM
+    Die("Error exit due to unexpected Autoload call to '$AUTOLOAD'\n");
+}
+
+sub DESTROY {
+    my $self = shift;
+    $self->_decrement_count();
+    return;
+}
+
 sub new {
 
     my ( $class, @args ) = @_;
index c175f7e061a650e228d569dbf1cbd66d41c5867a..cd68293070d58fe4ff576cf63a2787493cd901a3 100644 (file)
@@ -57,6 +57,10 @@ EOM
         "Error exit due to unexpected Autoload call to '$AUTOLOAD'\n");
 }
 
+sub DESTROY {
+    # required to avoid call to AUTOLOAD in some versions of perl
+}
+
 sub new {
 
     my ( $class, @args ) = @_;
index 77d63abb91598ecd8706497b4c9b8d75e0444fdc..4d985eb730c2b137969f814be19b527933b79468 100644 (file)
@@ -48,6 +48,11 @@ EOM
         "Error exit due to unexpected Autoload call to '$AUTOLOAD'\n");
 }
 
+sub DESTROY {
+    # required to avoid call to AUTOLOAD in some versions of perl
+}
+
+
 BEGIN {
 
     # Define the fixed indexes for variables in $self, which is an array