Use Optional::Dependencies for CDBICompat and its tests
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat.pm
index b4c6399..b87c997 100644 (file)
@@ -4,20 +4,9 @@ use strict;
 use warnings;
 use base qw/DBIx::Class::Core DBIx::Class::DB/;
 
-# 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};
+unless (DBIx::Class::Optional::Dependencies->req_ok_for('cdbicompat')) {
+  __PACKAGE__->throw_exception(Class::Optional::Dependencies->req_missing_for('cdbicompat') . ' are missing and are required for CDBICompat');
 }
-__PACKAGE__->throw_exception("@{[ join ', ', @didnt_load ]} are missing and are required for CDBICompat")
-    if @didnt_load;
-
 
 __PACKAGE__->load_own_components(qw/
   Constraints
@@ -45,9 +34,10 @@ __PACKAGE__->load_own_components(qw/
   Iterator
 /);
 
-            #DBIx::Class::ObjIndexStubs
 1;
 
+__END__
+
 =head1 NAME
 
 DBIx::Class::CDBICompat - Class::DBI Compatibility layer.
@@ -165,13 +155,13 @@ Relationships between tables (has_a, has_many...) must be declared after all tab
 
 =back
 
-=head1 AUTHORS
-
-Matt S. Trout <mst@shadowcatsystems.co.uk>
-
-=head1 LICENSE
+=head1 FURTHER QUESTIONS?
 
-You may distribute this code under the same terms as Perl itself.
+Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>.
 
-=cut
+=head1 COPYRIGHT AND LICENSE
 
+This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE>
+by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can
+redistribute it and/or modify it under the same terms as the
+L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>.