DBIx/Class/CDBICompat/Copy.pm

filter: Statementstmt 66.6% 10 / 15 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 75.0% 3 / 4 Podpod 0.0% 0 / 1 totaltotal 54.1% 13 / 24 CC 3 SCAR 18.7
CC
3
Cov
53%
copy
12.0
BEGIN
1.0
BEGIN
1.0
CRAP 6.5
« DBIx/Class/Storage/DBI/mysql.pm ↑ Summary DBIx/Class/SQLMaker/MySQL.pm »
1 package # hide from PAUSE
2 DBIx::Class::CDBICompat::Copy;
3  
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 ▶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 sub copy {
26 0 ▶ my($self, $arg) = @_;
Subroutine copy: not called CC=3 SCAR=24.8
Pod undocumented
27 0 ▶ return $self->next::method($arg) if ref $arg;
Branch: 1 branch
BranchTrueFalseTotal
if ref $arg 0 0 0
28  
29 0 my @primary_columns = $self->primary_columns;
30 0 ▶ croak("Need hash-ref to edit copied column values")
Branch: 1 branch
BranchTrueFalseTotal
if @primary_columns > 1 0 0 0
31 if @primary_columns > 1;
32  
33 0 return $self->next::method({ $primary_columns[0] => $arg });
34 }
35  
36 1 1;
« DBIx/Class/Storage/DBI/mysql.pm ↑ Summary DBIx/Class/SQLMaker/MySQL.pm »