line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package App::Critique::Plugin::UI; |
2
|
|
|
|
|
|
|
|
3
|
16
|
|
|
16
|
|
94448
|
use strict; |
|
16
|
|
|
|
|
34
|
|
|
16
|
|
|
|
|
447
|
|
4
|
16
|
|
|
16
|
|
63
|
use warnings; |
|
16
|
|
|
|
|
23
|
|
|
16
|
|
|
|
|
753
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '0.04'; |
7
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:STEVAN'; |
8
|
|
|
|
|
|
|
|
9
|
16
|
|
|
16
|
|
62
|
use Term::ReadKey (); |
|
16
|
|
|
|
|
21
|
|
|
16
|
|
|
|
|
184
|
|
10
|
16
|
|
|
16
|
|
8719
|
use Number::Format (); |
|
16
|
|
|
|
|
77712
|
|
|
16
|
|
|
|
|
965
|
|
11
|
|
|
|
|
|
|
|
12
|
16
|
|
50
|
16
|
|
113
|
use constant TERM_WIDTH => eval { local $SIG{__WARN__} = sub {''}; (Term::ReadKey::GetTerminalSize())[0] // 80 }; |
|
16
|
|
|
|
|
17
|
|
|
16
|
|
|
|
|
27
|
|
|
16
|
|
|
|
|
101
|
|
|
16
|
|
|
|
|
99081
|
|
|
16
|
|
|
|
|
69
|
|
13
|
16
|
|
|
16
|
|
4061
|
use constant HR_ERROR => ('== ERROR '.('=' x (TERM_WIDTH - 9))); |
|
16
|
|
|
|
|
54
|
|
|
16
|
|
|
|
|
1041
|
|
14
|
16
|
|
|
16
|
|
88
|
use constant HR_DARK => ('=' x TERM_WIDTH); |
|
16
|
|
|
|
|
29
|
|
|
16
|
|
|
|
|
914
|
|
15
|
16
|
|
|
16
|
|
72
|
use constant HR_LIGHT => ('-' x TERM_WIDTH); |
|
16
|
|
|
|
|
27
|
|
|
16
|
|
|
|
|
921
|
|
16
|
|
|
|
|
|
|
|
17
|
16
|
|
|
16
|
|
87
|
use App::Critique -ignore; |
|
16
|
|
|
|
|
32
|
|
|
16
|
|
|
|
|
416
|
|
18
|
|
|
|
|
|
|
|
19
|
16
|
|
|
|
|
225
|
use App::Cmd::Setup -plugin => { |
20
|
|
|
|
|
|
|
exports => [qw[ |
21
|
|
|
|
|
|
|
TERM_WIDTH |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
HR_ERROR |
24
|
|
|
|
|
|
|
HR_DARK |
25
|
|
|
|
|
|
|
HR_LIGHT |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
info |
28
|
|
|
|
|
|
|
warning |
29
|
|
|
|
|
|
|
error |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
format_number |
32
|
|
|
|
|
|
|
format_bytes |
33
|
|
|
|
|
|
|
]] |
34
|
16
|
|
|
16
|
|
4394
|
}; |
|
16
|
|
|
|
|
29
|
|
35
|
|
|
|
|
|
|
|
36
|
0
|
|
|
0
|
0
|
|
sub info { my ($plugin, $cmd, @args) = @_; _info( @args ) } |
|
0
|
|
|
|
|
|
|
37
|
0
|
|
|
0
|
0
|
|
sub warning { my ($plugin, $cmd, @args) = @_; _warning( @args ) } |
|
0
|
|
|
|
|
|
|
38
|
0
|
|
|
0
|
0
|
|
sub error { my ($plugin, $cmd, @args) = @_; _error( @args ) } |
|
0
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
sub format_number { |
41
|
0
|
|
|
0
|
0
|
|
my ($plugin, $cmd, @args) = @_; |
42
|
0
|
|
|
|
|
|
Number::Format::format_number( @args ); |
43
|
|
|
|
|
|
|
} |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub format_bytes { |
46
|
0
|
|
|
0
|
0
|
|
my ($plugin, $cmd, @args) = @_; |
47
|
0
|
|
|
|
|
|
Number::Format::format_bytes( @args ); |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
# the real stuff |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _info { |
53
|
0
|
|
|
0
|
|
|
my ($msg, @args) = @_; |
54
|
0
|
|
|
|
|
|
print((sprintf $msg, @args), "\n"); |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
sub _warning { |
58
|
0
|
|
|
0
|
|
|
my ($msg, @args) = @_; |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
# NOTE: |
61
|
|
|
|
|
|
|
# I had a timestamp here, but it didn't |
62
|
|
|
|
|
|
|
# really help any with the readability, |
63
|
|
|
|
|
|
|
# so I took it out, just in case I want |
64
|
|
|
|
|
|
|
# it back. I am leaving it here so I |
65
|
|
|
|
|
|
|
# don't need to work this out again. |
66
|
|
|
|
|
|
|
# - SL |
67
|
|
|
|
|
|
|
# my @time = (localtime)[ 2, 1, 0, 4, 3, 5 ]; |
68
|
|
|
|
|
|
|
# $time[-1] += 1900; |
69
|
|
|
|
|
|
|
# sprintf '%02d:%02d:%02d-%02d/%02d/%d', @time; |
70
|
|
|
|
|
|
|
|
71
|
0
|
|
|
|
|
|
warn((sprintf $msg, @args),"\n"); |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
|
74
|
|
|
|
|
|
|
sub _error { |
75
|
0
|
|
|
0
|
|
|
my ($msg, @args) = @_; |
76
|
0
|
|
|
|
|
|
die(HR_ERROR,"\n",(sprintf $msg, @args),"\n",HR_DARK,"\n"); |
77
|
|
|
|
|
|
|
} |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
1; |
80
|
|
|
|
|
|
|
|
81
|
|
|
|
|
|
|
=pod |
82
|
|
|
|
|
|
|
|
83
|
|
|
|
|
|
|
=head1 NAME |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
App::Critique::Plugin::UI - UI elements for App::Critique |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
=head1 VERSION |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
version 0.04 |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
=head1 DESCRIPTION |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
Just a simple L<App::Cmd::Plugin> to handle UI elements, nothing |
94
|
|
|
|
|
|
|
really useful in here. |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
=head1 AUTHOR |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
Stevan Little <stevan@cpan.org> |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
This software is copyright (c) 2016 by Stevan Little. |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This is free software; you can redistribute it and/or modify it under |
105
|
|
|
|
|
|
|
the same terms as the Perl 5 programming language system itself. |
106
|
|
|
|
|
|
|
|
107
|
|
|
|
|
|
|
=cut |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
__END__ |
110
|
|
|
|
|
|
|
|
111
|
|
|
|
|
|
|
# ABSTRACT: UI elements for App::Critique |
112
|
|
|
|
|
|
|
|