| 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
| |||||||||||
| 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
| |||||||||||
| 24 | 4 | ▶ | $action = "on_column_missing_$action" unless ref $action; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 25 | 4 | $action = $self->can($action); | |||||||||
| 26 | } | ||||||||||
| 27 | 5 | scalar $self->$action($column_name) | |||||||||
| 28 | } | ||||||||||
| 29 | } | ||||||||||
| 30 | |||||||||||
| 31 | |||||||||||
| 32 | 56 | 1; | |||||||||
| 33 | |||||||||||
| 34 | __END__ | ||||||||||