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
56 # sigh... so much unmitigated stupidity on #p5p these days...
57 local @INC = ('lib', @INC);
58 require namespace::clean::_Util;
61 namespace::clean::_Util::DEBUGGER_NEEDS_CV_RENAME()
63 namespace::clean::_Util::_namer_load_error()
65 usable_compiler_present()
67 # when changing version, also change $sn_ver in namespace/clean/_Util.pm
68 ? ( PREREQ_PM => { 'Sub::Name' => '0.04' } )
72 ## XS-checking BOILERPLATE ###################################################
73 sub usable_compiler_present {
74 return 0 if parse_args()->{PUREPERL_ONLY};
80 # poor man's inc::latest
81 my $euhc_fn = 'ExtUtils/HasCompiler.pm';
82 my $euhc_found_in_INC_dir;
84 ( ($euhc_found_in_INC_dir) = grep {
93 MM->parse_version("$euhc_found_in_INC_dir/$euhc_fn")
95 MM->parse_version("inc/$euhc_fn")
98 eval { require ExtUtils::HasCompiler };
100 unless ( $INC{'ExtUtils/HasCompiler.pm'} ) {
101 local @INC = ( "inc", @INC );
102 require ExtUtils::HasCompiler;
105 $ucp = ExtUtils::HasCompiler::can_compile_loadable_object(quiet => 1)
113 if( my $used_fn = $INC{'ExtUtils/HasCompiler.pm'} ) {
115 "ExtUtils::HasCompiler::can_compile_loadable_object() v%s (loaded from %s) returned: %s\n",
116 ExtUtils::HasCompiler->VERSION,
118 ( defined($ucp) ? $ucp : "UNKNOWN" ),
122 print "Something went wrong when trying to load/use ExtUtils::HasCompiler:\n$@\n\n";
129 # FIXME - this has been cargo-culted from
130 # https://metacpan.org/source/HAARG/strictures-2.000002/Makefile.PL
131 # There likely will be better ways to handle %ENV and @ARGV directly within
132 # EU::HC in the future
135 require ExtUtils::MakeMaker;
136 require Text::ParseWords;
137 ExtUtils::MakeMaker::parse_args(
139 Text::ParseWords::shellwords($ENV{PERL_MM_OPT} || ''),
142 return $tmp->{ARGS} || {};
144 ## END XS-checking BOILERPLATE ###############################################
147 ## BOILERPLATE ###############################################################
148 require ExtUtils::MakeMaker;
150 # have to do this since old EUMM dev releases miss the eval $VERSION line
151 my $eumm_version = eval $ExtUtils::MakeMaker::VERSION;
152 my $mymeta = $eumm_version >= 6.57_02;
153 my $mymeta_broken = $mymeta && $eumm_version < 6.57_07;
155 ($MM_ARGS{NAME} = $META{name}) =~ s/-/::/g;
156 ($MM_ARGS{VERSION_FROM} = "lib/$MM_ARGS{NAME}.pm") =~ s{::}{/}g;
157 $META{license} = [ $META{license} ]
158 if $META{license} && !ref $META{license};
159 $MM_ARGS{LICENSE} = $META{license}[0]
160 if $META{license} && $eumm_version >= 6.30;
161 $MM_ARGS{NO_MYMETA} = 1
163 $MM_ARGS{META_ADD} = { 'meta-spec' => { version => 2 }, %META }
164 unless -f 'META.yml';
166 for (qw(configure build test runtime)) {
167 my $key = $_ eq 'runtime' ? 'PREREQ_PM' : uc $_.'_REQUIRES';
168 my $r = $MM_ARGS{$key} = {
169 %{$META{prereqs}{$_}{requires} || {}},
170 %{delete $MM_ARGS{$key} || {}},
172 defined $r->{$_} or delete $r->{$_} for keys %$r;
175 $MM_ARGS{MIN_PERL_VERSION} = delete $MM_ARGS{PREREQ_PM}{perl} || 0;
177 delete $MM_ARGS{MIN_PERL_VERSION}
178 if $eumm_version < 6.47_01;
179 $MM_ARGS{BUILD_REQUIRES} = {%{$MM_ARGS{BUILD_REQUIRES}}, %{delete $MM_ARGS{TEST_REQUIRES}}}
180 if $eumm_version < 6.63_03;
181 $MM_ARGS{PREREQ_PM} = {%{$MM_ARGS{PREREQ_PM}}, %{delete $MM_ARGS{BUILD_REQUIRES}}}
182 if $eumm_version < 6.55_01;
183 delete $MM_ARGS{CONFIGURE_REQUIRES}
184 if $eumm_version < 6.51_03;
186 ExtUtils::MakeMaker::WriteMakefile(%MM_ARGS);
187 ## END BOILERPLATE ###########################################################