]> git.donarmstrong.com Git - perltidy.git/commitdiff
simplify AUTOLOAD as much as possible
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 8 Sep 2020 17:40:11 +0000 (10:40 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 8 Sep 2020 17:40:11 +0000 (10:40 -0700)
lib/Perl/Tidy.pm
lib/Perl/Tidy/Formatter.pm
lib/Perl/Tidy/HtmlWriter.pm
lib/Perl/Tidy/Tokenizer.pm
lib/Perl/Tidy/VerticalAligner.pm
t/snippets/perltidy_random_parameters.pl

index 90d13ae338fa629e1454b2ed1e101328c3f37fe0..36dbcfd2d2ed9b4250c91319a27561fa4ffcc330 100644 (file)
@@ -123,6 +123,7 @@ sub AUTOLOAD {
     # some diagnostic information.  This sub should never be called
     # except for a programming error.
     our $AUTOLOAD;
+    return if ($AUTOLOAD eq 'DESTROY');
     my ( $pkg, $fname, $lno ) = caller();
     print STDERR <<EOM;
 ======================================================================
@@ -132,8 +133,7 @@ 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");
+    exit 1;
 }
 
 sub streamhandle {
index f55336409fd88c4a46a3dcb9754ca05b27da937f..512a74252db566e4a0f6f893412c083e40bf7f43 100644 (file)
@@ -626,6 +626,7 @@ sub AUTOLOAD {
     # some diagnostic information.  This sub should never be called
     # except for a programming error.
     our $AUTOLOAD;
+    return if ($AUTOLOAD eq 'DESTROY');
     my ( $pkg, $fname, $lno ) = caller();
     print STDERR <<EOM;
 ======================================================================
@@ -635,7 +636,7 @@ 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");
+    exit 1;
 }
 
 sub DESTROY {
index cd68293070d58fe4ff576cf63a2787493cd901a3..4257f211fb07f43bedacfec4ed13359dee51c034 100644 (file)
@@ -44,6 +44,7 @@ sub AUTOLOAD {
     # some diagnostic information.  This sub should never be called
     # except for a programming error.
     our $AUTOLOAD;
+    return if ($AUTOLOAD eq 'DESTROY');
     my ( $pkg, $fname, $lno ) = caller();
     print STDERR <<EOM;
 ======================================================================
@@ -53,8 +54,7 @@ Called from File '$fname'  at line '$lno'
 This error is probably due to a recent programming change
 ======================================================================
 EOM
-    Perl::Tidy::Die(
-        "Error exit due to unexpected Autoload call to '$AUTOLOAD'\n");
+    exit 1;
 }
 
 sub DESTROY {
index 7685f8ff6514cc3e2be0b1cb43eb3cf3e9a4f339..f333caef6ba33ff9c26a622d359d0ef06fae1d65 100644 (file)
@@ -209,6 +209,7 @@ sub AUTOLOAD {
     # some diagnostic information.  This sub should never be called
     # except for a programming error.
     our $AUTOLOAD;
+    return if ($AUTOLOAD eq 'DESTROY');
     my ( $pkg, $fname, $lno ) = caller();
     print STDERR <<EOM;
 ======================================================================
index 5ed4291cffa42539370bfeafaa0484b98750f995..5160ac370cfe381f851da496bdc0061c9c51d8cd 100644 (file)
@@ -35,6 +35,7 @@ sub AUTOLOAD {
     # some diagnostic information.  This sub should never be called
     # except for a programming error.
     our $AUTOLOAD;
+    return if ($AUTOLOAD eq 'DESTROY');
     my ( $pkg, $fname, $lno ) = caller();
     print STDERR <<EOM;
 ======================================================================
@@ -44,8 +45,7 @@ Called from File '$fname'  at line '$lno'
 This error is probably due to a recent programming change
 ======================================================================
 EOM
-    Perl::Tidy::Die(
-        "Error exit due to unexpected Autoload call to '$AUTOLOAD'\n");
+    exit 1;
 }
 
 sub DESTROY {
index 7a2aefdb2b56978013604c0f87e6ddfcf6f214b2..e64cb05bc6b900bcaa862dae56c591e40dcaecab 100755 (executable)
@@ -292,7 +292,7 @@ EOM
        $num=10 if ($num>10);
        print STDERR <<EOM;
 Some check files with errors (search above for '**ERROR'):
-(@chkfile_errors[1..$num])
+(@chkfile_errors[1..$num-1])
 EOM
     }