| 1 | 5 | ▶ | use strict; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 2 | 5 | ▶ | use warnings; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 3 | 5 | ▶ | use 5.022; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 4 | |||||||||||||||||||||
| 5 | 5 | package Alien::Build::Wizard::Detect 0.07 { | |||||||||||||||||||
| 6 | |||||||||||||||||||||
| 7 | 5 | ▶ | use Moose; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 8 | 5 | ▶ | use Moose::Util::TypeConstraints; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 9 | 5 | ▶ | use MooseX::StrictConstructor; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 10 | 5 | ▶ | use Path::Tiny (); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 11 | 5 | ▶ | use experimental qw( signatures postderef ); | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 12 | 5 | ▶ | use namespace::autoclean; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 13 | 5 | ▶ | use constant myURI => "@{[ __PACKAGE__ ]}::URI"; | ||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 14 | |||||||||||||||||||||
| 15 | # ABSTRACT: Tarball detection class | ||||||||||||||||||||
| 16 | |||||||||||||||||||||
| 17 | 5 | subtype myURI, as 'URI'; | |||||||||||||||||||
| 18 | |||||||||||||||||||||
| 19 | 4 | ▶ | coerce myURI, from 'Str', via { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=2 SCAR=7.0
| |||||||||||||||||||||
| 20 | 4 | require URI; | |||||||||||||||||||
| 21 | 4 | ▶ | state $base ||= do { | ||||||||||||||||||
|
Condition66%2/3
state $base ||= do {
require URI::file;
my $base = "URI"->new("URI::file"->cwd);
$base->host("localhost");
$base
}
MC/DC0%0/2
state $base ||= do {
require URI::file;
my $base = "URI"->new("URI::file"->cwd);
$base->host("localhost");
$base
}
state $base
do {
require URI::file;
my $base = "URI"->new("URI::file"->cwd);
$base->host("localhost");
$base
}
Truth table66%2/3
A ||= B
A= state $baseB= do {
require URI::file;
my $base = "URI"->new("URI::file"->cwd);
$base->host("localhost");
$base
}
| |||||||||||||||||||||
| 22 | 3 | require URI::file; | |||||||||||||||||||
| 23 | 3 | my $base = URI->new(URI::file->cwd); | |||||||||||||||||||
| 24 | 3 | $base->host("localhost"); | |||||||||||||||||||
| 25 | 3 | $base; | |||||||||||||||||||
| 26 | }; | ||||||||||||||||||||
| 27 | 4 | URI->new_abs($_, $base); | |||||||||||||||||||
| 28 | 5 | }; | |||||||||||||||||||
| 29 | |||||||||||||||||||||
| 30 | 5 | has uri => ( | |||||||||||||||||||
| 31 | is => 'ro', | ||||||||||||||||||||
| 32 | isa => myURI, | ||||||||||||||||||||
| 33 | required => 1, | ||||||||||||||||||||
| 34 | coerce => 1, | ||||||||||||||||||||
| 35 | ); | ||||||||||||||||||||
| 36 | |||||||||||||||||||||
| 37 | has ua => ( | ||||||||||||||||||||
| 38 | is => 'ro', | ||||||||||||||||||||
| 39 | isa => 'LWP::UserAgent', | ||||||||||||||||||||
| 40 | lazy => 1, | ||||||||||||||||||||
| 41 | 1 | ▶ | default => sub { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 42 | 1 | require LWP::UserAgent; | |||||||||||||||||||
| 43 | 1 | my $ua = LWP::UserAgent->new; | |||||||||||||||||||
| 44 | 1 | $ua->env_proxy; | |||||||||||||||||||
| 45 | 1 | $ua; | |||||||||||||||||||
| 46 | }, | ||||||||||||||||||||
| 47 | 5 | ); | |||||||||||||||||||
| 48 | |||||||||||||||||||||
| 49 | has tarball => ( | ||||||||||||||||||||
| 50 | is => 'ro', | ||||||||||||||||||||
| 51 | lazy => 1, | ||||||||||||||||||||
| 52 | isa => 'ScalarRef[Str]', | ||||||||||||||||||||
| 53 | init_arg => undef, | ||||||||||||||||||||
| 54 | 0 | ▶ | default => sub ($self) { | ||||||||||||||||||
|
Subroutine
__ANON__: not called CC=3 SCAR=24.8
| |||||||||||||||||||||
| 55 | 0 | my $ua = $self->ua; | |||||||||||||||||||
| 56 | 0 | my $res = $ua->get($self->uri); | |||||||||||||||||||
| 57 | 0 | ▶ | die $res->status_line | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 58 | unless $res->is_success; | ||||||||||||||||||||
| 59 | 0 | ▶ | defined $res->decoded_content | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 60 | ? \$res->decoded_content | ||||||||||||||||||||
| 61 | : \$res->content; | ||||||||||||||||||||
| 62 | }, | ||||||||||||||||||||
| 63 | 5 | ); | |||||||||||||||||||
| 64 | |||||||||||||||||||||
| 65 | has file_list => ( | ||||||||||||||||||||
| 66 | is => 'ro', | ||||||||||||||||||||
| 67 | isa => 'ArrayRef[Path::Tiny]', | ||||||||||||||||||||
| 68 | lazy => 1, | ||||||||||||||||||||
| 69 | init_arg => undef, | ||||||||||||||||||||
| 70 | 7 | ▶ | default => sub ($self) { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=2.6
| |||||||||||||||||||||
| 71 | 7 | require Archive::Libarchive::Peek; | |||||||||||||||||||
| 72 | 0 | [map { Path::Tiny->new($_) } Archive::Libarchive::Peek->new( memory => $self->tarball )->files]; | |||||||||||||||||||
| 73 | } | ||||||||||||||||||||
| 74 | 5 | ); | |||||||||||||||||||
| 75 | |||||||||||||||||||||
| 76 | has build_type => ( | ||||||||||||||||||||
| 77 | is => 'ro', | ||||||||||||||||||||
| 78 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||
| 79 | lazy => 1, | ||||||||||||||||||||
| 80 | init_arg => undef, | ||||||||||||||||||||
| 81 | 2 | ▶ | default => sub ($self) { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=5 SCAR=29.7
| |||||||||||||||||||||
| 82 | |||||||||||||||||||||
| 83 | 2 | my %types; | |||||||||||||||||||
| 84 | |||||||||||||||||||||
| 85 | 2 | foreach my $file ($self->file_list->@*) | |||||||||||||||||||
| 86 | { | ||||||||||||||||||||
| 87 | 0 | ▶ | $types{autoconf} = 1 if $file->basename eq 'configure'; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 88 | 0 | ▶ | $types{cmake} = 1 if $file->basename eq 'CMakeLists.txt'; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 89 | 0 | ▶ | $types{make} = 1 if $file->basename eq 'Makefile'; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 90 | } | ||||||||||||||||||||
| 91 | |||||||||||||||||||||
| 92 | 0 | [sort keys %types]; | |||||||||||||||||||
| 93 | }, | ||||||||||||||||||||
| 94 | 5 | ); | |||||||||||||||||||
| 95 | |||||||||||||||||||||
| 96 | has name => ( | ||||||||||||||||||||
| 97 | is => 'ro', | ||||||||||||||||||||
| 98 | isa => 'Str', | ||||||||||||||||||||
| 99 | lazy => 1, | ||||||||||||||||||||
| 100 | init_arg => undef, | ||||||||||||||||||||
| 101 | 4 | ▶ | default => sub ($self) { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||
| 102 | 4 | Path::Tiny->new($self->uri->path)->basename =~ s/[-\.].*$//r; | |||||||||||||||||||
| 103 | }, | ||||||||||||||||||||
| 104 | 5 | ); | |||||||||||||||||||
| 105 | |||||||||||||||||||||
| 106 | has pkg_config => ( | ||||||||||||||||||||
| 107 | is => 'ro', | ||||||||||||||||||||
| 108 | isa => 'ArrayRef[Str]', | ||||||||||||||||||||
| 109 | lazy => 1, | ||||||||||||||||||||
| 110 | init_arg => undef, | ||||||||||||||||||||
| 111 | 5 | ▶ | default => sub ($self) { | ||||||||||||||||||
|
Subroutine
__ANON__: called CC=3 SCAR=17.3
| |||||||||||||||||||||
| 112 | |||||||||||||||||||||
| 113 | 5 | my %pc; | |||||||||||||||||||
| 114 | |||||||||||||||||||||
| 115 | 5 | foreach my $file ($self->file_list->@*) | |||||||||||||||||||
| 116 | { | ||||||||||||||||||||
| 117 | 0 | ▶ | $pc{$1} = 1 if $file->basename =~ /^(.*)\.pc(\.in)?$/; | ||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||
| 118 | } | ||||||||||||||||||||
| 119 | |||||||||||||||||||||
| 120 | 0 | [sort keys %pc]; | |||||||||||||||||||
| 121 | }, | ||||||||||||||||||||
| 122 | 5 | ); | |||||||||||||||||||
| 123 | |||||||||||||||||||||
| 124 | 5 | __PACKAGE__->meta->make_immutable; | |||||||||||||||||||
| 125 | |||||||||||||||||||||
| 126 | } | ||||||||||||||||||||
| 127 | |||||||||||||||||||||
| 128 | 5 | 1; | |||||||||||||||||||
| 129 | |||||||||||||||||||||
| 130 | __END__ | ||||||||||||||||||||