Alien-Base-ModuleBuild
view release on metacpan or search on metacpan
lib/Alien/Base/ModuleBuild/Cabinet.pm view on Meta::CPAN
use warnings;
use Sort::Versions qw( versioncmp );
# ABSTRACT: Private class
our $VERSION = '1.17'; # VERSION
sub new {
my $class = shift;
my $self = ref $_[0] ? shift : { @_ };
bless $self, $class;
return $self;
}
sub files { shift->{files} }
sub add_files {
my $self = shift;
push @{ $self->{files} }, @_;
return $self->files;
lib/Alien/Base/ModuleBuild/File.pm view on Meta::CPAN
use warnings;
use Carp;
# ABSTRACT: Private class
our $VERSION = '1.17'; # VERSION
sub new {
my $class = shift;
my $self = ref $_[0] ? shift : { @_ };
bless $self, $class;
return $self;
}
sub has_version {
my $self = shift;
return defined $self->version;
}
sub get {
lib/Alien/Base/ModuleBuild/Repository.pm view on Meta::CPAN
use Alien::Base::ModuleBuild::File;
use Alien::Base::ModuleBuild::Utils qw/pattern_has_capture_groups/;
# ABSTRACT: Private class
our $VERSION = '1.17'; # VERSION
sub new {
my $class = shift;
my (%self) = ref $_[0] ? %{ shift() } : @_;
my $obj = bless \%self, $class;
$obj->{c_compiler_required} = 1
unless defined $obj->{c_compiler_required};
my $location = $obj->{location};
$location = '' unless defined $location;
if(defined $obj->{exact_filename} && $location !~ m{/$}) {
$obj->{location} = $location . '/'
}
lib/Alien/Base/ModuleBuild/Repository/HTTP.pm view on Meta::CPAN
package Alien::Base::ModuleBuild::Repository::HTTP;
use strict;
use warnings;
use Carp;
use HTTP::Tiny;
use Scalar::Util qw( blessed );
use URI;
use Alien::Base::ModuleBuild::Utils;
use parent 'Alien::Base::ModuleBuild::Repository';
# ABSTRACT: HTTP repository handler
our $VERSION = '1.17'; # VERSION
our $Has_HTML_Parser = eval { require HTML::LinkExtor; 1 };
sub is_network_fetch { 1 }
lib/Alien/Base/ModuleBuild/Repository/HTTP.pm view on Meta::CPAN
$uri = URI->new_abs($target, $base);
}
else {
$uri = URI->new($target);
}
return $uri->canonical;
}
sub check_http_response {
my ( $self, $res ) = @_;
if ( blessed $res && $res->isa( 'HTTP::Response' ) ) {
my %headers = map { lc $_ => $res->header($_) } $res->header_field_names;
if ( !$res->is_success ) {
return ( 1, $res->status_line . " " . $res->decoded_content, \%headers, $res->request->uri );
}
return ( 0, $res->decoded_content, \%headers, $res->request->uri );
}
else {
if ( !$res->{success} ) {
my $reason = $res->{status} == 599 ? $res->{content} : "@{[ $res->{status} ]} @{[ $res->{reason} ]}";
if($res->{status} == 599 && $reason =~ /https support/)
t/alien_base_modulebuild.t view on Meta::CPAN
};
};
subtest 'interpolation of helpers' => sub {
my $mock = mock 'Alien::foopatcher' => (
add => [
new => sub { bless 'Alien::foopatcher', {} },
alien_helper => sub {
return {
patch1 => 'join " ", qw(patch1 --binary)',
patch2 => sub { 'patch2 --binary' },
double => sub { 2 },
argument_count2 => sub { scalar @_ },
},
}
],
);
t/alien_base_modulebuild_cabinet.t view on Meta::CPAN
use Test2::V0 -no_srand => 1;
use Alien::Base::ModuleBuild::File;
use Alien::Base::ModuleBuild::Cabinet;
subtest 'basic' => sub {
my $cab = Alien::Base::ModuleBuild::Cabinet->new();
isa_ok( $cab, 'Alien::Base::ModuleBuild::Cabinet');
# make some fake file objects
my @fake_files = map { bless {}, 'Alien::Base::ModuleBuild::File' } (1..3);
is( $cab->add_files( @fake_files ), \@fake_files, "add_files the files" );
is( $cab->files, \@fake_files, "add_files, well ... adds files");
};
subtest 'sort' => sub {
my $cb = Alien::Base::ModuleBuild::Cabinet->new;
( run in 2.177 seconds using v1.01-cache-2.11-cpan-de7293f3b23 )