File Coverage

blib/lib/Catalyst/View/Template/Lace/Factory.pm
Criterion Covered Total %
statement 5 6 83.3
branch 1 2 50.0
condition n/a
subroutine 2 2 100.0
pod 0 1 0.0
total 8 11 72.7


line stmt bran cond sub pod time code
1             package Catalyst::View::Template::Lace::Factory;
2              
3 1     1   380 use Moo;
  1         2  
  1         6  
4              
5             extends 'Template::Lace::Factory';
6              
7             has 'catalyst_component_name' => (is=>'ro');
8              
9             sub ACCEPT_CONTEXT {
10 9     9 0 446 my ($factory, $c, @args) = @_;
11 9 50       52 return $factory unless ref $c;
12 0           return $factory->create(@args, ctx=>$c);
13             }
14              
15             1;
16              
17             =head1 NAME
18              
19             Catalyst::View::Template::Lace::Factory - Adapt Template::Lace for Catalyst
20              
21             =head1 SYNOPSIS
22              
23             TBD
24              
25             =head1 DESCRIPTION
26              
27             This is a subclass of L<Template::Lace::Factory> which does C<ACCEPT_CONTEXT>
28             so that we can adapt the creation of templates to L<Catalyst>. Any arguments
29             passed to the C<view> method are sent to C<create>. We also capture the context
30             object and send it as C<ctx> as an argument, that way your templates get access
31             to context via the C<ctx> attributes (see L<Catalyst::View::Template::Lace>.)
32              
33             Otherwise there's no real user useful bits here beyond education.
34              
35             =head1 AUTHOR
36            
37             John Napiorkowski L<email:jjnapiork@cpan.org>
38            
39             =head1 SEE ALSO
40            
41             L<Template::Lace>, L<Catalyst::View::Template::Lace>
42              
43             =head1 COPYRIGHT & LICENSE
44            
45             Copyright 2017, John Napiorkowski L<email:jjnapiork@cpan.org>
46            
47             This library is free software; you can redistribute it and/or modify it under
48             the same terms as Perl itself.
49              
50             =cut