Skip Menu |

This queue is for tickets about the DBIx-Class CPAN distribution.

Report information
The Basics
Id: 40343
Status: resolved
Priority: 0/
Queue: DBIx-Class

People
Owner: Nobody in particular
Requestors: schwern [...] pobox.com
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.08100



CC: Matt S Trout <mst [...] shadowcat.co.uk>
Subject: CDBICompat and possible 5.10 C3 bug
Date: Fri, 24 Oct 2008 03:26:07 -0700
To: bug-DBIx-Class [...] rt.cpan.org
From: Michael G Schwern <schwern [...] pobox.com>
When the attached patch is applied to the 0.08 trunk the CDBI tests fail with 5.10.0 but not with 5.8.8. This is because mk_group_accessors() is landing in Class::Accessor::Grouped rather than DBIx::Class::CDBICompat::AccessorMapping. mst diagnosed it as a C3 bug in 5.10.0. In t/cdbi-t/15-accessor.t Class::C3 and mro say different things about the inheritance chain. It seems to be following the mro order. If "use mro 'c3'" is added to the top of Film.pm the problem goes away. DB<1> x Class::C3::calculateMRO("Film") 0 'Film' 1 'DBIx::Class::Test::SQLite' 2 'DBIx::Class::CDBICompat' 3 'DBIx::Class::CDBICompat::Constraints' 4 'DBIx::Class::CDBICompat::Triggers' 5 'DBIx::Class::CDBICompat::ReadOnly' 6 'DBIx::Class::CDBICompat::LiveObjectIndex' 7 'DBIx::Class::CDBICompat::AttributeAPI' 8 'DBIx::Class::CDBICompat::Stringify' 9 'DBIx::Class::CDBICompat::DestroyWarning' 10 'DBIx::Class::CDBICompat::Constructor' 11 'DBIx::Class::CDBICompat::AccessorMapping' 12 'DBIx::Class::CDBICompat::ColumnCase' 13 'DBIx::Class::CDBICompat::Relationships' 14 'DBIx::Class::CDBICompat::Copy' 15 'DBIx::Class::CDBICompat::LazyLoading' 16 'DBIx::Class::CDBICompat::AutoUpdate' 17 'DBIx::Class::CDBICompat::TempColumns' 18 'DBIx::Class::CDBICompat::GetSet' 19 'DBIx::Class::CDBICompat::Retrieve' 20 'DBIx::Class::CDBICompat::Pager' 21 'DBIx::Class::CDBICompat::ColumnGroups' 22 'DBIx::Class::CDBICompat::ColumnsAsHash' 23 'DBIx::Class::CDBICompat::AbstractSearch' 24 'DBIx::Class::CDBICompat::ImaDBI' 25 'DBIx::Class::CDBICompat::Iterator' 26 'DBIx::Class::Core' 27 'DBIx::Class::Relationship' 28 'DBIx::Class::Relationship::Helpers' 29 'DBIx::Class::Relationship::HasMany' 30 'DBIx::Class::Relationship::HasOne' 31 'DBIx::Class::Relationship::BelongsTo' 32 'DBIx::Class::Relationship::ManyToMany' 33 'DBIx::Class::Relationship::Accessor' 34 'DBIx::Class::Relationship::CascadeActions' 35 'DBIx::Class::Relationship::ProxyMethods' 36 'DBIx::Class::Relationship::Base' 37 'DBIx::Class::InflateColumn' 38 'DBIx::Class::PK::Auto' 39 'DBIx::Class::PK' 40 'DBIx::Class::Row' 41 'DBIx::Class::ResultSourceProxy::Table' 42 'DBIx::Class::ResultSourceProxy' 43 'DBIx::Class::DB' 44 'DBIx::Class::ResultSetProxy' 45 'DBIx::Class' 46 'DBIx::Class::Componentised' 47 'Class::C3::Componentised' 48 'DBIx::Class::ClassData' 49 'Class::Accessor::Grouped' DB<2> x mro::get_linear_isa("Film") 0 ARRAY(0x1ba07d0) 0 'Film' 1 'DBIx::Class::Test::SQLite' 2 'DBIx::Class::CDBICompat' 3 'DBIx::Class::CDBICompat::Constraints' 4 'DBIx::Class::CDBICompat::Triggers' 5 'DBIx::Class::CDBICompat::ReadOnly' 6 'DBIx::Class::CDBICompat::LiveObjectIndex' 7 'DBIx::Class::ClassData' 8 'Class::Accessor::Grouped' 9 'DBIx::Class::CDBICompat::AttributeAPI' 10 'DBIx::Class::CDBICompat::Stringify' 11 'DBIx::Class::CDBICompat::DestroyWarning' 12 'DBIx::Class::CDBICompat::Constructor' 13 'DBIx::Class::CDBICompat::ImaDBI' 14 'DBIx::Class::CDBICompat::AccessorMapping' 15 'DBIx::Class::CDBICompat::ColumnCase' 16 'DBIx::Class::CDBICompat::Relationships' 17 'DBIx::Class::CDBICompat::Copy' 18 'DBIx::Class::CDBICompat::LazyLoading' 19 'DBIx::Class::CDBICompat::AutoUpdate' 20 'DBIx::Class::CDBICompat::TempColumns' 21 'DBIx::Class::CDBICompat::GetSet' 22 'DBIx::Class::CDBICompat::Retrieve' 23 'DBIx::Class::CDBICompat::Pager' 24 'DBIx::Class::CDBICompat::ColumnGroups' 25 'DBIx::Class::Row' 26 'DBIx::Class' 27 'DBIx::Class::Componentised' 28 'Class::C3::Componentised' 29 'DBIx::Class::CDBICompat::ColumnsAsHash' 30 'DBIx::Class::CDBICompat::AbstractSearch' 31 'DBIx::Class::CDBICompat::Iterator' 32 'DBIx::Class::Core' 33 'DBIx::Class::Relationship' 34 'DBIx::Class::Relationship::Helpers' 35 'DBIx::Class::Relationship::HasMany' 36 'DBIx::Class::Relationship::HasOne' 37 'DBIx::Class::Relationship::BelongsTo' 38 'DBIx::Class::Relationship::ManyToMany' 39 'DBIx::Class::Relationship::Accessor' 40 'DBIx::Class::Relationship::CascadeActions' 41 'DBIx::Class::Relationship::ProxyMethods' 42 'DBIx::Class::Relationship::Base' 43 'DBIx::Class::InflateColumn' 44 'DBIx::Class::PK::Auto' 45 'DBIx::Class::PK' 46 'DBIx::Class::ResultSourceProxy::Table' 47 'DBIx::Class::ResultSourceProxy' 48 'DBIx::Class::DB' 49 'DBIx::Class::ResultSetProxy' -- Whip me, beat me, make my code compatible with VMS!
diff --git a/lib/DBIx/Class.pm b/lib/DBIx/Class.pm index 1cb6a68..988cd2a 100644 --- a/lib/DBIx/Class.pm +++ b/lib/DBIx/Class.pm @@ -4,20 +4,10 @@ use strict; use warnings; use vars qw($VERSION); -use base qw/DBIx::Class::Componentised Class::Accessor::Grouped/; +use base qw/DBIx::Class::Componentised DBIx::Class::ClassData/; use DBIx::Class::StartupCheck; -sub mk_classdata { - shift->mk_classaccessor(@_); -} - -sub mk_classaccessor { - my $self = shift; - $self->mk_group_accessors('inherited', $_[0]); - $self->set_inherited(@_) if @_ > 1; -} - sub component_base_class { 'DBIx::Class' } # Always remember to do all digits for the version even if they're 0 diff --git a/lib/DBIx/Class/CDBICompat/AccessorMapping.pm b/lib/DBIx/Class/CDBICompat/AccessorMapping.pm index a8f03e6..0e128aa 100644 --- a/lib/DBIx/Class/CDBICompat/AccessorMapping.pm +++ b/lib/DBIx/Class/CDBICompat/AccessorMapping.pm @@ -4,6 +4,8 @@ package # hide from PAUSE Indexer use strict; use warnings; +use base qw(DBIx::Class::ClassData); + sub mk_group_accessors { my ($class, $group, @cols) = @_; diff --git a/lib/DBIx/Class/CDBICompat/AutoUpdate.pm b/lib/DBIx/Class/CDBICompat/AutoUpdate.pm index c32c125..4f78372 100644 --- a/lib/DBIx/Class/CDBICompat/AutoUpdate.pm +++ b/lib/DBIx/Class/CDBICompat/AutoUpdate.pm @@ -4,7 +4,7 @@ package # hide from PAUSE use strict; use warnings; -use base qw/Class::Data::Inheritable/; +use base qw/DBIx::Class::ClassData/; __PACKAGE__->mk_classdata('__AutoCommit'); diff --git a/lib/DBIx/Class/CDBICompat/ImaDBI.pm b/lib/DBIx/Class/CDBICompat/ImaDBI.pm index 7a3b4f0..78ae773 100644 --- a/lib/DBIx/Class/CDBICompat/ImaDBI.pm +++ b/lib/DBIx/Class/CDBICompat/ImaDBI.pm @@ -6,7 +6,7 @@ use warnings; use DBIx::ContextualFetch; use Sub::Name (); -use base qw(Class::Data::Inheritable); +use base qw(DBIx::Class::ClassData); __PACKAGE__->mk_classdata('sql_transformer_class' => 'DBIx::Class::CDBICompat::SQLTransformer'); diff --git a/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm b/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm index 445282c..3eda400 100644 --- a/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm +++ b/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm @@ -6,7 +6,7 @@ use warnings; use Scalar::Util qw/weaken/; -use base qw/Class::Data::Inheritable/; +use base qw/DBIx::Class::ClassData/; __PACKAGE__->mk_classdata('purge_object_index_every' => 1000); __PACKAGE__->mk_classdata('live_object_index' => { }); diff --git a/lib/DBIx/Class/CDBICompat/Relationships.pm b/lib/DBIx/Class/CDBICompat/Relationships.pm index d6120bc..4239075 100644 --- a/lib/DBIx/Class/CDBICompat/Relationships.pm +++ b/lib/DBIx/Class/CDBICompat/Relationships.pm @@ -4,7 +4,7 @@ package # hide from PAUSE use strict; use warnings; use Sub::Name (); -use base qw/Class::Data::Inheritable/; +use base qw/DBIx::Class::ClassData/; use Clone; use DBIx::Class::CDBICompat::Relationship; diff --git a/lib/DBIx/Class/CDBICompat/TempColumns.pm b/lib/DBIx/Class/CDBICompat/TempColumns.pm index f5b60d4..937a85c 100644 --- a/lib/DBIx/Class/CDBICompat/TempColumns.pm +++ b/lib/DBIx/Class/CDBICompat/TempColumns.pm @@ -3,7 +3,7 @@ package # hide from PAUSE use strict; use warnings; -use base qw/Class::Data::Inheritable/; +use base qw/DBIx::Class::ClassData/; use Carp; diff --git a/lib/DBIx/Class/ClassData.pm b/lib/DBIx/Class/ClassData.pm new file mode 100644 index 0000000..beaee94 --- /dev/null +++ b/lib/DBIx/Class/ClassData.pm @@ -0,0 +1,19 @@ +package DBIx::Class::ClassData; + +use strict; +use warnings; + +use base qw(Class::Accessor::Grouped); + +sub mk_classdata { + shift->mk_classaccessor(@_); +} + +sub mk_classaccessor { + my $self = shift; + + $self->mk_group_accessors('inherited', $_[0]); + $self->set_inherited(@_) if @_ > 1; +} + +1;
On Vr. Okt. 24 06:27:12 2008, schwern@pobox.com wrote: Show quoted text
> When the attached patch is applied to the 0.08 trunk the CDBI tests > fail with > 5.10.0 but not with 5.8.8. This is because mk_group_accessors() is > landing in > Class::Accessor::Grouped rather than > DBIx::Class::CDBICompat::AccessorMapping. > > mst diagnosed it as a C3 bug in 5.10.0. >
See also my reply in the rt ticket in rt.perl.org. http://rt.perl.org/rt3/Ticket/Display.html?id=66096 Best regards, Bram
This is now clearly a perl issue, and a workaround (useing Class::Data::Inheritable) was committed pre-0.08100. Marking as resolved at this point.