| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
##################################################################### |
|
2
|
|
|
|
|
|
|
# |
|
3
|
|
|
|
|
|
|
# The Perl::Tidy::VerticalAligner::Line class supplies an object to |
|
4
|
|
|
|
|
|
|
# contain a single output line. It allows manipulation of the |
|
5
|
|
|
|
|
|
|
# alignment columns on that line. |
|
6
|
|
|
|
|
|
|
# |
|
7
|
|
|
|
|
|
|
##################################################################### |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
package Perl::Tidy::VerticalAligner::Line; |
|
10
|
39
|
|
|
39
|
|
274
|
use strict; |
|
|
39
|
|
|
|
|
81
|
|
|
|
39
|
|
|
|
|
1269
|
|
|
11
|
39
|
|
|
39
|
|
218
|
use warnings; |
|
|
39
|
|
|
|
|
84
|
|
|
|
39
|
|
|
|
|
1124
|
|
|
12
|
39
|
|
|
39
|
|
209
|
use English qw( -no_match_vars ); |
|
|
39
|
|
|
|
|
77
|
|
|
|
39
|
|
|
|
|
256
|
|
|
13
|
|
|
|
|
|
|
our $VERSION = '20230909'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub AUTOLOAD { |
|
16
|
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Catch any undefined sub calls so that we are sure to get |
|
18
|
|
|
|
|
|
|
# some diagnostic information. This sub should never be called |
|
19
|
|
|
|
|
|
|
# except for a programming error. |
|
20
|
2995
|
|
|
2995
|
|
5687
|
our $AUTOLOAD; |
|
21
|
2995
|
50
|
|
|
|
44703
|
return if ( $AUTOLOAD =~ /\bDESTROY$/ ); |
|
22
|
0
|
|
|
|
|
0
|
my ( $pkg, $fname, $lno ) = caller(); |
|
23
|
0
|
|
|
|
|
0
|
my $my_package = __PACKAGE__; |
|
24
|
0
|
|
|
|
|
0
|
print {*STDERR} <<EOM; |
|
|
0
|
|
|
|
|
0
|
|
|
25
|
|
|
|
|
|
|
====================================================================== |
|
26
|
|
|
|
|
|
|
Error detected in package '$my_package', version $VERSION |
|
27
|
|
|
|
|
|
|
Received unexpected AUTOLOAD call for sub '$AUTOLOAD' |
|
28
|
|
|
|
|
|
|
Called from package: '$pkg' |
|
29
|
|
|
|
|
|
|
Called from File '$fname' at line '$lno' |
|
30
|
|
|
|
|
|
|
This error is probably due to a recent programming change |
|
31
|
|
|
|
|
|
|
====================================================================== |
|
32
|
|
|
|
|
|
|
EOM |
|
33
|
0
|
|
|
|
|
0
|
exit 1; |
|
34
|
|
|
|
|
|
|
} ## end sub AUTOLOAD |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
{ |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Constructor may be called as a class method |
|
39
|
|
|
|
|
|
|
sub new { |
|
40
|
3065
|
|
|
3065
|
0
|
8401
|
my ( $class, $ri ) = @_; |
|
41
|
3065
|
|
|
|
|
6785
|
my $self = bless $ri, $class; |
|
42
|
3065
|
|
|
|
|
8105
|
return $self; |
|
43
|
|
|
|
|
|
|
} |
|
44
|
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub get_column { |
|
46
|
2640
|
|
|
2640
|
0
|
4827
|
my ( $self, $j ) = @_; |
|
47
|
2640
|
|
|
|
|
4701
|
my $alignment = $self->{ralignments}->[$j]; |
|
48
|
2640
|
50
|
|
|
|
5370
|
return unless defined($alignment); |
|
49
|
2640
|
|
|
|
|
6593
|
return $alignment->get_column(); |
|
50
|
|
|
|
|
|
|
} ## end sub get_column |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub current_field_width { |
|
53
|
3435
|
|
|
3435
|
0
|
5966
|
my ( $self, $j ) = @_; |
|
54
|
3435
|
|
|
|
|
5054
|
my $col_j = 0; |
|
55
|
3435
|
|
|
|
|
4530
|
my $col_jm = 0; |
|
56
|
|
|
|
|
|
|
|
|
57
|
3435
|
|
|
|
|
5313
|
my $alignment_j = $self->{ralignments}->[$j]; |
|
58
|
3435
|
50
|
|
|
|
8683
|
$col_j = $alignment_j->get_column() if defined($alignment_j); |
|
59
|
|
|
|
|
|
|
|
|
60
|
3435
|
100
|
|
|
|
7199
|
if ( $j > 0 ) { |
|
61
|
2441
|
|
|
|
|
4653
|
my $alignment_jm = $self->{ralignments}->[ $j - 1 ]; |
|
62
|
2441
|
50
|
|
|
|
6075
|
$col_jm = $alignment_jm->get_column() if defined($alignment_jm); |
|
63
|
|
|
|
|
|
|
} |
|
64
|
3435
|
|
|
|
|
7133
|
return $col_j - $col_jm; |
|
65
|
|
|
|
|
|
|
} ## end sub current_field_width |
|
66
|
|
|
|
|
|
|
|
|
67
|
|
|
|
|
|
|
sub increase_field_width { |
|
68
|
|
|
|
|
|
|
|
|
69
|
2669
|
|
|
2669
|
0
|
4903
|
my ( $self, $j, $pad ) = @_; |
|
70
|
2669
|
|
|
|
|
4426
|
my $jmax = $self->{jmax}; |
|
71
|
2669
|
|
|
|
|
5286
|
foreach ( $j .. $jmax ) { |
|
72
|
6368
|
|
|
|
|
9352
|
my $alignment = $self->{ralignments}->[$_]; |
|
73
|
6368
|
50
|
|
|
|
11443
|
if ( defined($alignment) ) { |
|
74
|
6368
|
|
|
|
|
12800
|
$alignment->increment_column($pad); |
|
75
|
|
|
|
|
|
|
} |
|
76
|
|
|
|
|
|
|
} |
|
77
|
2669
|
|
|
|
|
4961
|
return; |
|
78
|
|
|
|
|
|
|
} ## end sub increase_field_width |
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub get_available_space_on_right { |
|
81
|
1564
|
|
|
1564
|
0
|
3131
|
my $jmax = $_[0]->{jmax}; |
|
82
|
1564
|
|
|
|
|
4817
|
return $_[0]->{maximum_line_length} - $_[0]->get_column($jmax); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
1; |