File Coverage

blib/lib/Pickles/View.pm
Criterion Covered Total %
statement 22 26 84.6
branch 4 4 100.0
condition 2 4 50.0
subroutine 5 7 71.4
pod 0 5 0.0
total 33 46 71.7


line stmt bran cond sub pod time code
1             package Pickles::View;
2 3     3   1221 use strict;
  3         6  
  3         98  
3 3     3   14 use base qw(Class::Data::Inheritable);
  3         5  
  3         1064  
4              
5             __PACKAGE__->mk_classdata(qw(__Config));
6              
7             sub new {
8 0     0 0 0 my $class = shift;
9 0         0 my $self = bless {}, $class;
10 0         0 $self;
11             }
12              
13 0     0 0 0 sub render { die 'abstract method!'; }
14 2     2 0 89 sub content_type { 'text/html'; }
15              
16             sub config {
17 6     6 0 169 my $class = shift;
18 6 100 50     28 return ($class->__Config || {}) unless @_;
19 4         9 my $values = $_[0];
20 4 100       16 if ( @_ > 1 ) {
21 2         8 $values = { @_ };
22             }
23 4         36 $class->__Config( $values );
24             }
25              
26             sub merge_config {
27 2     2 0 4 my( $self, $c ) = @_;
28              
29 2         5 my $class = ref $self;
30 2         13 my $appname = $c->config->appname;
31 2         47 (my $config_key = $class) =~ s/^${appname}:://;
32 2   50     9 my $config = $c->config->{$config_key} || {};
33 2         8 my %config = (
34 2         35 %{$self->config},
35 2         17 %{$config},
36             );
37 2         11 return \%config;
38             }
39              
40             1;
41              
42             __END__