line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Term2HTML; |
2
|
3
|
|
|
3
|
|
116073
|
use strict; |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
82
|
|
3
|
3
|
|
|
3
|
|
14
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
88
|
|
4
|
3
|
|
|
3
|
|
3645
|
use Getopt::Long qw/GetOptionsFromArray/; |
|
3
|
|
|
|
|
40003
|
|
|
3
|
|
|
|
|
18
|
|
5
|
3
|
|
|
3
|
|
3079
|
use IO::Interactive::Tiny; |
|
3
|
|
|
|
|
30
|
|
|
3
|
|
|
|
|
90
|
|
6
|
3
|
|
|
3
|
|
2419
|
use HTML::FromANSI::Tiny; |
|
3
|
|
|
|
|
3764
|
|
|
3
|
|
|
|
|
12
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
our $VERSION = '0.02'; |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub run { |
11
|
2
|
|
|
2
|
1
|
5565
|
my $self = shift; |
12
|
2
|
|
|
|
|
8
|
my @argv = @_; |
13
|
|
|
|
|
|
|
|
14
|
2
|
|
|
|
|
5
|
my $config = {}; |
15
|
2
|
|
|
|
|
9
|
_merge_opt($config, @argv); |
16
|
|
|
|
|
|
|
|
17
|
2
|
|
|
|
|
823
|
_main($config); |
18
|
|
|
|
|
|
|
} |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
sub _main { |
21
|
2
|
|
|
2
|
|
4
|
my $config = shift; |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
my $h = HTML::FromANSI::Tiny->new( |
24
|
2
|
100
|
|
|
|
25
|
$config->{inline_style} ? (inline_style => 1) : (), |
25
|
|
|
|
|
|
|
); |
26
|
|
|
|
|
|
|
|
27
|
2
|
50
|
|
|
|
14246
|
if ( !IO::Interactive::Tiny::is_interactive(*STDIN) ) { |
28
|
2
|
100
|
|
|
|
58
|
print join('', '', "\n") if !$config->{inline_style}; |
29
|
2
|
|
|
|
|
936
|
print ""; |
30
|
2
|
|
|
|
|
21
|
while (my $stdin = ) { |
31
|
2
|
|
|
|
|
13
|
print $h->html($stdin); |
32
|
|
|
|
|
|
|
} |
33
|
2
|
|
|
|
|
1199
|
print "\n"; |
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
sub _merge_opt { |
38
|
2
|
|
|
2
|
|
5
|
my ($config, @argv) = @_; |
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
GetOptionsFromArray( |
41
|
|
|
|
|
|
|
\@argv, |
42
|
|
|
|
|
|
|
'is|inline-style' => \$config->{inline_style}, |
43
|
|
|
|
|
|
|
'h|help' => sub { |
44
|
0
|
|
|
0
|
|
|
_show_usage(1); |
45
|
|
|
|
|
|
|
}, |
46
|
|
|
|
|
|
|
'v|version' => sub { |
47
|
0
|
|
|
0
|
|
|
print "$0 $VERSION\n"; |
48
|
0
|
|
|
|
|
|
exit 1; |
49
|
|
|
|
|
|
|
}, |
50
|
2
|
50
|
|
|
|
26
|
) or _show_usage(2); |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
sub _show_usage { |
54
|
0
|
|
|
0
|
|
|
my $exitval = shift; |
55
|
|
|
|
|
|
|
|
56
|
0
|
|
|
|
|
|
require Pod::Usage; |
57
|
0
|
|
|
|
|
|
Pod::Usage::pod2usage(-exitval => $exitval); |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |
61
|
|
|
|
|
|
|
|
62
|
|
|
|
|
|
|
__END__ |