Revision history for Perl extension DBIx::Class::Schema::Loader
+0.02005 Mon Feb 27 23:53:17 UTC 2006
+ - Move the external file loading to after everything else
+ loader does, in case people want to define, override, or
+ build on top of the rels.
+
0.02004 Mon Feb 27 23:53:17 UTC 2006
- Minor fix to debugging message for loading external files
---
name: DBIx-Class-Schema-Loader
-version: 0.02004
+version: 0.02005
author:
- 'Brandon Black, C<blblack@gmail.com>'
abstract: Dynamic definition of a DBIx::Class::Schema
provides:
DBIx::Class::Schema::Loader:
file: lib/DBIx/Class/Schema/Loader.pm
- version: 0.02004
+ version: 0.02005
DBIx::Class::Schema::Loader::DB2:
file: lib/DBIx/Class/Schema/Loader/DB2.pm
DBIx::Class::Schema::Loader::Generic:
# Always remember to do all digits for the version even if they're 0
# i.e. first release of 0.XX *must* be 0.XX000. This avoids fBSD ports
# brain damage and presumably various other packaging systems too
-our $VERSION = '0.02004';
+our $VERSION = '0.02005';
__PACKAGE__->mk_classaccessor('loader');
$self->_load_classes;
$self->_load_relationships if $self->relationships;
+ $self->_load_external;
warn qq/\### END DBIx::Class::Schema::Loader dump ###\n/
if $self->debug;
$self;
}
+sub _load_external {
+ my $self = shift;
+
+ foreach my $table_class (values %{$self->classes}) {
+ $table_class->require;
+ if($@ && $@ !~ /^Can't locate /) {
+ croak "Failed to load external class definition"
+ . "for '$table_class': $@";
+ }
+ elsif(!$@) {
+ warn qq/# Loaded external class definition for '$table_class'\n/
+ if $self->debug;
+ }
+ }
+}
+
# Overload in your driver class
sub _db_classes { croak "ABSTRACT METHOD" }
warn qq/$table_class->set_primary_key('$primaries')\n/
if $self->debug && @$pks;
- $table_class->require;
- if($@ && $@ !~ /^Can't locate /) {
- croak "Failed to load external class definition"
- . "for '$table_class': $@";
- }
- elsif(!$@) {
- warn qq/# Loaded external class definition for '$table_class'\n/
- if $self->debug;
- }
-
$schema->register_class($table_moniker, $table_class);
$self->classes->{$lc_tblname} = $table_class;
$self->monikers->{$lc_tblname} = $table_moniker;