]> git.donarmstrong.com Git - perltidy.git/commitdiff
updated sub AUTOLOAD
authorSteve Hancock <perltidy@users.sourceforge.net>
Tue, 20 Oct 2020 23:37:14 +0000 (16:37 -0700)
committerSteve Hancock <perltidy@users.sourceforge.net>
Tue, 20 Oct 2020 23:37:14 +0000 (16:37 -0700)
lib/Perl/Tidy/VerticalAligner/Alignment.pm
lib/Perl/Tidy/VerticalAligner/Line.pm

index 08afc5177ff3a370dead594f5b2d0b99a8b283ff..74525b134cb8a5a3107361b94b093d8a6dbfbb69 100644 (file)
@@ -23,10 +23,8 @@ use constant {
 };
 
 sub new {
-    my ( $caller, %arg ) = @_;
-    my $caller_is_obj = ref($caller);
-    my $class         = $caller_is_obj || $caller;
-    my $self          = bless [], $class;
+    my ( $class, %arg ) = @_;
+    my $self = bless [], $class;
     $self->[_column_]          = $arg{column};
     $self->[_starting_column_] = $arg{starting_column};
     $self->[_saved_column_]    = $arg{saved_column};
@@ -44,13 +42,15 @@ sub AUTOLOAD {
     our $AUTOLOAD;
     return if ( $AUTOLOAD =~ /\bDESTROY$/ );
     my ( $pkg, $fname, $lno ) = caller();
+    my $my_package = __PACKAGE__;
     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
-    ======================================================================
+======================================================================
+Error detected in package '$my_package', version $VERSION
+Received unexpected AUTOLOAD call 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
     exit 1;
 }
index 500b790738ed159868e70c12d253fee07aa41074..f37de880f66a3b7e57d537adea425bfb91a97bc2 100644 (file)
@@ -62,10 +62,7 @@ EOM
 
     # Constructor may be called as a class method
     sub new {
-        my ( $caller, %arg ) = @_;
-        my $caller_is_obj = ref($caller);
-        my $class         = $caller_is_obj || $caller;
-        ##no strict "refs";
+        my ( $class, %arg ) = @_;
         my $self = bless [], $class;
 
         $self->[_jmax_]                      = $arg{jmax};