File Coverage

blib/lib/Aniki/Schema/Table/Field.pm
Criterion Covered Total %
statement 13 19 68.4
branch 0 2 0.0
condition n/a
subroutine 5 6 83.3
pod 1 1 100.0
total 19 28 67.8


line stmt bran cond sub pod time code
1             package Aniki::Schema::Table::Field;
2 29     29   850 use 5.014002;
  29         112  
3              
4 29     29   168 use namespace::autoclean;
  29         60  
  29         218  
5 29     29   2211 use Mouse v2.4.5;
  29         426  
  29         236  
6 29     29   12731 use Carp qw/croak/;
  29         73  
  29         9651  
7              
8             has _field => (
9             is => 'ro',
10             required => 1,
11             );
12              
13             has name => (
14             is => 'ro',
15             default => sub { shift->_field->name },
16             );
17              
18             has is_auto_increment => (
19             is => 'ro',
20             default => sub { shift->_field->is_auto_increment },
21             );
22              
23             has default_value => (
24             is => 'ro',
25             default => sub { shift->_field->default_value },
26             );
27              
28             has sql_data_type => (
29             is => 'ro',
30             default => sub { shift->_field->sql_data_type },
31             );
32              
33             sub BUILDARGS {
34 411     411 1 2892 my ($class, $field) = @_;
35 411         2807 return $class->SUPER::BUILDARGS(_field => $field);
36             }
37              
38             our $AUTOLOAD;
39             sub AUTOLOAD {
40 0     0     my $self = shift;
41 0           my $method = $AUTOLOAD =~ s/^.*://r;
42 0 0         if ($self->_field->can($method)) {
43 0           return $self->_field->$method(@_);
44             }
45              
46 0           my $class = ref $self;
47 0           croak qq{Can't locate object method "$method" via package "$class"};
48             }
49              
50             __PACKAGE__->meta->make_immutable;
51             __END__