From: Matt S Trout Date: Mon, 5 May 2008 20:32:58 +0000 (+0000) Subject: improvements to the META.yml magic X-Git-Tag: v0.08240~466 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=fe650234f47eef14b89fe0f4fee651dd4f2ad7b5;p=dbsrgits%2FDBIx-Class.git improvements to the META.yml magic --- diff --git a/Changes b/Changes index 2ac1cc9..8a7df8a 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ Revision history for DBIx::Class + - make ash's build_requires/META.yml fixes work better - is_deferable support on relations used by the SQL::Translator parser (Anders Nor Berle) - Refactored DBIx::Class::Schema::Versioned diff --git a/Makefile.PL b/Makefile.PL index 3a896d7..c36ad9d 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -1,4 +1,8 @@ use inc::Module::Install 0.67; +use strict; +use warnings; + +use 5.006001; # delete this line if you want to send patches for earlier. name 'DBIx-Class'; perl_version '5.006001'; @@ -34,10 +38,18 @@ install_script 'script/dbicadmin'; tests "t/*.t t/*/*.t"; # re-build README and require CDBI modules for testing if we're in a checkout -if( -e 'inc/.author' ) { - build_requires 'DBIx::ContextualFetch'; - build_requires 'Class::Trigger'; - build_requires 'Time::Piece'; + +my @force_build_requires_if_author = qw( + DBIx::ContextualFetch + Class::Trigger + Time::Piece +); + +if ($Module::Install::AUTHOR) { + + foreach my $module (@force_build_requires_if_author) { + build_requires $module; + } system('pod2text lib/DBIx/Class.pm > README'); } @@ -52,16 +64,23 @@ WriteAll; if ($Module::Install::AUTHOR) { # Need to do this _after_ WriteAll else it looses track of them Meta->{values}{build_requires} = [ grep { - $_->[0] !~ / - DBIx::ContextualFetch | - Class::Trigger | - Time::Piece - /x; + my $ok = 1; + foreach my $module (@force_build_requires_if_author) { + if ($_->[0] =~ /$module/) { + $ok = 0; + last; + } + } + $ok; } @{Meta->{values}{build_requires}} ]; my @scalar_keys = Module::Install::Metadata::Meta_TupleKeys(); - sub Module::Install::Metadata::Meta_TupleKeys { - return @scalar_keys, 'resources'; + my $cr = Module::Install::Metadata->can("Meta_TupleKeys"); + { + no warnings 'redefine'; + *Module::Install::Metadata::Meta_TupleKeys = sub { + return $cr->(@_), 'resources'; + }; } Meta->{values}{resources} = [ [ 'MailingList', 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class' ],