File: | /tmp/__ttc/ttc_mod/sample___tt.pm |
Coverage: | 77.2% |
line | stmt | bran | cond | sub | pod | time | code |
---|---|---|---|---|---|---|---|
1 | package ttc_mod::sample___tt; | ||||||
2 | sub getDocument { | ||||||
3 | #------------------------------------------------------------------------ | ||||||
4 | # Compiled template generated by the Template Toolkit version 2.19 | ||||||
5 | #------------------------------------------------------------------------ | ||||||
6 | |||||||
7 | Template::Coverable::Document->new({ | ||||||
8 | METADATA => { | ||||||
9 | 'modtime' => '1213679678', | ||||||
10 | 'name' => 'sample.tt', | ||||||
11 | }, | ||||||
12 | BLOCK => sub { | ||||||
13 | 2 | 77 | my $context = shift || die "template sub called without context\n"; | ||||
14 | 2 | 22 | my $stash = $context->stash; | ||||
15 | 2 | 16 | my $output = ''; | ||||
16 | 2 | 14 | my $error; | ||||
17 | |||||||
18 | 2 2 | 14 34 | eval { BLOCK: { | ||||
19 | #line 1 "./sample.tt" | ||||||
20 | 2 | 13 | $output .= $stash->get('title'); | ||||
21 | #line 1 "./sample.tt" | ||||||
22 | 2 | 36 | if ($stash->get('subtitle')) { | ||||
23 | 1 | 17 | $output .= ' - ' . $stash->get('subtitle'); | ||||
24 | } | ||||||
25 | |||||||
26 | 2 | 16 | $output .= "\n~~~~\n"; | ||||
27 | #line 3 "./sample.tt" | ||||||
28 | 2 | 76 | if ($stash->get('verbose') && $stash->get(['rows', 0, 'size', 0]) > 0) { | ||||
29 | 1 | 27 | $output .= $context->process('show_rows'); | ||||
30 | } | ||||||
31 | |||||||
32 | 2 | 18 | $output .= "\n~~~~\n\n"; | ||||
33 | |||||||
34 | 2 | 18 | $output .= "\n"; | ||||
35 | } }; | ||||||
36 | 2 | 20 | if ($@) { | ||||
37 | 0 | 0 | $error = $context->catch($@, \$output); | ||||
38 | 0 | 0 | die $error unless $error->type eq 'return'; | ||||
39 | } | ||||||
40 | |||||||
41 | 2 | 22 | return $output; | ||||
42 | }, | ||||||
43 | DEFBLOCKS => { | ||||||
44 | 'show_rows' => sub { | ||||||
45 | 1 | 13 | my $context = shift || die "template sub called without context\n"; | ||||
46 | 1 | 10 | my $stash = $context->stash; | ||||
47 | 1 | 8 | my $output = ''; | ||||
48 | 1 | 7 | my $error; | ||||
49 | |||||||
50 | 1 1 | 7 8 | eval { BLOCK: { | ||||
51 | 1 | 6 | $output .= "\n "; | ||||
52 | #line 9 "./sample.tt" | ||||||
53 | |||||||
54 | # FOREACH | ||||||
55 | 1 | 7 | do { | ||||
56 | 1 | 9 | my ($value, $error, $oldloop); | ||||
57 | 1 | 15 | my $list = $stash->get('rows'); | ||||
58 | |||||||
59 | 1 | 14 | unless (UNIVERSAL::isa($list, 'Template::Iterator')) { | ||||
60 | 1 | 12 | $list = Template::Config->iterator($list) | ||||
61 | || die $Template::Config::ERROR, "\n"; | ||||||
62 | } | ||||||
63 | |||||||
64 | 1 | 11 | ($value, $error) = $list->get_first(); | ||||
65 | 1 1 | 7 19 | eval { $oldloop = $stash->get('loop') }; | ||||
66 | 1 | 15 | $stash->set('loop', $list); | ||||
67 | 1 | 7 | eval { | ||||
68 | 1 | 11 | LOOP: while (! $error) { | ||||
69 | 3 | 27 | $stash->{'row'} = $value; | ||||
70 | 3 | 23 | $output .= " "; | ||||
71 | #line 8 "./sample.tt" | ||||||
72 | 3 | 72 | $output .= $stash->get(['row', 0, 'x', 0]); | ||||
73 | 3 | 24 | $output .= " / "; | ||||
74 | #line 8 "./sample.tt" | ||||||
75 | 3 | 67 | $output .= $stash->get(['row', 0, 'y', 0]); | ||||
76 | 3 | 25 | $output .= " = "; | ||||
77 | #line 8 "./sample.tt" | ||||||
78 | 3 | 154 | $output .= $stash->get(['row', 0, 'y', 0]) eq 0 ? 'N/A' : ($stash->get(['row', 0, 'x', 0]) / $stash->get(['row', 0, 'y', 0])); | ||||
79 | 3 | 25 | $output .= "\n ";; | ||||
80 | 3 | 71 | ($value, $error) = $list->get_next(); | ||||
81 | } | ||||||
82 | }; | ||||||
83 | 1 | 16 | $stash->set('loop', $oldloop); | ||||
84 | 1 | 10 | die $@ if $@; | ||||
85 | 1 | 22 | $error = 0 if $error && $error eq Template::Constants::STATUS_DONE; | ||||
86 | 1 | 6 | die $error if $error; | ||||
87 | }; | ||||||
88 | |||||||
89 | } }; | ||||||
90 | 1 | 16 | if ($@) { | ||||
91 | 0 | 0 | $error = $context->catch($@, \$output); | ||||
92 | 0 | 0 | die $error unless $error->type eq 'return'; | ||||
93 | } | ||||||
94 | |||||||
95 | 1 | 12 | return $output; | ||||
96 | }, | ||||||
97 | }, | ||||||
98 | 2 | 0 | 70 | }); | |||
99 | }; | ||||||
100 | 1; |