File Coverage

blib/lib/RapidApp/Template/Store.pm
Criterion Covered Total %
statement 20 28 71.4
branch 1 2 50.0
condition n/a
subroutine 7 14 50.0
pod 0 8 0.0
total 28 52 53.8


line stmt bran cond sub pod time code
1             package RapidApp::Template::Store;
2 1     1   738 use strict;
  1         3  
  1         35  
3 1     1   23 use warnings;
  1         2  
  1         31  
4 1     1   5 use autodie;
  1         3  
  1         19  
5              
6 1     1   6108 use RapidApp::Util qw(:all);
  1         3  
  1         707  
7              
8 1     1   8 use Moo;
  1         2  
  1         14  
9 1     1   3520 use Types::Standard ':all';
  1         4  
  1         30  
10              
11              
12             =pod
13              
14             =head1 DESCRIPTION
15              
16             Base Template Store class which can be extended to provide an additional/different method
17             to provide template content. This class is separate from the Provider class in order to
18             supply a more simple API which consists of nothing but returning I/O associated
19             with a template name. While this is the job of the original Template::Provider from
20             the native Template::Toolkit, RapidApp::Template::Provider already extends the original
21             concept beyond simple template fetching, which justifies the need for this additional layer.
22              
23             =cut
24              
25             # reference to the Provider object is available if needed
26             has 'Provider', is => 'ro', required => 1;
27              
28             # Base class owns no templates by default
29             has 'owned_tpl_regex', is => 'ro', isa => Maybe[Str], default => sub {undef};
30              
31              
32             # Compiled regex:
33             has '_owned_tpl_regexp', is => 'ro', lazy => 1, default => sub {
34             my $str = (shift)->owned_tpl_regex or return undef;
35             return qr/$str/;
36             }, isa => Maybe[RegexpRef];
37              
38              
39             sub owns_tpl {
40 2     2 0 112 my ($self, $name) = @_;
41 2 50       45 my $re = $self->_owned_tpl_regexp or return 0;
42 0           $name =~ $re
43              
44             }
45              
46              
47 0     0 0   sub template_exists { ... }
48 0     0 0   sub template_mtime { ... }
49 0     0 0   sub template_content { ... }
50 0     0 0   sub create_template { ... }
51 0     0 0   sub update_template { ... }
52 0     0 0   sub delete_template { ... }
53 0     0 0   sub list_templates {[]}
54              
55              
56              
57              
58              
59              
60              
61             1;