- my $tt_type = '';
- my $tt_source;
- if (ref($param{template}) eq 'GLOB' or
- ref(\$param{template}) eq 'GLOB') {
- $tt_type = 'FILE_HANDLE';
- $tt_source = $param{template};
- binmode($tt_source,":encoding(UTF-8)");
- }
- elsif (ref($param{template}) eq 'SCALAR') {
- $tt_type = 'STRING';
- $tt_source = ${$param{template}};
- }
- else {
- $tt_type = 'FILE';
- $tt_source = _locate_text($param{template},$param{language});
- }
- if (not defined $tt_source) {
- die "Unable to find template $param{template} with language $param{language}";
- }
-
-# if (defined $param{safe}) {
-# $safe = $param{safe};
-# }
-# else {
-# print STDERR "Created new safe\n" if $DEBUG;
-# $safe = Safe->new() or die "Unable to create safe compartment";
-# $safe->permit_only(':base_core',':base_loop',':base_mem',
-# qw(padsv padav padhv padany),
-# qw(rv2gv refgen srefgen ref),
-# qw(caller require entereval),
-# qw(gmtime time sprintf prtf),
-# qw(sort),
-# );
-# $safe->share('*STDERR');
-# $safe->share('%config');
-# $hole->wrap(\&Debbugs::Text::include,$safe,'&include');
-# my $root = $safe->root();
-# # load variables into the safe
-# for my $key (keys %{$param{variables}||{}}) {
-# print STDERR "Loading $key\n" if $DEBUG;
-# if (ref($param{variables}{$key})) {
-# no strict 'refs';
-# print STDERR $safe->root().'::'.$key,qq(\n) if $DEBUG;
-# *{"${root}::$key"} = $param{variables}{$key};
-# }
-# else {
-# no strict 'refs';
-# ${"${root}::$key"} = $param{variables}{$key};
-# }
-# }
-# for my $key (keys %{exists $param{hole_var}?$param{hole_var}:{}}) {
-# print STDERR "Wraping $key as $param{hole_var}{$key}\n" if $DEBUG;
-# $hole->wrap($param{hole_var}{$key},$safe,$key);
-# }
-# }
- $language = $param{language};