The Perl Advent Calendar needs more articles for 2022. Submit your idea today!
# This Makefile.PL for Moose was generated by
# inc::MakeMaker <self>
# and Dist::Zilla::Plugin::MakeMaker::Awesome 0.49.
# Don't edit it but the dist.ini and plugins used to construct it.

use strict;
use warnings;

# Secondary compile testing via ExtUtils::HasCompiler
use lib 'inc';
use ExtUtils::HasCompiler 0.014 'can_compile_loadable_object';
die 'This distribution requires a working compiler'
    unless can_compile_loadable_object(quiet => 1);

use ExtUtils::MakeMaker;
check_conflicts();

my %WriteMakefileArgs = (
  "ABSTRACT" => "A postmodern object system for Perl 5",
  "AUTHOR" => "Stevan Little <stevan\@cpan.org>, Dave Rolsky <autarch\@urth.org>, Jesse Luehrs <doy\@cpan.org>, Shawn M Moore <sartak\@cpan.org>, \x{5d9}\x{5d5}\x{5d1}\x{5dc} \x{5e7}\x{5d5}\x{5d2}'\x{5de}\x{5df} (Yuval Kogman) <nothingmuch\@woobling.org>, Karen Etheridge <ether\@cpan.org>, Florian Ragwitz <rafl\@debian.org>, Hans Dieter Pearcey <hdp\@cpan.org>, Chris Prather <chris\@prather.org>, Matt S Trout <mstrout\@cpan.org>",
  "CONFIGURE_REQUIRES" => {
    "Dist::CheckConflicts" => "0.02",
    "ExtUtils::MakeMaker" => 0
  },
  "DISTNAME" => "Moose",
  "EXE_FILES" => [
    "bin/moose-outdated"
  ],
  "LICENSE" => "perl",
  "NAME" => "Moose",
  "OBJECT" => "xs/Attribute\$(OBJ_EXT) xs/AttributeCore\$(OBJ_EXT) xs/Class\$(OBJ_EXT) xs/Generated\$(OBJ_EXT) xs/HasAttributes\$(OBJ_EXT) xs/HasMethods\$(OBJ_EXT) xs/Inlined\$(OBJ_EXT) xs/Instance\$(OBJ_EXT) xs/Method\$(OBJ_EXT) xs/Moose\$(OBJ_EXT) xs/MOP\$(OBJ_EXT) xs/Package\$(OBJ_EXT) xs/ToInstance\$(OBJ_EXT) mop\$(OBJ_EXT)",
  "PREREQ_PM" => {
    "Carp" => "1.22",
    "Class::Load" => "0.09",
    "Class::Load::XS" => "0.01",
    "Data::OptList" => "0.107",
    "Devel::GlobalDestruction" => 0,
    "Devel::OverloadInfo" => "0.005",
    "Devel::StackTrace" => "2.03",
    "Dist::CheckConflicts" => "0.02",
    "Eval::Closure" => "0.04",
    "List::Util" => "1.56",
    "MRO::Compat" => "0.05",
    "Module::Runtime" => "0.014",
    "Module::Runtime::Conflicts" => "0.002",
    "Package::DeprecationManager" => "0.11",
    "Package::Stash" => "0.32",
    "Package::Stash::XS" => "0.24",
    "Params::Util" => "1.00",
    "Scalar::Util" => "1.19",
    "Sub::Exporter" => "0.980",
    "Sub::Util" => "1.40",
    "Try::Tiny" => "0.17",
    "parent" => "0.223",
    "strict" => "1.03",
    "warnings" => "1.03"
  },
  "TEST_REQUIRES" => {
    "CPAN::Meta::Check" => "0.011",
    "CPAN::Meta::Requirements" => 0,
    "File::Spec" => 0,
    "Module::Metadata" => 0,
    "Test::CleanNamespaces" => "0.13",
    "Test::Fatal" => "0.001",
    "Test::More" => "0.96",
    "Test::Requires" => "0.05"
  },
  "VERSION" => "2.2201",
  "XS" => {
    "xs/Attribute.xs" => "xs/Attribute.c",
    "xs/AttributeCore.xs" => "xs/AttributeCore.c",
    "xs/Class.xs" => "xs/Class.c",
    "xs/Generated.xs" => "xs/Generated.c",
    "xs/HasAttributes.xs" => "xs/HasAttributes.c",
    "xs/HasMethods.xs" => "xs/HasMethods.c",
    "xs/Inlined.xs" => "xs/Inlined.c",
    "xs/Instance.xs" => "xs/Instance.c",
    "xs/MOP.xs" => "xs/MOP.c",
    "xs/Method.xs" => "xs/Method.c",
    "xs/Moose.xs" => "xs/Moose.c",
    "xs/Package.xs" => "xs/Package.c",
    "xs/ToInstance.xs" => "xs/ToInstance.c"
  },
  "clean" => {
    "FILES" => "xs/Attribute\$(OBJ_EXT) xs/AttributeCore\$(OBJ_EXT) xs/Class\$(OBJ_EXT) xs/Generated\$(OBJ_EXT) xs/HasAttributes\$(OBJ_EXT) xs/HasMethods\$(OBJ_EXT) xs/Inlined\$(OBJ_EXT) xs/Instance\$(OBJ_EXT) xs/Method\$(OBJ_EXT) xs/Moose\$(OBJ_EXT) xs/MOP\$(OBJ_EXT) xs/Package\$(OBJ_EXT) xs/ToInstance\$(OBJ_EXT) mop\$(OBJ_EXT)"
  },
  "test" => {
    "TESTS" => "t/*.t t/attributes/*.t t/basics/*.t t/bugs/*.t t/cmop/*.t t/compat/*.t t/examples/*.t t/exceptions/*.t t/immutable/*.t t/metaclasses/*.t t/moose_util/*.t t/native_traits/*.t t/recipes/*.t t/roles/*.t t/test_moose/*.t t/todo_tests/*.t t/type_constraints/*.t"
  }
);

my %FallbackPrereqs = (
  "CPAN::Meta::Check" => "0.011",
  "CPAN::Meta::Requirements" => 0,
  "Carp" => "1.22",
  "Class::Load" => "0.09",
  "Class::Load::XS" => "0.01",
  "Data::OptList" => "0.107",
  "Devel::GlobalDestruction" => 0,
  "Devel::OverloadInfo" => "0.005",
  "Devel::StackTrace" => "2.03",
  "Dist::CheckConflicts" => "0.02",
  "Eval::Closure" => "0.04",
  "File::Spec" => 0,
  "List::Util" => "1.56",
  "MRO::Compat" => "0.05",
  "Module::Metadata" => 0,
  "Module::Runtime" => "0.014",
  "Module::Runtime::Conflicts" => "0.002",
  "Package::DeprecationManager" => "0.11",
  "Package::Stash" => "0.32",
  "Package::Stash::XS" => "0.24",
  "Params::Util" => "1.00",
  "Scalar::Util" => "1.19",
  "Sub::Exporter" => "0.980",
  "Sub::Util" => "1.40",
  "Test::CleanNamespaces" => "0.13",
  "Test::Fatal" => "0.001",
  "Test::More" => "0.96",
  "Test::Requires" => "0.05",
  "Try::Tiny" => "0.17",
  "parent" => "0.223",
  "strict" => "1.03",
  "warnings" => "1.03"
);

unless ( eval { ExtUtils::MakeMaker->VERSION('6.63_03') } ) {
  delete $WriteMakefileArgs{TEST_REQUIRES};
  delete $WriteMakefileArgs{BUILD_REQUIRES};
  $WriteMakefileArgs{PREREQ_PM} = \%FallbackPrereqs;
}

delete $WriteMakefileArgs{CONFIGURE_REQUIRES}
  unless eval { ExtUtils::MakeMaker->VERSION(6.52) };

$WriteMakefileArgs{CCFLAGS} = ( $Config::Config{ccflags} || '' ) . ' -I.';

WriteMakefile(%WriteMakefileArgs);

{
package MY;

use Config;

# These two are necessary to keep bmake happy
sub xs_c {
    my $self = shift;
    my $ret = $self->SUPER::xs_c(@_);
    $ret =~ s/\$\*\.xs/\$</g;
    $ret =~ s/\$\*\.c\b/\$@/g;
    return $ret;
}

sub c_o {
    my $self = shift;
    my $ret = $self->SUPER::c_o(@_);
    $ret =~ s/\$\*\.c\b/\$</g;
    $ret =~ s/\$\*\$\(OBJ_EXT\)/\$@/g;
    return $ret;
}

sub const_cccmd {
    my $ret = shift->SUPER::const_cccmd(@_);
    return q{} unless $ret;

    if ($Config{cc} =~ /^cl\b/i) {
        warn 'you are using MSVC... we may not have gotten some options quite right.';
        $ret .= ' /Fo$@';
    }
    else {
        $ret .= ' -o $@';
    }

    return $ret;
}

sub postamble {
    return <<'EOF';
$(OBJECT) : mop.h
EOF
}
}

sub check_conflicts {
    if ( eval { require './lib/Moose/Conflicts.pm'; 1; } ) {
        if ( eval { Moose::Conflicts->check_conflicts; 1 } ) {
            return;
        }
        else {
            my $err = $@;
            $err =~ s/^/    /mg;
            warn "***\n$err***\n";
        }
    }
    else {
        print <<'EOF';
***
    Your toolchain doesn't support configure_requires, so Dist::CheckConflicts
    hasn't been installed yet. You should check for conflicting modules
    manually using the 'moose-outdated' script that is installed with
    this distribution once the installation finishes.
***
EOF
    }

    return if $ENV{AUTOMATED_TESTING} || $ENV{NONINTERACTIVE_TESTING};

    # More or less copied from Module::Build
    return if $ENV{PERL_MM_USE_DEFAULT};
    return unless -t STDIN && ( -t STDOUT || !( -f STDOUT || -c STDOUT ) );

    sleep 4;
}