X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;ds=sidebyside;f=lib%2FPerl%2FTidy%2FVerticalAligner%2FAlignment.pm;h=209b2e50b8b7ed61fb38d048072d9c56b8e2704a;hb=8360fafa7774a02a63bd43854a82f22c335851d9;hp=078689bb312166ba32caa1a6fd83c64831024ec9;hpb=c514d57dc8088e1f4d3f51857b1155c20085c296;p=perltidy.git diff --git a/lib/Perl/Tidy/VerticalAligner/Alignment.pm b/lib/Perl/Tidy/VerticalAligner/Alignment.pm index 078689b..209b2e5 100644 --- a/lib/Perl/Tidy/VerticalAligner/Alignment.pm +++ b/lib/Perl/Tidy/VerticalAligner/Alignment.pm @@ -10,26 +10,11 @@ use warnings; { #<<< A non-indenting brace -our $VERSION = '20220613'; - -BEGIN { - - # Indexes for variables in $self. - # Do not combine with other BEGIN blocks (c101). - # _column_ # the current column number - # _saved_column_ # a place for temporary storage - my $i = 0; - use constant { - _column_ => $i++, - _saved_column_ => $i++, - }; -} +our $VERSION = '20221112'; sub new { my ( $class, $rarg ) = @_; - my $self = bless [], $class; - $self->[_column_] = $rarg->{column}; - $self->[_saved_column_] = $rarg->{saved_column}; + my $self = bless $rarg, $class; return $self; } @@ -60,23 +45,23 @@ sub DESTROY { } sub get_column { - return $_[0]->[_column_]; + return $_[0]->{'column'}; } sub increment_column { - $_[0]->[_column_] += $_[1]; + $_[0]->{'column'} += $_[1]; + return; } sub save_column { - $_[0]->[_saved_column_] = $_[0]->[_column_]; + $_[0]->{'saved_column'} = $_[0]->{'column'}; return; } sub restore_column { - $_[0]->[_column_] = $_[0]->[_saved_column_]; + $_[0]->{'column'} = $_[0]->{'saved_column'}; return; } } ## end of package VerticalAligner::Alignment 1; -