lib/TUI/StdDlg/Dos.pm

filter: Statementstmt 97.6% 41 / 42 Branchbran 83.3% 5 / 6 Conditioncond 66.6% 2 / 3 MC/DCmcdc 50.0% 1 / 2 Subroutinesub 100% 10 / 10 Podpod n/a totaltotal 93.6% 59 / 63 CC 5 SCAR 6.3
CC
5
Cov
94%
_dos_findfirst
3.1
_dos_findnext
3.0
BEGIN
1.0
CRAP 1.9
« script/overview.pl ↑ Summary lib/TUI/StdDlg/DirEntry.pm »
1 package TUI::StdDlg::Dos;
2 # ABSTRACT: Defines structures and functions for use similar to MS-DOS
3
4 12 ▶use 5.010;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 12 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 12 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 12 our $VERSION = '2.000002';
9 12 $VERSION =~ tr/_//d;
10 12 our $AUTHORITY = 'cpan:BRICKPOOL';
11
12 12 ▶use Exporter 'import';
Subroutine BEGIN: called CC=1 SCAR=0.0
13 12 our @EXPORT_OK = qw(
14 _dos_findfirst
15 _dos_findnext
16 );
17
18 12 our %EXPORT_TAGS = (
19 all => \@EXPORT_OK,
20 );
21
22 12 ▶use Class::Struct;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 12 ▶use TUI::toolkit qw( signature );
Subroutine BEGIN: called CC=1 SCAR=0.0
24 12 ▶use TUI::toolkit::Types qw( :types );
Subroutine BEGIN: called CC=1 SCAR=0.0
25
26 12 ▶use TUI::StdDlg::FindFirstRec;
Subroutine BEGIN: called CC=1 SCAR=0.0
27
28 12 struct ffblk => [
29 ff_reserved => '$',
30 ff_fsize => '$',
31 ff_attrib => '$',
32 ff_ftime => '$',
33 ff_fdate => '$',
34 ff_name => '$',
35 ];
36
37 # The MSC find_t structure corresponds exactly to the ffblk structure
38 12 struct find_t => [
39 reserved => '$',
40 size => '$', # size of file
41 attrib => '$', # attribute byte for matched file
42 wr_time => '$', # time of last write to file
43 wr_date => '$', # date of last write to file
44 name => '$', # string name of matched file
45 ];
46
47 7 ▶sub _dos_findfirst { # $int ($pathname, $attrib, $finfo)
Subroutine _dos_findfirst: called CC=3 SCAR=11.2
48 7 state $sig = signature(
49 pos => [Str, PositiveOrZeroInt, ArrayLike],
50 );
51 7 my ( $pathname, $attrib, $finfo ) = $sig->( @_ );
52 # The original findfirst sets errno on failure. We don't do this for now.
53 7 my $r;
54 7 ▶ if ( $r = FindFirstRec->allocate( $finfo, $attrib, $pathname ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($r = &FindFirstRec()->allocate($finfo, $attrib, $pathname)) 7 0 7
55 7 ▶ return $r->next() ? 0 : -1;
Branch: 1 branch
BranchTrueFalseTotal
$r->next ? : 6 1 7
56 }
57 0 return -1
58 }
59
60 21 ▶sub _dos_findnext { # $int ($finfo)
Subroutine _dos_findnext: called CC=3 SCAR=11.0
61 21 state $sig = signature(
62 pos => [ArrayLike],
63 );
64 21 my ( $finfo ) = $sig->( @_ );
65 21 my $r = FindFirstRec->get( $finfo );
66 21 ▶ return 0
Branch: 1 branch
BranchTrueFalseTotal
if $r and $r->next 19 2 21
Condition66%2/3
$r and $r->next
!ll&&!rl&&r
0219
MC/DC50%1/2
$r and $r->next
$r $r->next
Truth table66%2/3
A and B
A= $rB= $r->next
ABresult
0X0
100
111
67 if $r && $r->next();
68 2 return -1;
69 }
70
71 12 1
72
73 __END__
« script/overview.pl ↑ Summary lib/TUI/StdDlg/DirEntry.pm »