1 #####################################################################
3 # the Perl::Tidy::VerticalAligner::Alignment class holds information
4 # on a single column being aligned
6 #####################################################################
7 package Perl::Tidy::VerticalAligner::Alignment;
11 { #<<< A non-indenting brace
13 our $VERSION = '20220217';
17 # Indexes for variables in $self.
18 # Do not combine with other BEGIN blocks (c101).
19 # _column_ # the current column number
20 # _saved_column_ # a place for temporary storage
24 _saved_column_ => $i++,
29 my ( $class, $rarg ) = @_;
30 my $self = bless [], $class;
31 $self->[_column_] = $rarg->{column};
32 $self->[_saved_column_] = $rarg->{saved_column};
38 # Catch any undefined sub calls so that we are sure to get
39 # some diagnostic information. This sub should never be called
40 # except for a programming error.
42 return if ( $AUTOLOAD =~ /\bDESTROY$/ );
43 my ( $pkg, $fname, $lno ) = caller();
44 my $my_package = __PACKAGE__;
46 ======================================================================
47 Error detected in package '$my_package', version $VERSION
48 Received unexpected AUTOLOAD call for sub '$AUTOLOAD'
49 Called from package: '$pkg'
50 Called from File '$fname' at line '$lno'
51 This error is probably due to a recent programming change
52 ======================================================================
59 # required to avoid call to AUTOLOAD in some versions of perl
63 return $_[0]->[_column_];
66 sub increment_column {
67 $_[0]->[_column_] += $_[1];
72 $_[0]->[_saved_column_] = $_[0]->[_column_];
77 $_[0]->[_column_] = $_[0]->[_saved_column_];
80 } ## end of package VerticalAligner::Alignment