lib/TUI/StdDlg/DirEntry.pm

filter: Statementstmt 83.3% 40 / 48 Branchbran n/a Conditioncond 33.3% 2 / 6 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 75.0% 12 / 16 Podpod 80.0% 4 / 5 totaltotal 73.4% 58 / 79 CC 3 SCAR 4.8
CC
3
Cov
78%
new
3.3
__ANON__
2.0
__ANON__
2.0
CRAP 1.6
« lib/TUI/StdDlg/Dos.pm ↑ Summary lib/TUI/Dialogs/RadioButtons.pm »
1 package TUI::StdDlg::DirEntry;
2 # ABSTRACT: A directory entry for use in TDirCollection
3
4 7 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 7 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 7 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 7 our $VERSION = '2.000002';
9 7 $VERSION =~ tr/_//d;
10 7 our $AUTHORITY = 'cpan:BRICKPOOL';
11
12 7 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 7 our @EXPORT = qw(
14 TDirEntry
15 new_TDirEntry
16 );
17
18 7 ▶use Devel::StrictMode;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 7 ▶use if STRICT => 'Hash::Util';
Subroutine BEGIN: called CC=1 SCAR=0.0
20 7 ▶use TUI::toolkit qw( signature );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 7 ▶use TUI::toolkit::Types qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
22 Object
23 Str
24 7 );
25
26 sub TDirEntry() { __PACKAGE__ }
27 3 ▶sub new_TDirEntry { __PACKAGE__->from(@_) }
Subroutine new_TDirEntry: called CC=1 SCAR=0.0
Pod documented
28
29 # private attributes
30 7 ▶our %HAS; BEGIN {
Subroutine BEGIN: called CC=1 SCAR=1.2
31 %HAS = (
32 0 ▶ displayText => sub { die 'required' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
33 0 ▶ directory => sub { die 'required' },
Subroutine __ANON__: not called CC=1 SCAR=6.9
34 7 );
35 }
36
37 7 ▶sub new { # \$obj (%args)
Subroutine new: called CC=3 SCAR=12.0
Pod documented
38 7 state $sig = signature(
39 method => 1,
40 named => [
41 displayText => Str, { alias => 'txt' },
42 directory => Str, { alias => 'dir' },
43 ],
44 );
45 7 my ( $class, $args ) = $sig->( @_ );
46 my $self = {
47 displayText => $args->{displayText} // $HAS{displayText}->(),
48 5 ▶ directory => $args->{directory} // $HAS{directory}->(),
Condition33%2/6
$args->{"displayText"} // $TUI::StdDlg::DirEntry::HAS{"displayText"}->()
l!l&&r!l&&!r
500
$args->{"directory"} // $TUI::StdDlg::DirEntry::HAS{"directory"}->()
l!l&&r!l&&!r
500
MC/DC0%0/2
$args->{"displayText"} // $TUI::StdDlg::DirEntry::HAS{"displayText"}->()
$args->{"displayText"} $TUI::StdDlg::DirEntry::HAS{"displayText"}->()
MC/DC0%0/2
$args->{"directory"} // $TUI::StdDlg::DirEntry::HAS{"directory"}->()
$args->{"directory"} $TUI::StdDlg::DirEntry::HAS{"directory"}->()
Truth table33%1/3
A // B
A= $args->{"displayText"}B= $TUI::StdDlg::DirEntry::HAS{"displayText"}->()
ABresult
1X1
011
000
Truth table33%1/3
A // B
A= $args->{"directory"}B= $TUI::StdDlg::DirEntry::HAS{"directory"}->()
ABresult
1X1
011
000
49 };
50 5 bless $self, $class;
51 5 Hash::Util::lock_keys( %$self ) if STRICT;
52 5 return $self;
53 }
54
55 3 ▶sub from { # $obj ($txt, $dir)
Subroutine from: called CC=1 SCAR=0.0
Pod undocumented
56 3 state $sig = signature(
57 method => 1,
58 pos => [Str, Str],
59 );
60 3 my ( $class, @args ) = $sig->( @_ );
61 3 return $class->new( displayText => $args[0], directory => $args[1] );
62 }
63
64 0 ▶sub dir {
Subroutine dir: not called CC=1 SCAR=6.9
Pod documented
65 0 state $sig = signature(
66 method => Object,
67 pos => [],
68 );
69 0 my ( $self ) = $sig->( @_ );
70 0 return $self->{directory};
71 }
72
73 0 ▶sub text {
Subroutine text: not called CC=1 SCAR=6.9
Pod documented
74 0 state $sig = signature(
75 method => Object,
76 pos => [],
77 );
78 0 my ( $self ) = $sig->( @_ );
79 0 return $self->{displayText};
80 }
81
82 7 1
83
84 __END__
« lib/TUI/StdDlg/Dos.pm ↑ Summary lib/TUI/Dialogs/RadioButtons.pm »