File Coverage

blib/lib/App/TemplateServer/Provider/Null.pm
Criterion Covered Total %
statement 1 3 33.3
branch n/a
condition n/a
subroutine 1 1 100.0
pod n/a
total 2 4 50.0


line stmt bran cond sub pod time code
1             package App::TemplateServer::Provider::Null;
2 1     1   35271 use Moose;
  0            
  0            
3             use Method::Signatures;
4             use YAML::Syck;
5              
6             with 'App::TemplateServer::Provider';
7              
8             method list_templates {
9             return qw/this is a test/;
10             };
11              
12             method render_template($template, $context){
13             my $data = Dump({%$context, docroot => [$self->docroot]});
14             $data =~ s/&/&/g;
15             $data =~ s/</&lt;/g;
16             $data =~ s/>/&gt;/g;
17            
18             my $res = "<p>This is a template called $template</p>";
19             $res .= "<p>Here is all the data I know about:<br />";
20             $res .= "<blockquote><pre>$data</pre></blockquote></p>";
21              
22             return $res;
23             };
24              
25             1;
26             __END__
27              
28             =head1 NAME
29              
30             App::TemplateServer::Provider::Null - a test template provider
31              
32             =head1 SYNOPSIS
33              
34             This doesn't do anything useful. It's just example code for you
35             to poke at.
36              
37             Try it out like this:
38              
39             template-server --provider Null --data /path/to/some/yaml
40              
41             Then visit C<http://localhost:4000/test> and you can see the YAML.
42              
43             =head1 METHODS
44              
45             =head2 list_templates
46              
47             =head2 render_template
48              
49             Both implemented as C<App::TemplateServer::Provider> suggests.
50              
51             =head1 SEE ALSO
52              
53             L<App::TemplateServer|App::TemplateServer>
54              
55             L<App::TemplateServer::Provider|App::TemplateServer::Provider>