| 1 | package # hide from PAUSE | ||||||||||
| 2 | DBIx::Class::CDBICompat::Copy; | ||||||||||
| 3 | |||||||||||
| 4 | 2 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | 2 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 6 | |||||||||||
| 7 | 2 | ▶ | use Carp; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 8 | |||||||||||
| 9 | =head1 NAME | ||||||||||
| 10 | |||||||||||
| 11 | DBIx::Class::CDBICompat::Copy - Emulates Class::DBI->copy($new_id) | ||||||||||
| 12 | |||||||||||
| 13 | =head1 SYNOPSIS | ||||||||||
| 14 | |||||||||||
| 15 | See DBIx::Class::CDBICompat for usage directions. | ||||||||||
| 16 | |||||||||||
| 17 | =head1 DESCRIPTION | ||||||||||
| 18 | |||||||||||
| 19 | Emulates C<<Class::DBI->copy($new_id)>>. | ||||||||||
| 20 | |||||||||||
| 21 | =cut | ||||||||||
| 22 | |||||||||||
| 23 | |||||||||||
| 24 | # CDBI's copy will take an id in addition to a hash ref. | ||||||||||
| 25 | 0 | ▶ | sub copy { | ||||||||
|
Subroutine
copy: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 26 | 0 | my($self, $arg) = @_; | |||||||||
| 27 | 0 | ▶ | return $self->next::method($arg) if ref $arg; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 28 | |||||||||||
| 29 | 0 | my @primary_columns = $self->primary_columns; | |||||||||
| 30 | 0 | ▶ | croak("Need hash-ref to edit copied column values") | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | if @primary_columns > 1; | ||||||||||
| 32 | |||||||||||
| 33 | 0 | return $self->next::method({ $primary_columns[0] => $arg }); | |||||||||
| 34 | } | ||||||||||
| 35 | |||||||||||
| 36 | =head1 FURTHER QUESTIONS? | ||||||||||
| 37 | |||||||||||
| 38 | Check the list of L<additional DBIC resources|DBIx::Class/GETTING HELP/SUPPORT>. | ||||||||||
| 39 | |||||||||||
| 40 | =head1 COPYRIGHT AND LICENSE | ||||||||||
| 41 | |||||||||||
| 42 | This module is free software L<copyright|DBIx::Class/COPYRIGHT AND LICENSE> | ||||||||||
| 43 | by the L<DBIx::Class (DBIC) authors|DBIx::Class/AUTHORS>. You can | ||||||||||
| 44 | redistribute it and/or modify it under the same terms as the | ||||||||||
| 45 | L<DBIx::Class library|DBIx::Class/COPYRIGHT AND LICENSE>. | ||||||||||
| 46 | |||||||||||
| 47 | =cut | ||||||||||
| 48 | |||||||||||
| 49 | 2 | 1; | |||||||||