Fix func_rs() and as_subselect_rs() to start behaving as advertised
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat.pm
index 0dddff3..f3697c2 100644 (file)
@@ -2,22 +2,15 @@ package DBIx::Class::CDBICompat;
 
 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};
+BEGIN {
+  require DBIx::Class::Optional::Dependencies;
+  if (my $missing = DBIx::Class::Optional::Dependencies->req_missing_for('cdbicompat')) {
+    die "The following extra modules are required for DBIx::Class::CDBICompat: $missing\n";
+  }
 }
-__PACKAGE__->throw_exception("@{[ join ', ', @didnt_load ]} are missing and are required for CDBICompat")
-    if @didnt_load;
 
+use base qw/DBIx::Class::Core DBIx::Class::DB/;
 
 __PACKAGE__->load_own_components(qw/
   Constraints
@@ -45,9 +38,10 @@ __PACKAGE__->load_own_components(qw/
   Iterator
 /);
 
-            #DBIx::Class::ObjIndexStubs
 1;
 
+__END__
+
 =head1 NAME
 
 DBIx::Class::CDBICompat - Class::DBI Compatibility layer.
@@ -62,7 +56,7 @@ DBIx::Class::CDBICompat - Class::DBI Compatibility layer.
 =head1 DESCRIPTION
 
 DBIx::Class features a fully featured compatibility layer with L<Class::DBI>
-and some common plugins to ease transition for existing CDBI users. 
+and some common plugins to ease transition for existing CDBI users.
 
 This is not a wrapper or subclass of DBIx::Class but rather a series of plugins.  The result being that even though you're using the Class::DBI emulation layer you are still getting DBIx::Class objects.  You can use all DBIx::Class features and methods via CDBICompat.  This allows you to take advantage of DBIx::Class features without having to rewrite your CDBI code.
 
@@ -91,7 +85,7 @@ This plugin will work, but it is more efficiently done using DBIC's native searc
 =head2 Choosing Features
 
 In fact, this class is just a recipe containing all the features emulated.
-If you like, you can choose which features to emulate by building your 
+If you like, you can choose which features to emulate by building your
 own class and loading it like this:
 
   package My::DB;
@@ -165,13 +159,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>.