- Fix update_all and delete_all to be wrapped in a transaction
- Support add_columns('+colname' => { ... }) to augment column
definitions.
+ - Fix spurious warnings on multiple UTF8Columns component loads
- Unicode support documentation in Cookbook and UTF8Columns
0.08120 2010-02-24 08:58:00 (UTC)
my $target = shift;
my @present_components = (@{mro::get_linear_isa ($target)||[]});
+ shift @present_components; # don't need to interrogate myself
no strict 'refs';
for my $comp (reverse @_) {
- if ($comp->isa ('DBIx::Class::UTF8Columns') ) {
+ # if we are trying add a UTF8Columns component *for the first time*
+ if ($comp->isa ('DBIx::Class::UTF8Columns') && ! $target->isa ('DBIx::Class::UTF8Columns') ) {
require B;
my @broken;
for (@present_components) {
+ last if $_ eq 'DBIx::Class::Row'; # don't care about anything further down the chain
+
my $cref = $_->can ('store_column')
or next;
- push @broken, $_ if B::svref_2object($cref)->STASH->NAME ne 'DBIx::Class::Row';
+
+ push @broken, $_ if B::svref_2object($cref)->STASH->NAME eq $_;
}
carp "Incorrect loading order of $comp by ${target} will affect other components overriding store_column ("
use lib qw(t/lib);
use DBICTest;
-warning_like (
- sub {
- package A::Comp;
- use base 'DBIx::Class';
- sub store_column { shift->next::method (@_) };
- 1;
+{
+ package A::Comp;
+ use base 'DBIx::Class';
+ sub store_column { shift->next::method (@_) };
+ 1;
+}
+
+{
+ package A::SubComp;
+ use base 'A::Comp';
+ 1;
+}
+warnings_like (
+ sub {
package A::Test;
use base 'DBIx::Class::Core';
- __PACKAGE__->load_components(qw(UTF8Columns +A::Comp));
+ __PACKAGE__->load_components(qw(UTF8Columns +A::SubComp +A::Comp));
1;
},
- qr/Incorrect loading order of DBIx::Class::UTF8Columns.+affect other components overriding store_column \(A::Comp\)/,
+ [qr/Incorrect loading order of DBIx::Class::UTF8Columns.+affect other components overriding store_column \(A::Comp\)/],
'incorrect order warning issued',
);
+warnings_are (
+ sub {
+ package A::Test2;
+ use base 'DBIx::Class::Core';
+ __PACKAGE__->load_components(qw(Core +A::Comp Ordered UTF8Columns));
+ __PACKAGE__->load_components(qw(Ordered +A::Comp Row UTF8Columns Core));
+ 1;
+ },
+ [],
+ 'no spurious warnings issued',
+);
+
+my $test2_mro;
+my $idx = 0;
+for (@{mro::get_linear_isa ('A::Test2')} ) {
+ $test2_mro->{$_} = $idx++;
+}
+
+cmp_ok ($test2_mro->{'A::Comp'}, '<', $test2_mro->{'DBIx::Class::UTF8Columns'}, 'mro of Test2 correct (A::Comp before UTF8Col)' );
+cmp_ok ($test2_mro->{'DBIx::Class::UTF8Columns'}, '<', $test2_mro->{'DBIx::Class::Core'}, 'mro of Test2 correct (UTF8Col before Core)' );
+cmp_ok ($test2_mro->{'DBIx::Class::Core'}, '<', $test2_mro->{'DBIx::Class::Row'}, 'mro of Test2 correct (Core before Row)' );
+
my $schema = DBICTest->init_schema();
DBICTest::Schema::CD->load_components('UTF8Columns');
DBICTest::Schema::CD->utf8_columns('title');