Update to add myself to contributors and to hide Modules from the PAUSE Indexer.
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / AccessorMapping.pm
index 6d5e4b0..c012586 100644 (file)
@@ -1,14 +1,13 @@
-package DBIx::Class::CDBICompat::AccessorMapping;
+package # hide from PAUSE Indexer
+    DBIx::Class::CDBICompat::AccessorMapping;
 
 use strict;
 use warnings;
 
-use NEXT;
-
 sub mk_group_accessors {
   my ($class, $group, @cols) = @_;
   unless ($class->can('accessor_name') || $class->can('mutator_name')) {
-    return $class->NEXT::ACTUAL::mk_group_accessors($group => @cols);
+    return $class->next::method($group => @cols);
   }
   foreach my $col (@cols) {
     my $ro_meth = ($class->can('accessor_name')
@@ -19,7 +18,7 @@ sub mk_group_accessors {
                     : $col);
     #warn "$col $ro_meth $wo_meth";
     if ($ro_meth eq $wo_meth) {
-      $class->NEXT::ACTUAL::mk_group_accessors($group => [ $ro_meth => $col ]);
+      $class->next::method($group => [ $ro_meth => $col ]);
     } else {
       $class->mk_group_ro_accessors($group => [ $ro_meth => $col ]);
       $class->mk_group_wo_accessors($group => [ $wo_meth => $col ]);
@@ -27,23 +26,20 @@ sub mk_group_accessors {
   }
 }
 
-sub create {
+sub new {
   my ($class, $attrs, @rest) = @_;
-  $class->throw( "create needs a hashref" ) unless ref $attrs eq 'HASH';
-  $attrs = { %$attrs };
-  my %att;
-  foreach my $col (keys %{ $class->_columns }) {
+  $class->throw_exception( "create needs a hashref" ) unless ref $attrs eq 'HASH';
+  foreach my $col ($class->columns) {
     if ($class->can('accessor_name')) {
       my $acc = $class->accessor_name($col);
-#warn "$col $acc";
-      $att{$col} = delete $attrs->{$acc} if exists $attrs->{$acc};
+      $attrs->{$col} = delete $attrs->{$acc} if exists $attrs->{$acc};
     }
     if ($class->can('mutator_name')) {
       my $mut = $class->mutator_name($col);
-      $att{$col} = delete $attrs->{$mut} if exists $attrs->{$mut};
+      $attrs->{$col} = delete $attrs->{$mut} if exists $attrs->{$mut};
     }
   }
-  return $class->NEXT::ACTUAL::create({ %$attrs, %att }, @rest);
+  return $class->next::method($attrs, @rest);
 }
 
 1;