line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package BorderStyleBase; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
421
|
use strict 'subs', 'vars'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
39
|
|
4
|
|
|
|
|
|
|
#use warnings; |
5
|
1
|
|
|
1
|
|
5
|
use parent 'BorderStyleBase::Constructor'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
7
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
8
|
|
|
|
|
|
|
our $DATE = '2022-01-24'; # DATE |
9
|
|
|
|
|
|
|
our $DIST = 'BorderStyleBase'; # DIST |
10
|
|
|
|
|
|
|
our $VERSION = '0.010'; # VERSION |
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
sub get_struct { |
13
|
3
|
|
|
3
|
0
|
11
|
my $self_or_class = shift; |
14
|
3
|
50
|
|
|
|
10
|
if (ref $self_or_class) { |
15
|
3
|
|
|
|
|
5
|
\%{"$self_or_class->{orig_class}::BORDER"}; |
|
3
|
|
|
|
|
18
|
|
16
|
|
|
|
|
|
|
} else { |
17
|
0
|
|
|
|
|
0
|
\%{"$self_or_class\::BORDER"}; |
|
0
|
|
|
|
|
0
|
|
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
} |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub get_args { |
22
|
1
|
|
|
1
|
0
|
14
|
my $self = shift; |
23
|
1
|
|
|
|
|
8
|
$self->{args}; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
sub get_border_char { |
27
|
2
|
|
|
2
|
0
|
14
|
my ($self, $y, $x, $n, $args) = @_; |
28
|
2
|
100
|
|
|
|
8
|
$n = 1 unless defined $n; |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
|
|
|
10
|
my $bs_struct = $self->get_struct; |
31
|
|
|
|
|
|
|
|
32
|
2
|
|
|
|
|
8
|
my $c = $bs_struct->{chars}[$y][$x]; |
33
|
2
|
50
|
|
|
|
7
|
if (!defined($c)) { |
34
|
0
|
0
|
0
|
|
|
0
|
if ($y == 4 && $x == 6) { $c = $bs_struct->{chars}[4][0] } |
|
0
|
0
|
0
|
|
|
0
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
elsif ($y == 4 && $x == 7) { $c = $bs_struct->{chars}[4][3] } |
36
|
0
|
|
|
|
|
0
|
elsif ($y == 6) { $c = $bs_struct->{chars}[0][$x] } |
37
|
0
|
|
|
|
|
0
|
elsif ($y == 7) { $c = $bs_struct->{chars}[5][$x] } |
38
|
|
|
|
|
|
|
elsif ($y == 8) { |
39
|
0
|
|
|
|
|
0
|
$c = $bs_struct->{chars}[4][$x]; |
40
|
0
|
0
|
|
|
|
0
|
if (!defined($c)) { |
41
|
0
|
0
|
|
|
|
0
|
if ($x == 6) { $c = $bs_struct->{chars}[4][0] } |
|
0
|
0
|
|
|
|
0
|
|
42
|
0
|
|
|
|
|
0
|
elsif ($x == 7) { $c = $bs_struct->{chars}[4][3] } |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
} |
45
|
|
|
|
|
|
|
} |
46
|
2
|
50
|
|
|
|
6
|
return unless defined $c; |
47
|
|
|
|
|
|
|
|
48
|
2
|
50
|
|
|
|
7
|
if (ref $c eq 'CODE') { |
49
|
0
|
|
|
|
|
0
|
my $c2 = $c->($self, $y, $x, $n, $args); |
50
|
0
|
0
|
|
|
|
0
|
if (ref $c2 eq 'CODE') { |
51
|
0
|
|
|
|
|
0
|
die "Border character ($y, $x) of style $self->{orig_class} returns coderef, ". |
52
|
|
|
|
|
|
|
"which after called still returns a coderef"; |
53
|
|
|
|
|
|
|
} |
54
|
0
|
|
|
|
|
0
|
return $c2; |
55
|
|
|
|
|
|
|
} else { |
56
|
2
|
100
|
|
|
|
9
|
$c = $c x $n if $n != 1; |
57
|
2
|
50
|
|
|
|
6
|
$c = "\e(0$c\e(B" if $bs_struct->{box_chars}; |
58
|
|
|
|
|
|
|
} |
59
|
2
|
|
|
|
|
12
|
$c; |
60
|
|
|
|
|
|
|
} |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
1; |
63
|
|
|
|
|
|
|
# ABSTRACT: A suitable base class for most BorderStyle::* modules |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
__END__ |