Pull in some tests from CDBI 3.16 that already work.
[dbsrgits/DBIx-Class.git] / lib / DBIx / Class / CDBICompat / Copy.pm
CommitLineData
c0494fe1 1package # hide from PAUSE
2 DBIx::Class::CDBICompat::Copy;
3
4use strict;
5use warnings;
6
7use Carp;
8
9# CDBI's copy will take an id in addition to a hash ref.
10sub copy {
11 my($self, $arg) = @_;
12 return $self->next::method($arg) if ref $arg;
13
14 my @primary_columns = $self->primary_columns;
15 croak("Need hash-ref to edit copied column values")
16 if @primary_columns > 1;
17
18 return $self->next::method({ $primary_columns[0] => $arg });
19}
20
211;