From: Peter Rabbitson Date: Tue, 19 Apr 2016 08:04:26 +0000 (+0200) Subject: Remove Class::Data::Inheritable and use CAG 'inherited' style accessors X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=5e0eea35;p=dbsrgits%2FDBIx-Class-Historic.git Remove Class::Data::Inheritable and use CAG 'inherited' style accessors This *is* a subtle change in behavior, as the CAG accessors could be overriden by a rogue get/set_inherited in the stack. However keeping CDI in-place while satisfying the requirements of the rsrc refactor is just too much work for a miniscule risk avoidance. If something blows up - we'll think then. --- diff --git a/lib/DBIx/Class/CDBICompat/AbstractSearch.pm b/lib/DBIx/Class/CDBICompat/AbstractSearch.pm index 8f59106..23c009e 100644 --- a/lib/DBIx/Class/CDBICompat/AbstractSearch.pm +++ b/lib/DBIx/Class/CDBICompat/AbstractSearch.pm @@ -4,6 +4,8 @@ package # hide form PAUSE use strict; use warnings; +use base 'DBIx::Class'; + =head1 NAME DBIx::Class::CDBICompat::AbstractSearch - Emulates Class::DBI::AbstractSearch diff --git a/lib/DBIx/Class/CDBICompat/AccessorMapping.pm b/lib/DBIx/Class/CDBICompat/AccessorMapping.pm index 1555937..e235440 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 'DBIx::Class'; + use Scalar::Util 'blessed'; use namespace::clean; diff --git a/lib/DBIx/Class/CDBICompat/AttributeAPI.pm b/lib/DBIx/Class/CDBICompat/AttributeAPI.pm index abf9ac0..c847a39 100644 --- a/lib/DBIx/Class/CDBICompat/AttributeAPI.pm +++ b/lib/DBIx/Class/CDBICompat/AttributeAPI.pm @@ -4,6 +4,8 @@ package # hide from PAUSE use strict; use warnings; +use base 'DBIx::Class'; + sub _attrs { my ($self, @atts) = @_; return @{$self->{_column_data}}{@atts}; diff --git a/lib/DBIx/Class/CDBICompat/AutoUpdate.pm b/lib/DBIx/Class/CDBICompat/AutoUpdate.pm index c32c125..16f2164 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 'DBIx::Class'; __PACKAGE__->mk_classdata('__AutoCommit'); diff --git a/lib/DBIx/Class/CDBICompat/ColumnCase.pm b/lib/DBIx/Class/CDBICompat/ColumnCase.pm index 13bec9c..56bef61 100644 --- a/lib/DBIx/Class/CDBICompat/ColumnCase.pm +++ b/lib/DBIx/Class/CDBICompat/ColumnCase.pm @@ -4,6 +4,8 @@ package # hide from PAUSE use strict; use warnings; +use base 'DBIx::Class'; + sub _register_column_group { my ($class, $group, @cols) = @_; return $class->next::method($group => map lc, @cols); diff --git a/lib/DBIx/Class/CDBICompat/ColumnsAsHash.pm b/lib/DBIx/Class/CDBICompat/ColumnsAsHash.pm index c5c1fe1..51b6e0b 100644 --- a/lib/DBIx/Class/CDBICompat/ColumnsAsHash.pm +++ b/lib/DBIx/Class/CDBICompat/ColumnsAsHash.pm @@ -4,6 +4,7 @@ package use strict; use warnings; +use base 'DBIx::Class'; =head1 NAME diff --git a/lib/DBIx/Class/CDBICompat/Constraints.pm b/lib/DBIx/Class/CDBICompat/Constraints.pm index 1014886..f77db52 100644 --- a/lib/DBIx/Class/CDBICompat/Constraints.pm +++ b/lib/DBIx/Class/CDBICompat/Constraints.pm @@ -1,6 +1,8 @@ package # hide from PAUSE DBIx::Class::CDBICompat::Constraints; +use base 'DBIx::Class'; + use strict; use warnings; diff --git a/lib/DBIx/Class/CDBICompat/Copy.pm b/lib/DBIx/Class/CDBICompat/Copy.pm index 77e7b5b..ec2e9ca 100644 --- a/lib/DBIx/Class/CDBICompat/Copy.pm +++ b/lib/DBIx/Class/CDBICompat/Copy.pm @@ -4,6 +4,8 @@ package # hide from PAUSE use strict; use warnings; +use base 'DBIx::Class'; + use Carp; =head1 NAME diff --git a/lib/DBIx/Class/CDBICompat/DestroyWarning.pm b/lib/DBIx/Class/CDBICompat/DestroyWarning.pm index 61d243c..998bc5d 100644 --- a/lib/DBIx/Class/CDBICompat/DestroyWarning.pm +++ b/lib/DBIx/Class/CDBICompat/DestroyWarning.pm @@ -3,6 +3,9 @@ package # hide from PAUSE use strict; use warnings; + +use base 'DBIx::Class'; + use DBIx::Class::_Util 'detected_reinvoked_destructor'; use namespace::clean; diff --git a/lib/DBIx/Class/CDBICompat/GetSet.pm b/lib/DBIx/Class/CDBICompat/GetSet.pm index dd621f2..e948048 100644 --- a/lib/DBIx/Class/CDBICompat/GetSet.pm +++ b/lib/DBIx/Class/CDBICompat/GetSet.pm @@ -4,7 +4,7 @@ package # hide from PAUSE use strict; use warnings; -#use base qw/Class::Accessor/; +use base 'DBIx::Class'; sub get { my ($self, @cols) = @_; diff --git a/lib/DBIx/Class/CDBICompat/ImaDBI.pm b/lib/DBIx/Class/CDBICompat/ImaDBI.pm index 0ec6993..7a88d15 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 DBIx::Class::_Util qw(quote_sub perlstring); -use base qw(Class::Data::Inheritable); +use base 'DBIx::Class'; __PACKAGE__->mk_classdata('sql_transformer_class' => 'DBIx::Class::CDBICompat::SQLTransformer'); diff --git a/lib/DBIx/Class/CDBICompat/Iterator.pm b/lib/DBIx/Class/CDBICompat/Iterator.pm index 86a3838..4995837 100644 --- a/lib/DBIx/Class/CDBICompat/Iterator.pm +++ b/lib/DBIx/Class/CDBICompat/Iterator.pm @@ -3,6 +3,7 @@ package DBIx::Class::CDBICompat::Iterator; use strict; use warnings; +use base 'DBIx::Class'; =head1 NAME diff --git a/lib/DBIx/Class/CDBICompat/LazyLoading.pm b/lib/DBIx/Class/CDBICompat/LazyLoading.pm index 798fcd3..a9e41af 100644 --- a/lib/DBIx/Class/CDBICompat/LazyLoading.pm +++ b/lib/DBIx/Class/CDBICompat/LazyLoading.pm @@ -4,6 +4,8 @@ package # hide from PAUSE use strict; use warnings; +use base 'DBIx::Class'; + sub resultset_instance { my $self = shift; my $rs = $self->next::method(@_); diff --git a/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm b/lib/DBIx/Class/CDBICompat/LiveObjectIndex.pm index f05eff7..970b2d9 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 'DBIx::Class'; __PACKAGE__->mk_classdata('purge_object_index_every' => 1000); __PACKAGE__->mk_classdata('live_object_index' => { }); diff --git a/lib/DBIx/Class/CDBICompat/NoObjectIndex.pm b/lib/DBIx/Class/CDBICompat/NoObjectIndex.pm index f3c472d..e98e5eb 100644 --- a/lib/DBIx/Class/CDBICompat/NoObjectIndex.pm +++ b/lib/DBIx/Class/CDBICompat/NoObjectIndex.pm @@ -4,6 +4,8 @@ package # hide from PAUSE use strict; use warnings; +use base 'DBIx::Class'; + =head1 NAME DBIx::Class::CDBICompat::NoObjectIndex - Defines empty methods for object indexing. They do nothing diff --git a/lib/DBIx/Class/CDBICompat/Pager.pm b/lib/DBIx/Class/CDBICompat/Pager.pm index 203b598..c8f76fe 100644 --- a/lib/DBIx/Class/CDBICompat/Pager.pm +++ b/lib/DBIx/Class/CDBICompat/Pager.pm @@ -8,6 +8,8 @@ use strict; # leaving the compat layer as-is, something may in fact depend on that use warnings FATAL => 'all'; +use base 'DBIx::Class'; + *pager = \&page; sub page { diff --git a/lib/DBIx/Class/CDBICompat/ReadOnly.pm b/lib/DBIx/Class/CDBICompat/ReadOnly.pm index 669a76d..9bab1f4 100644 --- a/lib/DBIx/Class/CDBICompat/ReadOnly.pm +++ b/lib/DBIx/Class/CDBICompat/ReadOnly.pm @@ -4,6 +4,8 @@ package # hide from PAUSE use strict; use warnings; +use base 'DBIx::Class'; + sub make_read_only { my $proto = shift; $proto->add_trigger("before_$_" => sub { shift->throw_exception("$proto is read only") }) diff --git a/lib/DBIx/Class/CDBICompat/Relationship.pm b/lib/DBIx/Class/CDBICompat/Relationship.pm index 95e414d..f9d0769 100644 --- a/lib/DBIx/Class/CDBICompat/Relationship.pm +++ b/lib/DBIx/Class/CDBICompat/Relationship.pm @@ -4,6 +4,8 @@ package use strict; use warnings; +use base 'DBIx::Class'; + use DBIx::Class::_Util 'quote_sub'; =head1 NAME diff --git a/lib/DBIx/Class/CDBICompat/Relationships.pm b/lib/DBIx/Class/CDBICompat/Relationships.pm index 8d923b3..abd6783 100644 --- a/lib/DBIx/Class/CDBICompat/Relationships.pm +++ b/lib/DBIx/Class/CDBICompat/Relationships.pm @@ -3,7 +3,7 @@ package # hide from PAUSE use strict; use warnings; -use base 'Class::Data::Inheritable'; +use base 'DBIx::Class'; use Clone; use DBIx::Class::CDBICompat::Relationship; diff --git a/lib/DBIx/Class/CDBICompat/Retrieve.pm b/lib/DBIx/Class/CDBICompat/Retrieve.pm index 87f5318..2ddd4b2 100644 --- a/lib/DBIx/Class/CDBICompat/Retrieve.pm +++ b/lib/DBIx/Class/CDBICompat/Retrieve.pm @@ -8,6 +8,8 @@ use strict; # leaving the compat layer as-is, something may in fact depend on that use warnings FATAL => 'all'; +use base 'DBIx::Class'; + sub retrieve { my $self = shift; die "No args to retrieve" unless @_ > 0; diff --git a/lib/DBIx/Class/CDBICompat/SQLTransformer.pm b/lib/DBIx/Class/CDBICompat/SQLTransformer.pm index fd54b7e..cc9d9f0 100644 --- a/lib/DBIx/Class/CDBICompat/SQLTransformer.pm +++ b/lib/DBIx/Class/CDBICompat/SQLTransformer.pm @@ -3,6 +3,8 @@ package DBIx::Class::CDBICompat::SQLTransformer; use strict; use warnings; +use base 'DBIx::Class'; + =head1 NAME DBIx::Class::CDBICompat::SQLTransformer - Transform SQL diff --git a/lib/DBIx/Class/CDBICompat/Stringify.pm b/lib/DBIx/Class/CDBICompat/Stringify.pm index 4d13171..e1c9a36 100644 --- a/lib/DBIx/Class/CDBICompat/Stringify.pm +++ b/lib/DBIx/Class/CDBICompat/Stringify.pm @@ -4,7 +4,7 @@ package # hide from PAUSE use strict; use warnings; -use Scalar::Util; +use base 'DBIx::Class'; use overload '""' => sub { return shift->stringify_self; }, diff --git a/lib/DBIx/Class/CDBICompat/TempColumns.pm b/lib/DBIx/Class/CDBICompat/TempColumns.pm index 428719e..3a111ee 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 'DBIx::Class'; use Carp; diff --git a/lib/DBIx/Class/CDBICompat/Triggers.pm b/lib/DBIx/Class/CDBICompat/Triggers.pm index 3f6aef7..0428b6a 100644 --- a/lib/DBIx/Class/CDBICompat/Triggers.pm +++ b/lib/DBIx/Class/CDBICompat/Triggers.pm @@ -3,6 +3,9 @@ package # hide from PAUSE use strict; use warnings; + +use base 'DBIx::Class'; + use Class::Trigger; sub insert { diff --git a/lib/DBIx/Class/Optional/Dependencies.pm b/lib/DBIx/Class/Optional/Dependencies.pm index 43790b2..4bb44ff 100644 --- a/lib/DBIx/Class/Optional/Dependencies.pm +++ b/lib/DBIx/Class/Optional/Dependencies.pm @@ -178,7 +178,6 @@ my $dbic_reqs = { cdbicompat => { req => { - 'Class::Data::Inheritable' => '0', 'Class::Trigger' => '0', 'DBIx::ContextualFetch' => '0', 'Clone' => '0.32', diff --git a/xt/extra/c3_mro.t b/xt/extra/c3_mro.t index 1c5001a..27a0341 100644 --- a/xt/extra/c3_mro.t +++ b/xt/extra/c3_mro.t @@ -5,6 +5,7 @@ use strict; use Test::More; use DBICTest; +use DBIx::Class::Optional::Dependencies; my @global_ISA_tail = qw( DBIx::Class @@ -59,6 +60,12 @@ check_ancestry($_) for ( ref( $art->result_source->resultset ), ref( $art->result_source->schema ), qw( AAA BBB CCC ), + ((! DBIx::Class::Optional::Dependencies->req_ok_for('cdbicompat') ) ? () : do { + unshift @INC, 't/cdbi/testlib'; + map { eval "require $_" or die $@; $_ } qw( + Film Lazy Actor ActorAlias ImplicitInflate + ); + }), ); use DBIx::Class::Storage::DBI::Sybase::Microsoft_SQL_Server;