Die/rmdir.pm

filter: Statementstmt 100% 12 / 12 Branchbran 100% 6 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 2 / 2 Podpod n/a totaltotal 100% 20 / 20 CC 4 SCAR 12.2
CC
4
Cov
100%
rmdir
4.0
BEGIN
1.0
CRAP 3.4
« Die/mkdir.pm ↑ Summary Die/unlink.pm »
1 package IO::Die;
2  
3 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 16 ▶sub rmdir {
Subroutine rmdir: called CC=4 SCAR=13.9
6 16 my ( $NS, @args ) = @_;
7  
8 #Perl's rmdir() doesn’t actually allow batching like this,
9 #but we might as well prevent anyone from trying.
10 16 ▶ die "Only one path at a time!" if @args > 1;
Branch: 1 branch
BranchTrueFalseTotal
if @args > 1 4 12 16
11  
12 12 ▶ if ( !@args ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (@args) 4 8 12
13 4 @args = ($_);
14 }
15  
16 12 local ( $!, $^E );
17 12 ▶ my $ok = CORE::rmdir( $args[0] ) or do {
Branch: 1 branch
BranchTrueFalseTotal
my $ok = CORE::rmdir $args[0] or do { $NS->__THROW("DirectoryDelete", "path", $args[0]) } 8 4 12
18 4 $NS->__THROW( 'DirectoryDelete', path => $args[0] );
19 };
20  
21 8 return $ok;
22 }
23  
24 4 1;
« Die/mkdir.pm ↑ Summary Die/unlink.pm »