From: Rafael Kitover Date: Sat, 23 Jul 2011 18:15:44 +0000 (-0400) Subject: make $schema->loader a public method X-Git-Tag: 0.07011~66 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=39d5612f2adf5ed311a81017f2a9f0dd8e12ff0d;p=dbsrgits%2FDBIx-Class-Schema-Loader.git make $schema->loader a public method Also adds some TODO entries, adds Task::Weaken to dependencies and removes a duplicate dependency on List::MoreUtils. --- diff --git a/Changes b/Changes index 138dd1a..8c5cbad 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ Revision history for Perl extension DBIx::Class::Schema::Loader + - $schema->loader is now a public method - add schema_components option - sort relationships so they always come out in the same order - add rel_name_map option diff --git a/Makefile.PL b/Makefile.PL index f2be71b..7a8677b 100644 --- a/Makefile.PL +++ b/Makefile.PL @@ -36,6 +36,7 @@ test_requires 'IPC::Open3' => 0; requires 'File::Spec' => 0; requires 'Scalar::Util' => 0; +requires 'Task::Weaken' => 0; requires 'Data::Dump' => '1.06'; requires 'Lingua::EN::Inflect::Number' => '1.1'; requires 'Lingua::EN::Tagger' => 0; @@ -52,7 +53,6 @@ requires 'File::Slurp' => '9999.13'; requires 'List::MoreUtils' => 0; requires 'namespace::clean' => '0.20'; requires 'Scope::Guard' => 0; -requires 'List::MoreUtils' => 0; requires 'Exporter' => '5.63'; requires 'Try::Tiny' => 0; diff --git a/TODO b/TODO index dd1f19b..d389238 100644 --- a/TODO +++ b/TODO @@ -44,6 +44,9 @@ - remove additional warnings skip in t/22dump.t for ActivePerl on Win32 - make 23dumpmore.t auto cleanup and remove dump warnings - generate POD for schema class with class list + - remove implicit rels from common tests so all tests work on MySQL + - sort unique keys by name + - server link support for Oracle and MSSQL - Relationships - Re-scan relations/tables after initial relation setup to find diff --git a/lib/DBIx/Class/Schema/Loader.pm b/lib/DBIx/Class/Schema/Loader.pm index f49a426..7a9e4f6 100644 --- a/lib/DBIx/Class/Schema/Loader.pm +++ b/lib/DBIx/Class/Schema/Loader.pm @@ -3,9 +3,10 @@ package DBIx::Class::Schema::Loader; use strict; use warnings; use base qw/DBIx::Class::Schema Class::Accessor::Grouped/; -use Carp::Clan qw/^DBIx::Class/; use mro 'c3'; -use Scalar::Util qw/ weaken /; +use Carp::Clan qw/^DBIx::Class/; +use Scalar::Util 'weaken'; +use namespace::clean; # 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 @@ -106,6 +107,17 @@ the road. =head1 METHODS +=head2 loader + +The loader object, as class data on your Schema. For methods available see L and L. + +=cut + +sub loader { + my $self = shift; + $self->_loader(@_); +} + =head2 loader_class =over 4 @@ -177,8 +189,8 @@ sub _invoke_loader { eval { $self->ensure_class_loaded($impl) }; croak qq/Could not load loader_class "$impl": "$@"/ if $@; - $self->_loader($impl->new(%$args)); - $self->_loader->load; + $self->loader($impl->new(%$args)); + $self->loader->load; $self->_loader_invoked(1); $self; @@ -409,7 +421,7 @@ Returns a list of the new monikers added. =cut -sub rescan { my $self = shift; $self->_loader->rescan($self) } +sub rescan { my $self = shift; $self->loader->rescan($self) } =head2 naming