File Coverage

blib/lib/Text/Xslate/Compiler/HTMLTemplate.pm
Criterion Covered Total %
statement 10 12 83.3
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 14 16 87.5


line stmt bran cond sub pod time code
1             package Text::Xslate::Compiler::HTMLTemplate;
2              
3 1     1   684 use 5.008_001;
  1         2  
  1         45  
4              
5 1     1   5 use strict;
  1         2  
  1         31  
6 1     1   5 use warnings FATAL => 'recursion';
  1         10  
  1         40  
7              
8 1     1   482 use Any::Moose;
  0            
  0            
9              
10             extends qw(Text::Xslate::Compiler);
11              
12             sub _generate_call {
13             my($self, $node) = @_;
14             my $callable = $node->first; # function or macro
15             my $args = $node->second;
16              
17             my @code = $self->SUPER::_generate_call($node);
18              
19             if($callable->arity eq 'name'){
20             my @code_fetch_symbol = $self->compile_ast($callable);
21             @code = (
22             $self->opcode( pushmark => undef, comment => $callable->id ),
23             (map { $self->push_expr($_) } @{$args}),
24              
25             $self->opcode( fetch_s => $callable->value, line => $callable->line ),
26             $self->opcode( 'dor' => scalar(@code_fetch_symbol) + 1),
27              
28             @code_fetch_symbol,
29             $self->opcode( 'funcall' )
30             );
31             };
32             @code;
33             }
34              
35             no Any::Moose;
36             __PACKAGE__->meta->make_immutable();
37              
38             =head1 NAME
39              
40             Text::Xslate::Compiler::HTMLTemplate - An Xslate compiler to generate HTML::Template compatible intermediate code.
41              
42             =head1 AUTHOR
43              
44             Shigeki Morimoto EShigeki(at)Morimo.toE
45              
46             =head1 LICENSE AND COPYRIGHT
47              
48             Copyright (c) 2011, Shigeki, Morimoto. All rights reserved.
49              
50             This library is free software; you can redistribute it and/or modify
51             it under the same terms as Perl itself.