File Coverage

blib/lib/Alzabo/Runtime/Column.pm
Criterion Covered Total %
statement 15 31 48.3
branch n/a
condition 0 3 0.0
subroutine 5 8 62.5
pod 1 3 33.3
total 21 45 46.6


line stmt bran cond sub pod time code
1             package Alzabo::Runtime::Column;
2              
3 11     11   62 use strict;
  11         24  
  11         391  
4 11     11   64 use vars qw($VERSION);
  11         24  
  11         471  
5              
6 11     11   69 use Alzabo::Runtime;
  11         22  
  11         336  
7 11     11   58 use Params::Validate qw( :all );
  11         26  
  11         2836  
8             Params::Validate::validation_options( on_fail => sub { Alzabo::Exception::Params->throw( error => join '', @_ ) } );
9              
10 11     11   67 use base qw(Alzabo::Column);
  11         20  
  11         3813  
11              
12             $VERSION = 2.0;
13              
14             sub alias_clone
15             {
16 0     0 0   my $self = shift;
17              
18 0           my %p = validate( @_, { table => { isa => 'Alzabo::Runtime::Table' },
19             } );
20              
21 0           my $clone;
22              
23 0           %$clone = %$self;
24 0           $clone->{table} = $p{table};
25              
26 0           bless $clone, ref $self;
27              
28 0           return $clone;
29             }
30              
31             sub alias
32             {
33 0     0 1   my $self = shift;
34 0           my %p = validate( @_, { as => { type => SCALAR } } );
35              
36 0           my $clone;
37 0           %$clone = %$self;
38              
39 0           bless $clone, ref $self;
40              
41 0           $clone->{alias_name} = $p{as};
42 0           $clone->{real_column} = $self;
43              
44 0           return $clone;
45             }
46              
47             sub alias_name
48             {
49 0   0 0 0   return $_[0]->{alias_name} || $_[0]->{name};
50             }
51              
52             1;
53              
54             __END__