lib/TUI/StdDlg/FileInputLine.pm

filter: Statementstmt 50.6% 38 / 75 Branchbran 0.0% 0 / 16 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 68.7% 11 / 16 Podpod 80.0% 4 / 5 totaltotal 43.8% 53 / 121 CC 11 SCAR 35.0
CC
11
Cov
39%
handleEvent
90.0
BUILD
12.0
new_TFileInputLine
2.0
CRAP 33.2
« lib/TUI/Dialogs/History.pm ↑ Summary lib/TUI/Dialogs/Label.pm »
1 package TUI::StdDlg::FileInputLine;
2 # ABSTRACT: Input line view for file dialog focus handling
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.000002';
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 TFileInputLine
15 new_TFileInputLine
16 );
17
18 5 ▶use TUI::toolkit;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 5 ▶use TUI::toolkit::Types qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
20 is_Object
21 :types
22 5 );
23
24 5 ▶use TUI::Dialogs::InputLine;
Subroutine BEGIN: called CC=1 SCAR=0.0
25 5 ▶use TUI::Drivers::Const qw( evBroadcast );
Subroutine BEGIN: called CC=1 SCAR=0.0
26 5 ▶use TUI::StdDlg::Const qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
27 cmFileFocused
28 FA_DIREC
29 5 );
30 5 ▶use TUI::StdDlg::Util qw( fexpand );
Subroutine BEGIN: called CC=1 SCAR=0.0
31 5 ▶use TUI::Views::Const qw( sfSelected );
Subroutine BEGIN: called CC=1 SCAR=0.0
32
33 sub TFileInputLine() { __PACKAGE__ }
34 sub name() { 'TFileInputLine' };
35 0 ▶sub new_TFileInputLine { __PACKAGE__->from(@_) }
Subroutine new_TFileInputLine: not called CC=1 SCAR=6.9
Pod documented
36
37 5 extends TInputLine;
38
39 0 ▶sub BUILDARGS { # \%args (|%args)
Subroutine BUILDARGS: not called CC=1 SCAR=6.9
Pod documented
40 0 state $sig = signature(
41 method => 1,
42 named => [
43 bounds => Object,
44 maxLen => Int, { alias => 'aMaxLen' },
45 ],
46 caller_level => +1,
47 );
48 0 my ( $class, $args ) = $sig->( @_ );
49 0 return { %$args };
50 }
51
52 0 ▶sub BUILD { # void (\%args)
Subroutine BUILD: not called CC=3 SCAR=24.8
Pod documented
53 0 my ( $self, $args ) = @_;
54 0 ▶ assert ( @_ == 2 );
Branch: 1 branch
BranchTrueFalseTotal
unless @_ == 2 0 0 0
55 0 ▶ assert ( is_Object $self );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($self) 0 0 0
56 0 $self->{eventMask} = evBroadcast;
57 0 return;
58 }
59
60 0 ▶sub from { # $obj ($aLimit, $aDelta)
Subroutine from: not called CC=1 SCAR=6.9
Pod undocumented
61 0 state $sig = signature(
62 method => 1,
63 pos => [Object, Int],
64 );
65 0 my ( $class, @args ) = $sig->( @_ );
66 0 return $class->new( bounds => $args[0], maxLen => $args[1] );
67 }
68
69 0 ▶sub handleEvent { # void ($event)
Subroutine handleEvent: not called CC=9 SCAR=45.0
Pod documented
70 0 state $sig = signature(
71 method => Object,
72 pos => [Object],
73 );
74 0 my ( $self, $event ) = $sig->( @_ );
75 0 $self->SUPER::handleEvent( $event );
76
77 0 ▶ if ( $event->{what} == evBroadcast
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{"what"} == 512 and $event->{"message"}{"command"} == 102 and not $self->{"state"} & 32) 0 0 0
Condition0%0/6
$event->{"what"} == 512 and $event->{"message"}{"command"} == 102 and not $self->{"state"} & 32
!ll&&!rl&&r
000
$event->{"what"} == 512 and $event->{"message"}{"command"} == 102
!ll&&!rl&&r
000
MC/DC0%0/3
$event->{"what"} == 512 and $event->{"message"}{"command"} == 102 and not $self->{"state"} & 32
$event->{"what"} == 512 $event->{"message"}{"command"} == 102 not $self->{"state"} & 32
Truth table0%0/4
A and B and not(C)
A= $event->{"what"} == 512B= $event->{"message"}{"command"} == 102C= not $self->{"state"} & 32
ABCresult
0XX0
10X0
1100
1111
78 && $event->{message}{command} == cmFileFocused
79 && !( $self->{state} & sfSelected )
80 ) {
81 # Prevents incorrect display in the input line if wildCard has
82 0 # already been expanded.
83 0 ▶ assert ( is_Object $event->{message}{infoPtr} );
Branch: 1 branch
BranchTrueFalseTotal
unless &is_Object($event->{"message"}{"infoPtr"}) 0 0 0
84 0 ▶ assert ( defined $event->{message}{infoPtr}->name );
Branch: 1 branch
BranchTrueFalseTotal
unless defined $event->{"message"}{"infoPtr"}->name 0 0 0
85 0 ▶ if ( $event->{message}{infoPtr}->attr & FA_DIREC ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($event->{'message'}{'infoPtr'}->attr & 16) { } 0 0 0
86 0 $self->{data} = $self->{owner}->wildCard;
87 0 ▶ if ( $self->{data} !~ /[:\\]/ ) {
Branch: 1 branch
BranchTrueFalseTotal
if (not $self->{'data'} =~ /[:\\]/) { } 0 0 0
88 $self->{data} = $event->{message}{infoPtr}->name
89 . "\\"
90 0 . $self->{owner}->wildCard;
91 }
92 else {
93 # Insert "<name>\\" between last name/wildcard and last '\'
94 0 fexpand( $self->{data} ); # Insure complete expansion to begin with
95 0 my $pos = rindex( $self->{data}, '\\' );
96 0 my $nm = $event->{message}{infoPtr}->name;
97 0 ▶ if ( $pos >= 0 ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($pos >= 0) { } 0 0 0
98 0 my $offset = $pos + 1; # position after last '\'
99 0 substr( $self->{data}, $offset, 0 ) = $nm . '\\';
100 }
101 else {
102 # No backslash found: prepend "<name>\"
103 0 $self->{data} = $nm . '\\' . $self->{data};
104 }
105 0 fexpand( $self->{data} ); # Expand again incase it was '..'.
106 }
107 }
108 else {
109 0 $self->{data} = $event->{message}{infoPtr}->name;
110 0 $self->drawView();
111 }
112 }
113 0 return;
114 } #/ sub handleEvent
115
116 5 1
117
118 __END__
« lib/TUI/Dialogs/History.pm ↑ Summary lib/TUI/Dialogs/Label.pm »