From: Robert Sedlacek Date: Thu, 2 Mar 2006 19:16:30 +0000 (+0000) Subject: add_components() doesn't prepend base when comp. prefixed with + X-Git-Tag: v0.06000~60^2~68 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=6db94aca366e5734230b70b00cad3387ffac9e17;p=dbsrgits%2FDBIx-Class.git add_components() doesn't prepend base when comp. prefixed with + --- diff --git a/Changes b/Changes index 0438e98..57f845f 100644 --- a/Changes +++ b/Changes @@ -1,5 +1,6 @@ Revision history for DBIx::Class + - add_components() doesn't prepend base when comp. prefixed with + - $schema->deploy - HAVING support - prefetch for has_many diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index 4e90838..98054c0 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -166,6 +166,8 @@ Scotty Allen sc_ +Robert Sedlacek + =head1 LICENSE You may distribute this code under the same terms as Perl itself. diff --git a/lib/DBIx/Class/Componentised.pm b/lib/DBIx/Class/Componentised.pm index d4a6641..737e24b 100644 --- a/lib/DBIx/Class/Componentised.pm +++ b/lib/DBIx/Class/Componentised.pm @@ -20,7 +20,7 @@ sub inject_base { sub load_components { my $class = shift; my $base = $class->component_base_class; - my @comp = map { "${base}::$_" } grep { $_ !~ /^#/ } @_; + my @comp = map { /^\+(.*)$/ ? $1 : "${base}::$_" } grep { $_ !~ /^#/ } @_; $class->_load_components(@comp); Class::C3::reinitialize(); } diff --git a/t/05components.t b/t/05components.t new file mode 100644 index 0000000..57bebd5 --- /dev/null +++ b/t/05components.t @@ -0,0 +1,14 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Test::More; + +use lib qw(t/lib); +use DBICTest::ForeignComponent; + +plan tests => 1; + +# Tests if foreign component was loaded by calling foreign's method +ok( DBICTest::ForeignComponent->foreign_test_method, 'foreign component' ); + diff --git a/t/lib/DBICTest/ForeignComponent.pm b/t/lib/DBICTest/ForeignComponent.pm new file mode 100644 index 0000000..a701459 --- /dev/null +++ b/t/lib/DBICTest/ForeignComponent.pm @@ -0,0 +1,10 @@ +# belongs to t/05components.t +package DBICTest::ForeignComponent; +use warnings; +use strict; + +use base qw/ DBIx::Class /; + +__PACKAGE__->load_components( qw/ +DBICTest::ForeignComponent::TestComp / ); + +1; diff --git a/t/lib/DBICTest/ForeignComponent/TestComp.pm b/t/lib/DBICTest/ForeignComponent/TestComp.pm new file mode 100644 index 0000000..ce024ba --- /dev/null +++ b/t/lib/DBICTest/ForeignComponent/TestComp.pm @@ -0,0 +1,8 @@ +# belongs to t/05components.t +package DBICTest::ForeignComponent::TestComp; +use warnings; +use strict; + +sub foreign_test_method { 1 } + +1;