Alien-Base-ModuleBuild

 view release on metacpan or  search on metacpan

lib/Alien/Base/ModuleBuild.pm  view on Meta::CPAN

  foreach my $repo ( @$repo_specs ) {
    #merge defaults into spec
    foreach my $key ( keys %$repo_default ) {
      next if defined $repo->{$key};
      $repo->{$key} = $repo_default->{$key};
    }

    $repo->{platform} = 'src' unless defined $repo->{platform};

    foreach my $var (@env_overrides) {
        my $var_tail = lc substr($var, length($env_prefix));
        my ($var_protocol, $var_key) = split /_/, $var_tail, 2;

        if ($repo->{protocol} eq $var_protocol) {
            $repo->{$var_key} = $ENV{$var};
        }
    }

    push @repos, $self->alien_repository_class($repo->{protocol} || 'default')->new( $repo );
  }

t/00_diag.t  view on Meta::CPAN

sub spacer ()
{
  diag '';
  diag '';
  diag '';
}

pass 'okay';

my $max = 1;
$max = $_ > $max ? $_ : $max for map { length $_ } @modules;
our $format = "%-${max}s %s";

spacer;

my @keys = sort grep /(MOJO|PERL|\A(LC|HARNESS)_|\A(SHELL|LANG)\Z)/i, keys %ENV;

if(@keys > 0)
{
  diag "$_=$ENV{$_}" for @keys;

t/alien_base_modulebuild_repository_http.t  view on Meta::CPAN


  subtest '599 no SSL' => sub {

    my $res = {
      'reason'  => 'Internal Exception',
      'url'     => 'https://mytest.test',
      'success' => '',
      'status'  => 599,
      'headers' => {
        'content-type' => 'text/plain',
        'content-length' => 110,
      },
      'content' => "IO::Socket::SSL 1.42 must be installed for https support\n" .
                   "Net::SSLeay 1.49 must be installed for https support\n",
    };

    is(
      [Alien::Base::ModuleBuild::Repository::HTTP->check_http_response($res)],
      [1, "IO::Socket::SSL 1.42 must be installed for https support\n" .
          "Net::SSLeay 1.49 must be installed for https support\n" .
          "See https://github.com/PerlAlien/Alien-Base-ModuleBuild/issues/6#issuecomment-417097485",
          { 'content-type' => 'text/plain', 'content-length' => 110 }, "https://mytest.test" ]
    );
  };

  subtest '599 other' => sub {

    my $res = {
      'reason'  => 'Internal Exception',
      'url'     => 'https://mytest.test',
      'success' => '',
      'status'  => 599,
      'headers' => {
        'content-type' => 'text/plain',
        'content-length' => 13,
      },
      'content' => "Some Error!\n",
    };

    is(
      [Alien::Base::ModuleBuild::Repository::HTTP->check_http_response($res)],
      [1, "Some Error!\n",
          { 'content-type' => 'text/plain', 'content-length' => 13 }, "https://mytest.test" ]
    );
  };

  subtest '404 bad url' => sub {

    my $res = {
      'headers' => {
        'content-type' => 'text/plain',
        'content-length' => length("404 Not Found\n"),
      },
      'url' => 'https://mytest.test/bogus',
      'protocol' => 'HTTP/1.1',
      'status' => '404',
      'success' => '',
      'reason' => 'Not Found',
      'content' => "404 Not Found\n",
    };

    is(
      [Alien::Base::ModuleBuild::Repository::HTTP->check_http_response($res)],
      [1, "404 Not Found",
          { 'content-type' => 'text/plain', 'content-length' => 14 }, "https://mytest.test/bogus" ],
    );

  };
};

done_testing;



( run in 0.638 second using v1.01-cache-2.11-cpan-65fba6d93b7 )