my $tt = Template->new(
{
INCLUDE_PATH => $BASE_DIR . '/root/src/',
INTERPOLATE => 1,
}
) || die "$Template::ERROR\n";
$tt->process( $email_args{text_template},
####
package Sam::Constants;
use Template;
our $tt = Template->new( # export me
{
INCLUDE_PATH => $BASE_DIR . '/root/src/',
INTERPOLATE => 1,
CONSTANTS => { ... },
VARIABLES => { ... },
}
) || die "$Template::ERROR\n";
##
##
package Sam::Constants;
my @defaults_all = (... );
sub foo { return Template->new( @_ , @defaults_all, DEFAULTS_foo ) };
sub bar { return Template->new( @_ , @defaults_all, DEFAULTS_bar ) };
... # other file
use Sam::Constants qw/foo/;
my $tt = foo(LOCAL_CFG);
$tt->process();