lib/TUI/Gadgets/Report.pm

filter: Statementstmt 56.2% 36 / 64 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 66.6% 10 / 15 Podpod 60.0% 3 / 5 totaltotal 52.6% 49 / 93 CC 4 SCAR 12.7
CC
4
Cov
51%
handleEvent
12.0
draw
6.0
new_TReport
2.0
CRAP 3.6
« lib/TUI/Dialogs/HistoryViewer/HistList.pm ↑ Summary lib/TUI/Editors/Memo.pm »
1 package TUI::Gadgets::Report;
2 # ABSTRACT: status line view displaying the character focused in an ASCII table
3
4 5 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 5 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 5 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 5 our $VERSION = '2.000003';
9 5 $VERSION =~ tr/_//d;
10 5 our $AUTHORITY = 'cpan:BRICKPOOL';
11
12 5 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 5 our @EXPORT = qw(
14 TReport
15 new_TReport
16 );
17
18 5 ▶use TUI::toolkit;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 5 ▶use TUI::toolkit::Types qw( :Object );
Subroutine BEGIN: called CC=1 SCAR=0.0
20
21 5 ▶use TUI::Drivers::Const qw( evBroadcast );
Subroutine BEGIN: called CC=1 SCAR=0.0
22 5 ▶use TUI::Gadgets::Const qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
23 cmAsciiTableCmdBase
24 cmCharFocused
25 5 );
26 5 ▶use TUI::Views::DrawBuffer;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 5 ▶use TUI::Views::View;
Subroutine BEGIN: called CC=1 SCAR=0.0
28
29 sub TReport() { __PACKAGE__ }
30 sub name() { 'TReport' }
31 0 ▶sub new_TReport { __PACKAGE__->from(@_) }
Subroutine new_TReport: not called CC=1 SCAR=6.9
Pod documented
32
33 5 extends TView;
34
35 # private attributes
36 5 has asciiChar => ( is => 'bare', default => 0 );
37
38 0 ▶sub draw { # void ()
Subroutine draw: not called CC=2 SCAR=17.9
Pod documented
39 0 state $sig = signature(
40 method => Object,
41 pos => [],
42 );
43 0 my ( $self ) = $sig->( @_ );
44
45 0 my $buf = TDrawBuffer->new();
46 0 my $color = $self->getColor( 6 );
47 0 my $code = $self->{asciiChar};
48 0 ▶ my $char = $code == 0 ? ' ' : chr( $code );
Branch: 1 branch
BranchTrueFalseTotal
$code == 0 ? : 0 0 0
49 0 my $str = sprintf( " Char: %s Decimal: %3d Hex %2X ",
50 $char, $code, $code );
51
52 0 $buf->moveStr( 0, $str, $color );
53 0 $self->writeLine( 0, 0, 32, 1, $buf );
54 0 return;
55 }
56
57 0 ▶sub handleEvent { # void ($event)
Subroutine handleEvent: not called CC=3 SCAR=24.8
Pod documented
58 0 state $sig = signature(
59 method => Object,
60 pos => [Object],
61 );
62 0 my ( $self, $event ) = $sig->( @_ );
63 0 $self->SUPER::handleEvent( $event );
64
65 0 ▶ if ( $event->{what} == evBroadcast
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"what"} == 512 and $event->{"message"}{"command"} == 910) 0 0 0
Condition0%0/3
$event->{"what"} == 512 and $event->{"message"}{"command"} == 910
!ll&&!rl&&r
000
MC/DC0%0/2
$event->{"what"} == 512 and $event->{"message"}{"command"} == 910
$event->{"what"} == 512 $event->{"message"}{"command"} == 910
Truth table0%0/3
A and B
A= $event->{"what"} == 512B= $event->{"message"}{"command"} == 910
ABresult
0X0
100
111
66 && $event->{message}{command} == cmAsciiTableCmdBase + cmCharFocused
67 ) {
68 0 $self->{asciiChar} = $event->{message}{infoLong};
69 0 $self->drawView();
70 }
71 0 return;
72 }
73
74 0 ▶sub write :method { # void ($os)
Subroutine write: not called CC=1 SCAR=6.9
Pod undocumented
75 0 state $sig = signature(
76 method => Object,
77 pos => [Object],
78 );
79 0 my ( $self, $os ) = $sig->( @_ );
80 0 $self->SUPER::write( $os );
81 0 $os->put( $self->{asciiChar} );
82 0 return;
83 }
84
85 0 ▶sub read :method { # $self ($is)
Subroutine read: not called CC=1 SCAR=6.9
Pod undocumented
86 0 state $sig = signature(
87 method => Object,
88 pos => [Object],
89 );
90 0 my ( $self, $is ) = $sig->( @_ );
91 0 $self->SUPER::read( $is );
92 0 $self->{asciiChar} = $is->get();
93 0 return $self;
94 }
95
96 5 1
97
98 __END__
« lib/TUI/Dialogs/HistoryViewer/HistList.pm ↑ Summary lib/TUI/Editors/Memo.pm »