Critique/Plugin/UI.pm

filter: Statementstmt 67.3% 33 / 49 Branchbran n/a Conditioncond 50.0% 1 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 55.5% 10 / 18 Podpod 0.0% 0 / 5 totaltotal 58.6% 44 / 75 CC 2 SCAR 4.3
CC
2
Cov
67%
BEGIN
2.0
info
2.0
warning
2.0
CRAP 1.5
« Critique/Command/tutorial.pm ↑ Summary
1 package App::Critique::Plugin::UI;
2  
3 16 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 16 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
5  
6 16 our $VERSION = '0.03';
7 16 our $AUTHORITY = 'cpan:STEVAN';
8  
9 16 ▶use Term::ReadKey ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10 16 ▶use Number::Format ();
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12 16 ▶use constant TERM_WIDTH => (Term::ReadKey::GetTerminalSize())[0] // 80;
Subroutine BEGIN: called CC=2 SCAR=7.1
Condition50%1/2
(Term::ReadKey::GetTerminalSize())[0] // 80
l!l
016
MC/DC0%0/1
(Term::ReadKey::GetTerminalSize())[0] // 80
(Term::ReadKey::GetTerminalSize())[0]
Truth table50%1/2
A
A= (Term::ReadKey::GetTerminalSize())[0]
Aresult
11
00
13 16 ▶use constant HR_ERROR => ('== ERROR '.('=' x (TERM_WIDTH - 9)));
Subroutine BEGIN: called CC=1 SCAR=0.0
14 16 ▶use constant HR_DARK => ('=' x TERM_WIDTH);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 16 ▶use constant HR_LIGHT => ('-' x TERM_WIDTH);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 16 ▶use App::Critique -ignore;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 16 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 ▶};
Subroutine BEGIN: called CC=1 SCAR=0.0
35  
36 0 ▶sub info { my ($plugin, $cmd, @args) = @_; _info( @args ) }
Subroutine info: not called CC=1 SCAR=6.9
Pod undocumented
37 0 ▶sub warning { my ($plugin, $cmd, @args) = @_; _warning( @args ) }
Subroutine warning: not called CC=1 SCAR=6.9
Pod undocumented
38 0 ▶sub error { my ($plugin, $cmd, @args) = @_; _error( @args ) }
Subroutine error: not called CC=1 SCAR=6.9
Pod undocumented
39  
40 sub format_number {
41 0 ▶ my ($plugin, $cmd, @args) = @_;
Subroutine format_number: not called CC=1 SCAR=6.9
Pod undocumented
42 0 Number::Format::format_number( @args );
43 }
44  
45 sub format_bytes {
46 0 ▶ my ($plugin, $cmd, @args) = @_;
Subroutine format_bytes: not called CC=1 SCAR=6.9
Pod undocumented
47 0 Number::Format::format_bytes( @args );
48 }
49  
50 # the real stuff
51  
52 sub _info {
53 0 ▶ my ($msg, @args) = @_;
Subroutine _info: not called CC=1 SCAR=6.9
54 0 print((sprintf $msg, @args), "\n");
55 }
56  
57 sub _warning {
58 0 ▶ my ($msg, @args) = @_;
Subroutine _warning: not called CC=1 SCAR=6.9
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 ▶ my ($msg, @args) = @_;
Subroutine _error: not called CC=1 SCAR=6.9
76 0 die(HR_ERROR,"\n",(sprintf $msg, @args),"\n",HR_DARK,"\n");
77 }
78  
79 16 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.03
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  
« Critique/Command/tutorial.pm ↑ Summary