lib/BeamerReveal/Log/Ansi.pm

filter: Statementstmt 23.4% 11 / 47 Branchbran 0.0% 0 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 25.0% 3 / 12 Podpod 50.0% 2 / 4 totaltotal 21.9% 16 / 73 CC 6 SCAR 17.6
CC
6
Cov
19%
activate
12.0
progress
12.0
new
6.0
CRAP 5.8
« lib/BeamerReveal/FrameConverter.pm ↑ Summary lib/BeamerReveal.pm »
1 # -*- cperl -*-
2 # ABSTRACT: Log::Ansi
3  
4  
5 package BeamerReveal::Log::Ansi;
6 1 our $VERSION = '20261115.1249'; # VERSION
7  
8 1 ▶use parent 'BeamerReveal::Log';
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Term::ReadKey;
Subroutine BEGIN: called CC=1 SCAR=0.0
11  
12  
13 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
14 0 my $class = shift;
15 0 my $self = { @_ };
16 0 ▶ $class = (ref $class ? ref $class : $class );
Branch: 1 branch
BranchTrueFalseTotal
ref $class ? : 0 0 0
17 0 bless $self, $class;
18 0 return $self;
19 }
20  
21  
22 0 ▶sub activate {
Subroutine activate: not called CC=3 SCAR=24.8
Pod documented
23 0 my $self = shift;
24 0 my $nofTasks = @{$self->{tasks}};
25 # make initial drawing
26 0 ▶ for( my $i = 0; $i < $nofTasks; ++$i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $nofTasks) 0 0 0
27 0 print "\n";
28 }
29 0 ▶ for( my $i = 0; $i < $nofTasks; ++$i ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($i < $nofTasks) 0 0 0
30 0 $self->progress( $i, 0 );
31 }
32 }
33  
34 0 ▶sub progress {
Subroutine progress: not called CC=3 SCAR=24.8
Pod undocumented
35 0 my $self = shift;
36 0 my ( $taskId, $progress, $activity, $total ) = @_;
37 0 my $task = $self->{tasks}->[$taskId];
38 0 ▶ $task->{total} = $total if defined( $total );
Branch: 1 branch
BranchTrueFalseTotal
if defined $total 0 0 0
39 0 ▶ $task->{activity} = $activity if defined( $activity );
Branch: 1 branch
BranchTrueFalseTotal
if defined $activity 0 0 0
40 0 $task->{progress} = $progress;
41  
42 0 my $nofTasks = @{$self->{tasks}};
43  
44 0 _ansi_up( $nofTasks - $taskId );
45 0 _ansi_clr_eol();
46 print BeamerReveal::Log::_bar_line( $task->{label}, $self->{labelsize},
47 $task->{activity}, $self->{activitysize},
48 0 $progress, $task->{total}, $self->{barsize} );
49  
50 0 print "\n" x ( $nofTasks - $taskId );
51 }
52  
53 0 ▶sub finalize {
Subroutine finalize: not called CC=1 SCAR=6.9
Pod undocumented
54 0 my $self = shift;
55 0 _ansi_down( scalar @{$self->{tasks}} );
56 0 print BeamerReveal::Log::_formatLines( $self->{closing}, $self->{termwidth}, $self->{extra} );
57 0 $self->log( '0', 'Done' );
58 }
59  
60 0 ▶sub _ansi_up { print "\e[" . $_[0] . "A"; }
Subroutine _ansi_up: not called CC=1 SCAR=6.9
61 0 ▶sub _ansi_down { print "\e[" . $_[0] . "B"; }
Subroutine _ansi_down: not called CC=1 SCAR=6.9
62 0 ▶sub _ansi_cr { print "\r"; }
Subroutine _ansi_cr: not called CC=1 SCAR=6.9
63 0 ▶sub _ansi_clr_eol { print "\e[K"; }
Subroutine _ansi_clr_eol: not called CC=1 SCAR=6.9
64  
65 0 ▶sub _terminal_width {
Subroutine _terminal_width: not called CC=1 SCAR=6.9
66 0 my $self = shift;
67 0 my ($cols, $rows) = Term::ReadKey::GetTerminalSize();
68 0 return $cols;
69 };
70  
71 1 1;
72  
73 __END__
« lib/BeamerReveal/FrameConverter.pm ↑ Summary lib/BeamerReveal.pm »