Arriba

 view release on metacpan or  search on metacpan

t/00-report-prereqs.t  view on Meta::CPAN

#!perl

use strict;
use warnings;

# This test was generated by Dist::Zilla::Plugin::Test::ReportPrereqs 0.010

use Test::More tests => 1;

use ExtUtils::MakeMaker;
use File::Spec::Functions;
use List::Util qw/max/;

my @modules = qw(
  CPAN::Meta
  CPAN::Meta::Requirements
  Data::Dump
  ExtUtils::MakeMaker
  File::Spec
  File::Spec::Functions
  File::Temp
  HTTP::Date
  HTTP::Parser::XS
  HTTP::Request::Common
  HTTP::Status
  HTTP::Tiny::SPDY
  IO::Handle
  IO::Socket
  IO::Socket::SSL
  IPC::Open3
  List::Util
  Net::SPDY::Session
  Net::Server::PreFork
  Net::Server::SIG
  Plack::LWPish
  Plack::Runner
  Plack::TempBuffer
  Plack::Test::Suite
  Plack::Util
  Socket
  Test::More
  base
  constant
  perl
  strict
  warnings
);

my %exclude = map {; $_ => 1 } qw(

);

my ($source) = grep { -f $_ } qw/MYMETA.json MYMETA.yml META.json/;
$source = "META.yml" unless defined $source;

# replace modules with dynamic results from MYMETA.json if we can
# (hide CPAN::Meta from prereq scanner)
my $cpan_meta = "CPAN::Meta";
my $cpan_meta_req = "CPAN::Meta::Requirements";
my $all_requires;
if ( -f $source && eval "require $cpan_meta" ) { ## no critic
  if ( my $meta = eval { CPAN::Meta->load_file($source) } ) {

    # Get ALL modules mentioned in META (any phase/type)
    my $prereqs = $meta->prereqs;
    delete $prereqs->{develop} if not $ENV{AUTHOR_TESTING};
    my %uniq = map {$_ => 1} map { keys %$_ } map { values %$_ } values %$prereqs;
    $uniq{$_} = 1 for @modules; # don't lose any static ones
    @modules = sort grep { ! $exclude{$_} } keys %uniq;

    # If verifying, merge 'requires' only for major phases
    if ( 1 ) {
      $prereqs = $meta->effective_prereqs; # get the object, not the hash
      if (eval "require $cpan_meta_req; 1") { ## no critic
        $all_requires = $cpan_meta_req->new;
        for my $phase ( qw/configure build test runtime/ ) {
          $all_requires->add_requirements(
            $prereqs->requirements_for($phase, 'requires')
          );
        }
      }
    }
  }
}

my @reports = [qw/Version Module/];
my @dep_errors;
my $req_hash = defined($all_requires) ? $all_requires->as_string_hash : {};



( run in 2.126 seconds using v1.01-cache-2.11-cpan-ceb78f64989 )