examples/write.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
« examples/synopsis/synopsis.pl ↑ Summary blib/lib/Archive/Libarchive/Archive.pm »
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;
Subroutine BEGIN: called CC=1 SCAR=2.6
5 use Path::Tiny qw( path );
6  
7 my $w = Archive::Libarchive::ArchiveWrite->new;
8 $w->set_format_pax_restricted;
9 $w->open_filename("outarchive.tar");
10  
11 path('.')->visit(sub ($path, $) {
12 my $path = shift;
13  
14 return if $path->is_dir;
15  
16 my $e = Archive::Libarchive::Entry->new;
17 $e->set_pathname("$path");
18 $e->set_size(-s $path);
19 $e->set_filetype('reg');
20 $e->set_perm( oct('0644') );
21 $w->write_header($e);
22 $w->write_data(\$path->slurp_raw);
23  
24 }, { recurse => 1 });
25  
26 $w->close;
« examples/synopsis/synopsis.pl ↑ Summary blib/lib/Archive/Libarchive/Archive.pm »