X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FDBIx%2FClass%2FSchema%2FLoader.pm;h=eb79ca261b453009a7f5187449016f0c377fc889;hb=518472fafb907ed2633edee57f9adba4d77834d0;hp=6c7c87a78fcdde9866ff5739960500ff980ddf40;hpb=fd64d90d6e091f7036d297a23008648f38259793;p=dbsrgits%2FDBIx-Class-Schema-Loader.git diff --git a/lib/DBIx/Class/Schema/Loader.pm b/lib/DBIx/Class/Schema/Loader.pm index 6c7c87a..eb79ca2 100644 --- a/lib/DBIx/Class/Schema/Loader.pm +++ b/lib/DBIx/Class/Schema/Loader.pm @@ -4,7 +4,7 @@ use strict; use warnings; use base qw/DBIx::Class::Schema/; use base qw/Class::Data::Accessor/; -use Carp::Clan qw/^DBIx::Class::Schema::Loader/; +use Carp::Clan qw/^DBIx::Class/; use UNIVERSAL::require; use Class::C3; use Scalar::Util qw/ weaken /; @@ -12,7 +12,7 @@ use Scalar::Util qw/ weaken /; # 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.03004'; +our $VERSION = '0.03010'; __PACKAGE__->mk_classaccessor('dump_to_dir'); __PACKAGE__->mk_classaccessor('loader'); @@ -83,10 +83,13 @@ This method is *required* at this time, for backwards compatibility reasons. If you do not wish to change any options, just call it with an empty argument list during schema class initialization. -You should either specify this method before setting the connection -information for your schema, or specify these options as a part of -your connection information (see below). For now it will merely -warn if the ordering is wrong, but in the future this will cause problems. +Setting these options explicitly via this method B calling +C is deprecated and will stop working in version 0.04000. +For now the code merely warns about this condition. + +The preferred way of doing things is to either call C +before any connection is made, or embed the C in +the connection information itself as shown below. =cut @@ -102,7 +105,8 @@ sub loader_options { $self->_loader_args(\%args); if($self->storage && !$class->loader) { - warn "Do not set loader_options after specifying the connection info"; + warn "Do not set loader_options after specifying the connection info," + . " this will be unsupported in 0.04000"; $self->_invoke_loader; } @@ -155,7 +159,9 @@ sub connection { $self = $self->next::method(@_); my $class = ref $self || $self; - $self->_invoke_loader if $self->_loader_args && !$class->loader; + if($self->_loader_args && !$class->loader) { + $self->_invoke_loader + } return $self; } @@ -169,14 +175,12 @@ See L. sub clone { my $self = shift; - croak "You failed to specify the required loader_options" - if !$self->_loader_args; - my $clone = $self->next::method(@_); - $clone->_loader_args($self->_loader_args); - $clone->_loader_args->{schema} = $clone; - weaken($clone->_loader_args->{schema}); + if($clone->_loader_args) { + $clone->_loader_args->{schema} = $clone; + weaken($clone->_loader_args->{schema}); + } $clone; }