lib/Decl/Semantics/Template.pm

filter: Statementstmt 60.0% 12 / 20 Branchbran 0.0% 0 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 4 / 8 Podpod 100% 5 / 5 totaltotal 60.0% 21 / 35 CC 2 SCAR 8.9
CC
2
Cov
55%
express
6.0
defines
2.0
parse_body
2.0
CRAP 2.4
« lib/Decl/Semantics/Data.pm ↑ Summary lib/Decl/Semantics/Text.pm »
1 package Decl::Semantics::Template;
2
3 13 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 13 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5
6 13 ▶use base qw(Decl::Node);
Subroutine BEGIN: called CC=1 SCAR=0.0
7
8 =head1 NAME
9
10 Decl::Semantics::Template - implements a template
11
12 =head1 VERSION
13
14 Version 0.02
15
16 =cut
17
18 13 our $VERSION = '0.01';
19
20
21 =head1 SYNOPSIS
22
23 Templates...
24
25 =head2 defines(), tags_defined()
26
27 Called by Decl::Semantics during import, to find out what tags this plugin claims to implement.
28
29 =cut
30
31 0 ▶sub defines { ('template'); }
Subroutine defines: not called CC=1 SCAR=6.9
Pod documented
32 12 ▶sub tags_defined { Decl->new_data(<<EOF); }
Subroutine tags_defined: called CC=1 SCAR=0.0
Pod documented
33 template
34 EOF
35
36 =head2 parse_body
37
38 The template has ambiguous callability. Parse_body probably isn't where to indicate it, though.
39
40 =cut
41
42 0 ▶sub parse_body {
Subroutine parse_body: not called CC=1 SCAR=6.9
Pod documented
43 0 my ($self) = @_;
44 0 $self->{callable} = '?';
45 }
46
47 =head2 go
48
49 When called, Template writes to itself. By default, that propagates up the tree until an output handler is found.
50
51 =cut
52
53 0 ▶sub go {
Subroutine go: not called CC=1 SCAR=6.9
Pod documented
54 0 my ($self) = @_;
55 0 $self->write($self->express);
56 }
57
58 =head2 express
59
60 The C<express> function is where the template is sent to a template engine. If a node is supplied for context, it's
61 used as the value source; otherwise, the template itself is taken as the value source. A hashref can also be passed
62 into the express call as a value source, or an arrayref of different sources to be queried one after the other.
63
64 =cut
65
66 0 ▶sub express {
Subroutine express: not called CC=2 SCAR=17.9
Pod documented
67 0 my ($self, $values) = @_;
68
69 0 ▶ $values = $self unless $values;
Branch: 1 branch
BranchTrueFalseTotal
unless $values 0 0 0
70 0 $Decl::template_engine->express($self->body, $values);
71 }
72
73 =head1 AUTHOR
74
75 Michael Roberts, C<< <michael at vivtek.com> >>
76
77 =head1 BUGS
78
79 Please report any bugs or feature requests to C<bug-decl at rt.cpan.org>, or through
80 the web interface at L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Decl>. I will be notified, and then you'll
81 automatically be notified of progress on your bug as I make changes.
82
83 =head1 LICENSE AND COPYRIGHT
84
85 Copyright 2010 Michael Roberts.
86
87 This program is free software; you can redistribute it and/or modify it
88 under the terms of either: the GNU General Public License as published
89 by the Free Software Foundation; or the Artistic License.
90
91 See http://dev.perl.org/licenses/ for more information.
92
93 =cut
94
95 13 1; # End of Decl::Semantics::Template
« lib/Decl/Semantics/Data.pm ↑ Summary lib/Decl/Semantics/Text.pm »