Helper/Row/OnColumnMissing.pm

filter: Statementstmt 95.4% 21 / 22 Branchbran 83.3% 5 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 87.5% 7 / 8 Podpod 20.0% 1 / 5 totaltotal 82.9% 34 / 41 CC 4 SCAR 7.8
CC
4
Cov
93%
get_column
4.0
on_column_missing
2.0
BEGIN
1.0
CRAP 2.2
« Helper/Row/ToJSON.pm ↑ Summary Helper/Row/ProxyResultSetMethod.pm »
1 package DBIx::Class::Helper::Row::OnColumnMissing;
2 56 $DBIx::Class::Helper::Row::OnColumnMissing::VERSION = '2.037000';
3 # ABSTRACT: Configurably handle access of missing columns
4  
5 56 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 56 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 56 ▶use parent 'DBIx::Class::Row';
Subroutine BEGIN: called CC=1 SCAR=0.0
9  
10 0 ▶sub on_column_missing { 'warn' }
Subroutine on_column_missing: not called CC=1 SCAR=6.9
Pod undocumented
11  
12 1 ▶sub on_column_missing_die { die "Column $_[1] has not been loaded" }
Subroutine on_column_missing_die: called CC=1 SCAR=0.0
Pod undocumented
13 1 ▶sub on_column_missing_warn { warn "Column $_[1] has not been loaded" }
Subroutine on_column_missing_warn: called CC=1 SCAR=0.0
Pod undocumented
14 2 ▶sub on_column_missing_nothing {}
Subroutine on_column_missing_nothing: called CC=1 SCAR=0.0
Pod undocumented
15  
16 41 ▶sub get_column {
Subroutine get_column: called CC=4 SCAR=13.9
Pod documented
17 41 my ($self, $column_name) = @_;
18  
19 41 ▶ if ($self->has_column_loaded($column_name)) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->has_column_loaded($column_name)) { } 36 5 41
20 36 $self->next::method($column_name)
21 } else {
22 5 my $action = $self->on_column_missing;
23 5 ▶ unless (ref $action) {
Branch: 1 branch
BranchTrueFalseTotal
unless (ref $action) 4 1 5
24 4 ▶ $action = "on_column_missing_$action" unless ref $action;
Branch: 1 branch
BranchTrueFalseTotal
unless ref $action 4 0 4
25 4 $action = $self->can($action);
26 }
27 5 scalar $self->$action($column_name)
28 }
29 }
30  
31  
32 56 1;
33  
34 __END__
« Helper/Row/ToJSON.pm ↑ Summary Helper/Row/ProxyResultSetMethod.pm »