X-Git-Url: https://git.donarmstrong.com/?p=perltidy.git;a=blobdiff_plain;f=lib%2FPerl%2FTidy%2FVerticalAligner%2FAlignment.pm;fp=lib%2FPerl%2FTidy%2FVerticalAligner%2FAlignment.pm;h=50edd51a017568a479b82693aba3891b6de7ca37;hp=078689bb312166ba32caa1a6fd83c64831024ec9;hb=6d131c770b3b54ee74e0d0b9179114d28dfcec27;hpb=f7b7d95d23cfcceb1d4adf1bf81d80029ae214e4 diff --git a/lib/Perl/Tidy/VerticalAligner/Alignment.pm b/lib/Perl/Tidy/VerticalAligner/Alignment.pm index 078689b..50edd51 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 = '20230309'; 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; -