examples/custom.pl

filter: Statementstmt 81.8% 9 / 11 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 86.6% 13 / 15 CC 1 SCAR 0.7
CC
1
Cov
82%
BEGIN
1.3
BEGIN
1.0
BEGIN
1.0
CRAP 1.1
« blib/lib/Archive/Libarchive/Lib/Unbound.pm ↑ Summary examples/defilter.pl »
1 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
2 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use 5.020;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 0 ▶use Archive::Libarchive qw( :const );
Subroutine BEGIN: called CC=1 SCAR=2.6
5  
6 my $r = Archive::Libarchive::ArchiveRead->new;
7 $r->support_filter_all;
8 $r->support_format_all;
9  
10 my $fh;
11  
12 $r->open(
13 open => sub {
14 open $fh, '<', 'archive.tar';
15 binmode $fh;
16 return ARCHIVE_OK;
17 },
18 read => sub {
19 my(undef, $ref) = @_;
20 my $size = read $fh, $$ref, 512;
21 return $size;
22 },
23 close => sub {
24 close $fh;
25 return ARCHIVE_OK;
26 },
27 ) == ARCHIVE_OK or die $r->error_string;
28  
29 my $e = Archive::Libarchive::Entry->new;
30 while(1) {
31 my $ret = $r->next_header($e);
32 last if $ret == ARCHIVE_EOF;
33 die $r->error_string if $ret < ARCHIVE_WARN;
34 warn $r->error_string if $ret != ARCHIVE_OK;
35 say $e->pathname;
36 }
37  
38 $r->close;
« blib/lib/Archive/Libarchive/Lib/Unbound.pm ↑ Summary examples/defilter.pl »