Medley/File/Zip.pm

filter: Statementstmt 52.2% 46 / 88 Branchbran 0.0% 0 / 40 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 87.5% 14 / 16 Podpod n/a totaltotal 40.2% 60 / 149 CC 23 SCAR 40.1
CC
23
Cov
35%
ls
101.6
ls
66.2
BEGIN
1.5
CRAP 55.3
« Medley/Crypt.pm ↑ Summary Medley/String.pm »
1 package Util::Medley::File::Zip;
2 1 $Util::Medley::File::Zip::VERSION = '0.049';
3 1 ▶use Modern::Perl;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 1 ▶use Kavorka '-all';
Subroutine BEGIN: called CC=1 SCAR=0.0
7 1 ▶use Data::Printer alias => 'pdump';
Subroutine BEGIN: called CC=1 SCAR=0.0
8 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Archive::Zip; # qw( :ERROR_CODES :CONSTANTS );
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 =head1 NAME
12  
13 Util::Medley::File::Zip - utility methods for working with zipfiles.
14  
15 =head1 VERSION
16  
17 version 0.049
18  
19 =cut
20  
21 =head1 SYNOPSIS
22  
23 my $fz = Util::Medley::File::Zip->new;
24  
25 my @list = $fz->ls('my.zip');
26
27 =cut
28  
29 =head2 DESCRIPTION
30  
31 Provides frequently used zipfile operation methods.
32  
33 =cut
34  
35 #########################################################################################
36  
37 =head1 METHODS
38  
39 =over
40  
41 =item usage:
42  
43 @list = $util->ls($file);
44  
45 @list = $util->ls(file => $file);
46
47 =item args:
48  
49 =over
50  
51 =item file [Str]
52  
53 The path of the zipfile.
54  
55 =back
56  
57 =back
58  
59 =cut
60  
61 1 ▶multi method ls (Str :$file!) {
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine BEGIN: called CC=1 SCAR=3.7
Subroutine ls: not called CC=14 SCAR=46.2
Branch: 11 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 0 0 0
@_ ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ == 0 and ref $_[0] eq 'HASH') { } 0 0 0
if ($slice_length % 2 != 0) 0 0 0
if ($i <= $#_) 0 0 0
$OK{$_} or Carp::croak("Unknown named parameter: $_") 0 0 0
exists $_{'file'} ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if (exists $_{"file"}) 0 0 0
Type::Tiny::XS::Str($file) or _failed_check(9, "Str", $file, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
Condition0%0/3
$#_ == 0 and ref $_[0] eq "HASH"
!ll&&!rl&&r
000
MC/DC0%0/2
$#_ == 0 and ref $_[0] eq "HASH"
$#_ == 0 ref $_[0] eq "HASH"
Truth table0%0/3
A and B
A= $#_ == 0B= ref $_[0] eq "HASH"
ABresult
0X0
100
111
62  
63 0 return $self->ls($file);
64 }
65  
66 1 ▶multi method ls (Str $file) {
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine BEGIN: called CC=1 SCAR=4.1
Subroutine ls: not called CC=10 SCAR=41.9
Branch: 8 branches
BranchTrueFalseTotal
ref $_[0] eq 'Kavorka::Signature::NOBBLE' ? : 0 0 0
@_ ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if @_ != 1 0 0 0
$#_ >= 0 ? : 0 0 0
unless ($____nobble_checks) 0 0 0
if ($#_ >= 0) 0 0 0
Type::Tiny::XS::Str($file) or _failed_check(9, "Str", $file, "exception_class", "Error::TypeTiny::Assertion") 0 0 0
67  
68 0 my $zip = Archive::Zip->new;
69 0 ▶ $zip->read($file) or confess "zip read error";
Branch: 1 branch
BranchTrueFalseTotal
$zip->read($file) or confess("zip read error") 0 0 0
70
71 0 return $zip->memberNames;
72 }
73
74 ######################################################################
75  
76  
77 1 1;
« Medley/Crypt.pm ↑ Summary Medley/String.pm »