CPAN::Forum
Text-Template - option to use safe compartment by default
| Posted on Fri Jul 25 22:56:28 2008 by schnix |
| option to use safe compartment by default |
|
hi,
i'd like to ask if you want to implement a module-option like
$Text::Template::Safe = $Compartment;
i have a lot of Text-Template objects and with it a lot of fill_in calls.
actually i use the same compartment every time, but it looks crappy to put it always into the fill_in...
if set, every fill_in should use that compartment by default.
(it would even help, if the safe option is available inside the object constructor)
2nd wish:
i usually put the result of a mysql fetch_hashref into the fill_in-HASH option.
but sometimes i get information from the queries, that i do not want to hand out to the templates.
otherwise i need them in perl to create key-values i cannot get from mysql, but needed in the template...
so i have a function
sub _restrict_T_Vars {
my ( $h_ref, $a_ref ) = @_;
# needs to be defined first, to use slices
my %H;
# throw away hash-elements that keys are not in $a_ref
@H{ @{ $a_ref } } = @$h_ref{ @{ $a_ref } };
return \%H;
}
which i use for that cases. it would be nice if you implement it in the text-template and allow another option in fill_in like
HASH_KEYS => []
, that calls this function first...
just some thoughts,
thanks for the module :)
schnix
|
| Write a response |
(3)
]