File Coverage

blib/lib/Alien/Libarchive.pm
Criterion Covered Total %
statement 34 36 94.4
branch 8 8 100.0
condition n/a
subroutine 13 14 92.8
pod 0 8 0.0
total 55 66 83.3


line stmt bran cond sub pod time code
1             package Alien::Libarchive;
2              
3 1     1   230120 use strict;
  1         7  
  1         29  
4 1     1   5 use warnings;
  1         2  
  1         25  
5 1     1   415 use Alien::Libarchive3;
  1         3  
  1         10  
6 1     1   30646 use Path::Tiny qw( path );
  1         3  
  1         57  
7 1     1   7 use Text::ParseWords qw( shellwords );
  1         1  
  1         431  
8              
9             # ABSTRACT: Legacy alien for libarchive
10             our $VERSION = '0.29'; # VERSION
11              
12              
13             sub new
14             {
15 0     0 0 0 my($class) = @_;
16 0         0 bless {}, $class;
17             }
18              
19             sub cflags
20             {
21             wantarray
22 2 100   2 0 8264 ? shellwords(Alien::Libarchive3->cflags)
23             : Alien::Libarchive3->cflags;
24             }
25              
26             sub libs
27             {
28             wantarray
29 2 100   2 0 1413 ? shellwords(Alien::Libarchive3->libs)
30             : Alien::Libarchive3->libs;
31             }
32              
33             sub dlls
34             {
35 2     2 0 4057 my @libs = Alien::Libarchive3->dynamic_libs;
36 2 100       6378 wantarray ? @libs : $libs[0];
37             }
38              
39             sub version
40             {
41 1     1 0 6454 Alien::Libarchive3->version;
42             }
43              
44             sub install_type
45             {
46 1     1 0 1876 Alien::Libarchive3->install_type;
47             }
48              
49             sub pkg_config_dir
50             {
51 1     1 0 1821 path(Alien::Libarchive3->dist_dir, 'lib', 'pkgconfig')->stringify;
52             }
53              
54             sub pkg_config_name
55             {
56 1     1 0 2168 'libarchive';
57             }
58              
59             sub _macro_list
60             {
61 1     1   1757 require Config;
62              
63 1         75 my $cc = "$Config::Config{ccname} $Config::Config{ccflags} " . Alien::Libarchive3->cflags;
64              
65 1         191 my $tempdir = Path::Tiny->tempdir;
66 1         838 my $file = path($tempdir, 'test.c');
67 1         40 $file->spew(
68             "#include \n#include \n"
69             );
70              
71 1         501 my @list;
72 1         8 my $cmd = "$cc -E -dM $file";
73 1         27060 foreach my $line (`$cmd`)
74             {
75 1568 100       2891 if($line =~ /^#define ((AE|ARCHIVE)_\S+)/)
76             {
77 165         480 push @list, $1;
78             }
79             }
80 1         255 sort @list;
81             }
82              
83             1;
84              
85             __END__