6 name => 'namespace-clean',
9 abstract => 'Keep imports and functions out of your namespace',
11 'Robert \'phaylon\' Sedlacek <rs@474.at>',
12 'Florian Ragwitz <rafl@debian.org>',
13 'Jesse Luehrs <doy@tozt.net>',
14 'Peter Rabbitson <ribasushi@cpan.org>',
15 'Father Chrysostomos <sprout@cpan.org>',
21 'ExtUtils::MakeMaker' => 0,
26 'Package::Stash' => '0.23',
27 'B::Hooks::EndOfScope' => '0.12',
33 'Test::More' => '0.47',
39 x_IRC => 'irc://irc.perl.org/#toolchain',
40 homepage => 'http://search.cpan.org/dist/namespace-clean',
43 url => 'git://git.shadowcat.co.uk/p5sagit/namespace-clean.git',
44 web => 'https://github.com/p5sagit/namespace-clean',
47 mailto => 'bug-namespace-clean@rt.cpan.org',
48 web => 'http://rt.cpan.org/Public/Dist/Display.html?Name=namespace-clean',
54 # a sub-namer is needed if using the debugger on some perls
55 require 'lib/namespace/clean/_Util.pm'
57 namespace::clean::_Util::DEBUGGER_NEEDS_CV_RENAME()
59 namespace::clean::_Util::_namer_load_error()
61 usable_compiler_present()
63 # when changing version, also change $sn_ver in namespace/clean/_Util.pm
64 ? ( PREREQ_PM => { 'Sub::Name' => '0.04' } )
68 ## XS-checking BOILERPLATE ###################################################
69 sub usable_compiler_present {
70 return 0 if parse_args()->{PUREPERL_ONLY};
76 # poor man's inc::latest
77 my $euhc_fn = 'ExtUtils/HasCompiler.pm';
78 my $euhc_found_in_INC_dir;
80 ( ($euhc_found_in_INC_dir) = grep {
89 MM->parse_version("$euhc_found_in_INC_dir/$euhc_fn")
91 MM->parse_version("inc/$euhc_fn")
94 eval { require ExtUtils::HasCompiler };
96 unless ( $INC{'ExtUtils/HasCompiler.pm'} ) {
97 local @INC = ( "inc", @INC );
98 require ExtUtils::HasCompiler;
101 $ucp = ExtUtils::HasCompiler::can_compile_loadable_object(quiet => 1)
109 if( my $used_fn = $INC{'ExtUtils/HasCompiler.pm'} ) {
111 "ExtUtils::HasCompiler::can_compile_loadable_object() v%s (loaded from %s) returned: %s\n",
112 ExtUtils::HasCompiler->VERSION,
114 ( defined($ucp) ? $ucp : "UNKNOWN" ),
118 print "Something went wrong when trying to load/use ExtUtils::HasCompiler:\n$@\n\n";
125 # FIXME - this has been cargo-culted from
126 # https://metacpan.org/source/HAARG/strictures-2.000002/Makefile.PL
127 # There likely will be better ways to handle %ENV and @ARGV directly within
128 # EU::HC in the future
131 require ExtUtils::MakeMaker;
132 require Text::ParseWords;
133 ExtUtils::MakeMaker::parse_args(
135 Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''),
138 return $tmp->{ARGS} || {};
140 ## END XS-checking BOILERPLATE ###############################################
143 ## BOILERPLATE ###############################################################
144 require ExtUtils::MakeMaker;
146 # have to do this since old EUMM dev releases miss the eval $VERSION line
147 my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
148 my $mymeta = $eumm_version >= 6.57_02;
149 my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
151 ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
152 ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
153 $META{license} = [ $META{license} ]
154 if $META{license} && !ref $META{license};
155 $MM_ARGS{LICENSE} = $META{license}[0]
156 if $META{license} && $eumm_version >= 6.30;
157 $MM_ARGS{NO_MYMETA} = 1
159 $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
160 unless -f 'META.yml';
162 for (qw(configure build test runtime)) {
163 my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
164 my $r = $MM_ARGS{$key} = {
165 %{$META{prereqs}{$_}{requires} || {}},
166 %{delete $MM_ARGS{$key} || {}},
168 defined $r->{$_} or delete $r->{$_} for keys %$r;
171 $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
173 delete $MM_ARGS{MIN_PERL_VERSION}
174 if $eumm_version < 6.47_01;
175 $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
176 if $eumm_version < 6.63_03;
177 $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
178 if $eumm_version < 6.55_01;
179 delete $MM_ARGS{CONFIGURE_REQUIRES}
180 if $eumm_version < 6.51_03;
182 ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
183 ## END BOILERPLATE ###########################################################