From: Matt S Trout Date: Sat, 6 Aug 2005 23:17:03 +0000 (+0000) Subject: Merged dkubb's Module::Find code into Schema->load_classes X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=41a6f8c01f2bd184402b815db45ec5cc4ef18c25;p=dbsrgits%2FDBIx-Class-Historic.git Merged dkubb's Module::Find code into Schema->load_classes --- diff --git a/lib/DBIx/Class/Schema.pm b/lib/DBIx/Class/Schema.pm index 3a08e5c..bdd157b 100644 --- a/lib/DBIx/Class/Schema.pm +++ b/lib/DBIx/Class/Schema.pm @@ -4,8 +4,9 @@ use strict; use warnings; use base qw/Class::Data::Inheritable/; -use DBIx::Class; +use base qw/DBIx::Class/; +__PACKAGE__->load_components(qw/Exception/); __PACKAGE__->mk_classdata('class_registrations' => {}); =head1 NAME @@ -63,6 +64,13 @@ sub registered_classes { sub load_classes { my $class = shift; my @comp = grep { $_ !~ /^#/ } @_; + unless (@comp) { + eval "require Module::Find;"; + $class->throw("No arguments to load_classes and couldn't load". + " Module::Find ($@)") if $@; + @comp = map { substr $_, length "${class}::" } + Module::Find::findallmod($class); + } foreach my $comp (@comp) { my $comp_class = "${class}::${comp}"; eval "use $comp_class";