Alien-Base-ModuleBuild

 view release on metacpan or  search on metacpan

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


    my @repos = ref $args{alien_repository} eq 'ARRAY'
      ? @{ $args{alien_repository} }
      : ( $args{alien_repository} );

    foreach my $repo (@repos)
    {
      next unless defined $repo;
      if(($repo->{protocol}||'') eq 'https')
      {
        $self->_add_prereq( 'build_requires', 'IO::Socket::SSL', '1.56' );
        $self->_add_prereq( 'build_requires', 'Net::SSLeay',     '1.49' );
      }
    }

  }


  # force newest for all automated testing
  #TODO (this probably should be checked for "input needed" rather than blindly assigned)
  if ($ENV{AUTOMATED_TESTING}) {

lib/Alien/Base/ModuleBuild/API.pod  view on Meta::CPAN

[version 0.001]

A hashref or arrayref of hashrefs defining the repositories used to find and fetch library tarballs (or zipballs etc.). These attributes are used to create C<Alien::Base::ModuleBuild::Repository> objects (or more likely, subclasses thereof). Which cl...

=over

=item protocol

One of C<ftp>, C<http> C<https> or C<local>. The first three are obvious, C<local> allows packaging a tarball with the Alien:: module.

If your repository is going to need C<https>, make sure that you specify that, because it will inform L<Alien::Base::ModuleBuild> that you will need the prereqs for SSL (namely L<Net::SSLeay> and L<IO::Socket::SSL>).

=item protocol_class

Defines the protocol handler class. Defaults to 'Net::FTP' or 'HTTP::Tiny' as appropriate.

=item host

This is either the root server address for the FTP and HTTP classes (i.e. C<my.server.com>)

=item location

t/alien_base_modulebuild.t  view on Meta::CPAN

subtest 'http + ssl' => sub {

  my $builder = builder(
    alien_repository => {
      protocol => 'https',
      location => 'src',
      c_compiler_required => 0,
    },
  );

  is $builder->build_requires->{'IO::Socket::SSL'},     '1.56', 'SSL ~ IO::Socket::SSL 1.56 or better';
  is $builder->build_requires->{'Net::SSLeay'},         '1.49', 'SSL ~ Net::SSLeay 1.49 or better';

};

subtest 'http + ssl + list ref' => sub {

  my $builder = builder(
    alien_repository => [ {
      protocol => 'https',
      location => 'src',
      c_compiler_required => 0,
    } ],
  );

  is $builder->build_requires->{'IO::Socket::SSL'},     '1.56', 'SSL ~ IO::Socket::SSL 1.56 or better';
  is $builder->build_requires->{'Net::SSLeay'},         '1.49', 'SSL ~ Net::SSLeay 1.49 or better';

};

subtest 'default temp and share' => sub {
  local $CWD = _new_temp();

  my $builder = builder;

  # test the builder function

t/alien_base_modulebuild_repository_http.t  view on Meta::CPAN


    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',



( run in 0.252 second using v1.01-cache-2.11-cpan-4d50c553e7e )