| 1 | package Template::Plugin::SafeInclude; | ||||||||||
| 2 | |||||||||||
| 3 | 3 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 3 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 3 | ▶ | use parent qw/Template::Plugin/; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 7 | |||||||||||
| 8 | 3 | our $VERSION = '0.02'; | |||||||||
| 9 | |||||||||||
| 10 | 4 | ▶ | sub new { | ||||||||
|
Subroutine
new: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 11 | 4 | my $class = shift; | |||||||||
| 12 | 4 | my $context = shift; | |||||||||
| 13 | 4 | my $args = shift; | |||||||||
| 14 | |||||||||||
| 15 | 4 | my $self = bless {}, $class; | |||||||||
| 16 | 4 | $self->{_context} = $context; | |||||||||
| 17 | 4 | $self->{_verbose} = $args->{verbose}; | |||||||||
| 18 | |||||||||||
| 19 | 4 | return $self; | |||||||||
| 20 | } | ||||||||||
| 21 | |||||||||||
| 22 | 4 | ▶ | sub inc { | ||||||||
|
Subroutine
inc: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||
| 23 | 4 | my $self = shift; | |||||||||
| 24 | 4 | my $path = shift; | |||||||||
| 25 | 4 | my $param = shift; | |||||||||
| 26 | |||||||||||
| 27 | 4 | my $html = ""; | |||||||||
| 28 | 4 | eval { | |||||||||
| 29 | 4 | $html = $self->{_context}->include($path, $param); | |||||||||
| 30 | }; | ||||||||||
| 31 | 4 | ▶ | unless ($@) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | 2 | return $html; | |||||||||
| 33 | } | ||||||||||
| 34 | 2 | ▶ | if ($self->{_verbose}) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 35 | 1 | my $ret = sprintf "<!-- %s -->", $@; | |||||||||
| 36 | 1 | return $ret; | |||||||||
| 37 | } | ||||||||||
| 38 | } | ||||||||||
| 39 | |||||||||||
| 40 | 3 | 1; # Magic true value required at end of module | |||||||||
| 41 | __END__ | ||||||||||