line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
427
|
use strict; |
|
1
|
|
|
|
|
7
|
|
|
1
|
|
|
|
|
24
|
|
2
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
442
|
|
3
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package OptArgs2::StatusLine; |
5
|
|
|
|
|
|
|
|
6
|
11
|
|
|
11
|
1
|
1235
|
sub RS { chr(30) } |
7
|
|
|
|
|
|
|
my $RS = RS; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub TIESCALAR { |
10
|
1
|
|
|
1
|
|
2
|
my $class = shift; |
11
|
1
|
|
|
|
|
3
|
bless [], $class; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
30
|
|
|
30
|
|
6282
|
sub FETCH { $_[0]->[0] } |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
sub STORE { |
17
|
12
|
|
|
12
|
|
6022
|
my $self = shift; |
18
|
12
|
|
50
|
|
|
33
|
my $arg = shift // return; |
19
|
12
|
|
|
|
|
14
|
my $str; |
20
|
|
|
|
|
|
|
|
21
|
12
|
100
|
|
|
|
108
|
if ( 'SCALAR' eq ref $arg ) { |
|
|
100
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
22
|
1
|
50
|
|
|
|
5
|
if ( not defined $self->[0] ) { |
23
|
0
|
|
|
|
|
0
|
$str = $$arg . $RS; |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
else { |
26
|
1
|
|
|
|
|
21
|
$str = $self->[0] =~ s/[^$RS]+/$$arg/r; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
elsif ( $arg =~ m/$RS/ ) { |
30
|
4
|
|
|
|
|
9
|
$str = $arg; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
elsif ( not defined $self->[0] ) { |
33
|
1
|
|
|
|
|
10
|
require File::Basename; |
34
|
1
|
|
|
|
|
56
|
$str = File::Basename::basename($0) . ': ' . RS . $arg; |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
elsif ( $self->[0] =~ m/(.*)$RS/ ) { |
37
|
6
|
|
|
|
|
12
|
$str = $1 . RS . $arg; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
else { |
40
|
0
|
|
|
|
|
0
|
warn "Internal Error - should never happen!"; |
41
|
0
|
|
|
|
|
0
|
return; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
12
|
50
|
|
|
|
31
|
my $NL = $str =~ s/\n\z// ? "\n" : "\r"; |
45
|
12
|
|
|
|
|
24
|
my $fh = select; |
46
|
|
|
|
|
|
|
|
47
|
12
|
50
|
|
|
|
70
|
if ( -t $fh ) { |
48
|
0
|
|
|
|
|
0
|
$fh->printflush( $str . "\e[K" . $NL ); |
49
|
|
|
|
|
|
|
} |
50
|
|
|
|
|
|
|
else { |
51
|
12
|
|
|
|
|
65
|
$fh->print( $str . "\n" ); |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
12
|
50
|
|
|
|
426
|
$str =~ s/(.*$RS).*/$1/ if $NL eq "\n"; |
55
|
12
|
|
|
|
|
57
|
$self->[0] = $str; |
56
|
|
|
|
|
|
|
} |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub import { |
59
|
1
|
|
|
1
|
|
5
|
my $class = shift; |
60
|
1
|
|
|
|
|
3
|
my $caller = scalar caller; |
61
|
|
|
|
|
|
|
|
62
|
1
|
|
|
1
|
|
6
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
139
|
|
63
|
1
|
|
|
|
|
2
|
foreach my $arg (@_) { |
64
|
2
|
100
|
|
|
|
12
|
if ( $arg =~ m/^\$(.*)/ ) { |
|
|
50
|
|
|
|
|
|
65
|
1
|
|
|
|
|
2
|
my $name = $1; |
66
|
1
|
|
|
|
|
4
|
tie my $x, 'OptArgs2::StatusLine'; |
67
|
1
|
|
|
|
|
2
|
*{ $caller . '::' . $name } = \$x; |
|
1
|
|
|
|
|
22
|
|
68
|
|
|
|
|
|
|
} |
69
|
|
|
|
|
|
|
elsif ( $arg eq 'RS' ) { |
70
|
1
|
|
|
|
|
2
|
*{ $caller . '::RS' } = \&RS; |
|
1
|
|
|
|
|
7
|
|
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
else { |
73
|
0
|
|
|
|
|
|
die 'expected "RS" or "$scalar"'; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
__END__ |