From: Michael G Schwern Date: Wed, 26 Mar 2008 00:38:28 +0000 (+0000) Subject: CDBICompat::Relationships uses Clone. Make CDBICompat not load without it X-Git-Tag: v0.08240~498 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=118edec6adaf70e29f6dd2ab231b52617f54d18e;p=dbsrgits%2FDBIx-Class.git CDBICompat::Relationships uses Clone. Make CDBICompat not load without it so the tests skip if it's not there. Also improve the message to only show what's missing. --- diff --git a/lib/DBIx/Class/CDBICompat.pm b/lib/DBIx/Class/CDBICompat.pm index 52c0509..ec063a9 100644 --- a/lib/DBIx/Class/CDBICompat.pm +++ b/lib/DBIx/Class/CDBICompat.pm @@ -5,11 +5,20 @@ use warnings; use base qw/DBIx::Class::Core DBIx::Class::DB/; use Carp::Clan qw/^DBIx::Class/; -eval { - require Class::Trigger; - require DBIx::ContextualFetch; -}; -croak "Class::Trigger and DBIx::ContextualFetch is required for CDBICompat" if $@; +# Modules CDBICompat needs that DBIx::Class does not. +my @Extra_Modules = qw( + Class::Trigger + DBIx::ContextualFetch + Clone +); + +my @didnt_load; +for my $module (@Extra_Modules) { + push @didnt_load, $module unless eval qq{require $module}; +} +croak("@{[ join ', ', @didnt_load ]} are missing and are required for CDBICompat") + if @didnt_load; + __PACKAGE__->load_own_components(qw/ Constraints