| 1 | package TUI::Gadgets::FileViewer; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | # ABSTRACT: File viewer gadget for TUI::Vision applications | ||||||||||||||||||||||||||||||||||||||||||
| 3 | |||||||||||||||||||||||||||||||||||||||||||
| 4 | 6 | ▶ | use 5.010; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | 6 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 6 | 6 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||||||||||||||||
| 8 | 6 | our $VERSION = '2.000003'; | |||||||||||||||||||||||||||||||||||||||||
| 9 | 6 | $VERSION =~ tr/_//d; | |||||||||||||||||||||||||||||||||||||||||
| 10 | 6 | our $AUTHORITY = 'cpan:BRICKPOOL'; | |||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 6 | ▶ | use Exporter 'import'; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 13 | 6 | our @EXPORT = qw( | |||||||||||||||||||||||||||||||||||||||||
| 14 | TFileViewer | ||||||||||||||||||||||||||||||||||||||||||
| 15 | new_TFileViewer | ||||||||||||||||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 6 | ▶ | use Carp (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 6 | ▶ | use File::Spec (); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | 6 | ▶ | use IO::File; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 21 | 6 | ▶ | use List::Util qw( max ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 6 | ▶ | use Storable; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 6 | ▶ | use TUI::toolkit; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 6 | ▶ | use TUI::toolkit::Types qw( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 25 | Maybe | ||||||||||||||||||||||||||||||||||||||||||
| 26 | :is | ||||||||||||||||||||||||||||||||||||||||||
| 27 | :types | ||||||||||||||||||||||||||||||||||||||||||
| 28 | 6 | ); | |||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | 6 | ▶ | use TUI::Const qw( EOS ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 31 | 6 | ▶ | use TUI::Gadgets::Const qw( maxLineLength ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | 6 | ▶ | use TUI::Gadgets::LineCollection; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 6 | ▶ | use TUI::Memory qw( lowMemory ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 34 | 6 | ▶ | use TUI::MsgBox::Const qw( :mfXXXX ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 35 | 6 | ▶ | use TUI::MsgBox::MsgBoxText qw( messageBox ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 6 | ▶ | use TUI::Objects::Rect; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 6 | ▶ | use TUI::Views::Const qw( | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | gfGrowHiX | ||||||||||||||||||||||||||||||||||||||||||
| 39 | gfGrowHiY | ||||||||||||||||||||||||||||||||||||||||||
| 40 | sfExposed | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 6 | ); | |||||||||||||||||||||||||||||||||||||||||
| 42 | 6 | ▶ | use TUI::Views::DrawBuffer; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 43 | 6 | ▶ | use TUI::Views::Scroller; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||||||||||||||||
| 45 | sub TFileViewer() { __PACKAGE__ } | ||||||||||||||||||||||||||||||||||||||||||
| 46 | sub name() { 'TFileViewer' } | ||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | sub new_TFileViewer { __PACKAGE__->from(@_) } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new_TFileViewer: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | |||||||||||||||||||||||||||||||||||||||||||
| 49 | 6 | extends TScroller; | |||||||||||||||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||||||||||||||||
| 51 | # public attributes | ||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | ▶ | has fileName => ( is => 'rw', default => sub { die 'required' } ); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
| |||||||||||||||||||||||||||||||||||||||||||
| 53 | 6 | has fileLines => ( is => 'rw' ); | |||||||||||||||||||||||||||||||||||||||||
| 54 | 6 | has isValid => ( is => 'rw', default => false ); | |||||||||||||||||||||||||||||||||||||||||
| 55 | |||||||||||||||||||||||||||||||||||||||||||
| 56 | 0 | ▶ | sub BUILDARGS { # \%args (%args) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILDARGS: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 58 | method => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 59 | named => [ | ||||||||||||||||||||||||||||||||||||||||||
| 60 | bounds => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 61 | hScrollBar => Maybe[Object], { alias => 'aHScrollBar' }, | ||||||||||||||||||||||||||||||||||||||||||
| 62 | vScrollBar => Maybe[Object], { alias => 'aVScrollBar' }, | ||||||||||||||||||||||||||||||||||||||||||
| 63 | fileName => Str, { alias => 'aFileName' }, | ||||||||||||||||||||||||||||||||||||||||||
| 64 | ], | ||||||||||||||||||||||||||||||||||||||||||
| 65 | caller_level => +1, | ||||||||||||||||||||||||||||||||||||||||||
| 66 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | my ( $class, $args1 ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | local $Carp::CarpLevel = $Carp::CarpLevel + 1; | |||||||||||||||||||||||||||||||||||||||||
| 69 | my $args2 = $class->SUPER::BUILDARGS( | ||||||||||||||||||||||||||||||||||||||||||
| 70 | bounds => $args1->{bounds}, | ||||||||||||||||||||||||||||||||||||||||||
| 71 | hScrollBar => $args1->{hScrollBar}, | ||||||||||||||||||||||||||||||||||||||||||
| 72 | vScrollBar => $args1->{vScrollBar}, | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | ); | |||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | return { %$args1, %$args2 }; | |||||||||||||||||||||||||||||||||||||||||
| 75 | } | ||||||||||||||||||||||||||||||||||||||||||
| 76 | |||||||||||||||||||||||||||||||||||||||||||
| 77 | 0 | ▶ | sub BUILD { # void (\%args) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BUILD: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 78 | 0 | my ( $self, $args ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 80 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 81 | 0 | ▶ | assert ( is_HashRef $args ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | $self->{growMode} |= gfGrowHiX | gfGrowHiY; | |||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | $self->{isValid} = true; | |||||||||||||||||||||||||||||||||||||||||
| 84 | 0 | $self->{fileName} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | $self->readFile( $args->{fileName} ); | |||||||||||||||||||||||||||||||||||||||||
| 86 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 87 | } | ||||||||||||||||||||||||||||||||||||||||||
| 88 | |||||||||||||||||||||||||||||||||||||||||||
| 89 | 0 | ▶ | sub from { # $fileView ($bounds, $aHScrollBar|undef, $aVScrollBar|undef, $aFileName) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
from: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 91 | method => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 92 | pos => [Object, Maybe[Object], Maybe[Object], Str], | ||||||||||||||||||||||||||||||||||||||||||
| 93 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 94 | 0 | my ( $class, @args ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | return $class->new( bounds => $args[0], hScrollBar => $args[1], | |||||||||||||||||||||||||||||||||||||||||
| 96 | vScrollBar => $args[2], fileName => $args[3] ); | ||||||||||||||||||||||||||||||||||||||||||
| 97 | } | ||||||||||||||||||||||||||||||||||||||||||
| 98 | |||||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | ▶ | sub DEMOLISH { # void ($in_global_destruction) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DEMOLISH: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 100 | 0 | my ( $self, $in_global_destruction ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | assert ( @_ == 2 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | 0 | ▶ | assert ( is_Object $self ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | ▶ | assert ( is_Bool $in_global_destruction ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 104 | 0 | undef $self->{fileName}; | |||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | $self->destroy( $self->{fileLines} ); | |||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | ▶ | sub draw { # void () | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
draw: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 110 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 111 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 112 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||
| 113 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 115 | 0 | my $p; | |||||||||||||||||||||||||||||||||||||||||
| 116 | |||||||||||||||||||||||||||||||||||||||||||
| 117 | 0 | my $c = $self->getColor( 0x0301 ); | |||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | for ( my $i = 0 ; $i < $self->{size}{y} ; $i++ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | 0 | my $b = TDrawBuffer->new(); | |||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | $b->moveChar( 0, ' ', $c, $self->{size}{x} ); | |||||||||||||||||||||||||||||||||||||||||
| 121 | 0 | ▶ | if ( $self->{delta}{y} + $i < $self->{fileLines}->getCount() ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $s; | |||||||||||||||||||||||||||||||||||||||||
| 123 | 0 | $p = $self->{fileLines}->at( $self->{delta}{y} + $i ); | |||||||||||||||||||||||||||||||||||||||||
| 124 | 0 | ▶ | if ( !$p || length( $p ) < $self->{delta}{x} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
not $p or length $p < $self->{"delta"}{"x"}
MC/DC0%0/2
not $p or length $p < $self->{"delta"}{"x"}
not $p
length $p < $self->{"delta"}{"x"}
Truth table0%0/3
not(A) or B
A= not $pB= length $p < $self->{"delta"}{"x"}
| |||||||||||||||||||||||||||||||||||||||||||
| 125 | 0 | $s = EOS; | |||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $s = substr( $p, $self->{delta}{x}, $self->{size}{x} ); | |||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | if ( length( substr( $p, $self->{delta}{x} ) ) > $self->{size}{x} ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | substr( $s, 0, $self->{size}{x} ) = EOS; | |||||||||||||||||||||||||||||||||||||||||
| 131 | } | ||||||||||||||||||||||||||||||||||||||||||
| 132 | } | ||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $b->moveStr( 0, substr( $s, 0, maxLineLength ), $c ); | |||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | 0 | $self->writeBuf( 0, $i, $self->{size}{x}, 1, $b ); | |||||||||||||||||||||||||||||||||||||||||
| 136 | } | ||||||||||||||||||||||||||||||||||||||||||
| 137 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | ▶ | sub readFile { # void ($fName) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
readFile: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 141 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 142 | method => 1, | ||||||||||||||||||||||||||||||||||||||||||
| 143 | pos => [Str], | ||||||||||||||||||||||||||||||||||||||||||
| 144 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 145 | 0 | my ( $self, $fName ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 146 | 0 | $self->{limit}{x} = 0; | |||||||||||||||||||||||||||||||||||||||||
| 147 | 0 | $self->{fileName} = $fName; | |||||||||||||||||||||||||||||||||||||||||
| 148 | 0 | $self->{fileLines} = TLineCollection->new( limit => 5, delta => 5 ); | |||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | my $fileToView = IO::File->new( $fName, 'r' ); | |||||||||||||||||||||||||||||||||||||||||
| 150 | 0 | ▶ | if ( !defined $fileToView ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | messageBox( "Invalid drive or directory", mfError | mfOKButton ); | |||||||||||||||||||||||||||||||||||||||||
| 152 | 0 | $self->{isValid} = false; | |||||||||||||||||||||||||||||||||||||||||
| 153 | } | ||||||||||||||||||||||||||||||||||||||||||
| 154 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 155 | 0 | my $line; | |||||||||||||||||||||||||||||||||||||||||
| 156 | 0 | ▶ | while ( !lowMemory() | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
not &lowMemory() || $fileToView->eof and defined($line = $fileToView->getline)
&lowMemory() || $fileToView->eof
MC/DC0%0/3
not &lowMemory() || $fileToView->eof and defined($line = $fileToView->getline)
&lowMemory()
$fileToView->eof
defined($line = $fileToView->getline)
Truth table0%0/4
not(A || B) and C
A= &lowMemory()B= $fileToView->eofC= defined($line = $fileToView->getline)
| |||||||||||||||||||||||||||||||||||||||||||
| 157 | && !$fileToView->eof() | ||||||||||||||||||||||||||||||||||||||||||
| 158 | && defined( $line = $fileToView->getline() ) | ||||||||||||||||||||||||||||||||||||||||||
| 159 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 160 | 0 | $line =~ s/\r?\n$//; # truncate trailing newline | |||||||||||||||||||||||||||||||||||||||||
| 161 | 0 | $self->{limit}{x} = max( $self->{limit}{x}, length( $line ) ); | |||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | $self->{fileLines}->insert( $line ); | |||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | $self->{isValid} = true; | |||||||||||||||||||||||||||||||||||||||||
| 165 | } | ||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | $self->{limit}{y} = $self->{fileLines}->getCount(); | |||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | sub setState { # void ($aState, $enable) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
setState: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 172 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 173 | pos => [PositiveOrZeroInt, Bool], | ||||||||||||||||||||||||||||||||||||||||||
| 174 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | my ( $self, $aState, $enable ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 176 | 0 | $self->SUPER::setState( $aState, $enable ); | |||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | if ( $enable && ( $aState & sfExposed ) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$enable and $aState & 2048
MC/DC0%0/2
$enable and $aState & 2048
$enable
$aState & 2048
Truth table0%0/3
A and B
A= $enableB= $aState & 2048
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | $self->setLimit( $self->{limit}{x}, $self->{limit}{y} ); | |||||||||||||||||||||||||||||||||||||||||
| 179 | } | ||||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | ▶ | sub scrollDraw { # void () | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
scrollDraw: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 185 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 186 | pos => [], | ||||||||||||||||||||||||||||||||||||||||||
| 187 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my ( $self ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | $self->SUPER::scrollDraw(); | |||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | $self->draw(); | |||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 192 | } | ||||||||||||||||||||||||||||||||||||||||||
| 193 | |||||||||||||||||||||||||||||||||||||||||||
| 194 | 0 | ▶ | sub valid { # $bool ($command) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
valid: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 195 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 196 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 197 | pos => [PositiveOrZeroInt], | ||||||||||||||||||||||||||||||||||||||||||
| 198 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 199 | 0 | my ( $self, undef ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 200 | return $self->{isValid} | ||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | } | |||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | ▶ | sub write :method { # void ($os) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
write: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 204 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 205 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 206 | pos => [Object], | ||||||||||||||||||||||||||||||||||||||||||
| 207 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 0 | my ( $self, $os ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | $self->SUPER::write( $os ); | |||||||||||||||||||||||||||||||||||||||||
| 210 | 0 | $os->put( $self->{fileName} ); | |||||||||||||||||||||||||||||||||||||||||
| 211 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 212 | } | ||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | sub read :method { # $self ($is) | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
read: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | 0 | state $sig = signature( | |||||||||||||||||||||||||||||||||||||||||
| 216 | method => Object, | ||||||||||||||||||||||||||||||||||||||||||
| 217 | pos => [Object], | ||||||||||||||||||||||||||||||||||||||||||
| 218 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | my ( $self, $is ) = $sig->( @_ ); | |||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | $self->SUPER::read( $is ); | |||||||||||||||||||||||||||||||||||||||||
| 221 | 0 | my $fileName = $is->get(); | |||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | $self->{fileName} = ''; | |||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | $self->readFile( $fileName ); | |||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | sub build { # $obj () | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
build: not called CC=4 SCAR=30.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | 0 | my ( $class ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | ▶ | assert ( @_ == 1 ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 230 | 0 | ▶ | assert ( is_Str $class ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | assert ( Storable::is_retrieving ); | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | return $class->new( | |||||||||||||||||||||||||||||||||||||||||
| 233 | bounds => TRect->new(), | ||||||||||||||||||||||||||||||||||||||||||
| 234 | hScrollBar => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 235 | vScrollBar => undef, | ||||||||||||||||||||||||||||||||||||||||||
| 236 | fileName => File::Spec->devnull, | ||||||||||||||||||||||||||||||||||||||||||
| 237 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 238 | } | ||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 6 | 1 | |||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | __END__ | ||||||||||||||||||||||||||||||||||||||||||