From: Dave Rolsky Date: Fri, 8 Aug 2008 21:28:01 +0000 (+0000) Subject: Don't require Sub::Name if we don't find a compiler. X-Git-Tag: 0_64_01~80 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=e896822dbc5d27f54b7336d2b46df47b8027b3c2;p=gitmo%2FClass-MOP.git Don't require Sub::Name if we don't find a compiler. Fix the tests to skip if Sub::Name is not present. --- diff --git a/Makefile.PL b/Makefile.PL index cd4a289..d94015d 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -22,21 +22,26 @@ unless ( defined $force_xs ) { or no_cc(); } +my %prereqs = ( + 'Scalar::Util' => '1.18', + 'Sub::Name' => '0.02', + 'Sub::Identify' => '0.03', + 'MRO::Compat' => '0.05', + 'Carp' => 0, +); + +delete $prereqs{'Sub::Name'} + unless $has_compiler; + write_makefile(); sub write_makefile { my $ccflags = -d '.svn' || $ENV{MAINTAINER_MODE} ? '-Wall' : ''; WriteMakefile( - VERSION_FROM => 'lib/Class/MOP.pm', - NAME => 'Class::MOP', - PREREQ_PM => { - 'Scalar::Util' => '1.18', - 'Sub::Name' => '0.02', - 'Sub::Identify' => '0.03', - 'MRO::Compat' => '0.05', - 'Carp' => 0, - }, + VERSION_FROM => 'lib/Class/MOP.pm', + NAME => 'Class::MOP', + PREREQ_PM => \%prereqs, CONFIGURE => \&init, CCFLAGS => $ccflags, clean => { FILES => 'test.c test.o' }, diff --git a/t/003_methods.t b/t/003_methods.t index 9711f1a..d2f613e 100644 --- a/t/003_methods.t +++ b/t/003_methods.t @@ -3,11 +3,19 @@ use strict; use warnings; -use Test::More tests => 65; +use Test::More; use Test::Exception; use Scalar::Util qw/reftype/; -use Sub::Name (); + +BEGIN { + if ( eval 'use Sub::Name ();' ) { + plan tests => 65; + } + else { + plan skip_all => 'These tests require Sub::Name'; + } +} BEGIN { use_ok('Class::MOP'); diff --git a/t/082_get_code_info.t b/t/082_get_code_info.t index 1a10319..6eb66ad 100644 --- a/t/082_get_code_info.t +++ b/t/082_get_code_info.t @@ -3,11 +3,19 @@ use strict; use warnings; -use Test::More 'no_plan'; +use Test::More; + +BEGIN { + if ( eval 'use Sub::Name qw(subname);' ) { + plan tests => 5; + } + else { + plan skip_all => 'These tests require Sub::Name'; + } +} BEGIN { use_ok("Class::MOP") } -use Sub::Name qw(subname); sub code_name_is ($$$;$) { my ( $code, $stash, $name, $desc ) = @_;