in reply to Using the filter option of HTML::Template
The docs for HTML::Template states that "This subroutine will receive a single argument - a reference to a string containing the template file text." for the coderef you create for the filter param.
So it looks like you're simply failing to use the scalar reference passed in, and essentially localizing the $textref var instead.
Try changing:
my $magic = sub { my $textref = shift; $textref =~ s/!!!blargle!!!/<tmpl_include $policy_file>/g; };
To:
my $magic = sub { my $textref = shift; # note the extra $ on the $textref var $$textref =~ s/!!!blargle!!!/<tmpl_include $policy_file>/g; };
|
|---|