use strict; use warnings; package Sam::Constants; use base 'Exporter'; use constant PRE => 1; use constant REGULAR => 2; use constant POST => 3; our @EXPORT_OK = qw( PRE REGULAR POST ); package main; use Template; my $text = <new( { VARIABLES => { map { $_ => Sam::Constants->$_ } @Sam::Constants::EXPORT_OK }, } ) || die "$Template::ERROR\n"; $tt->process( \$text ) || die $tt->error(), "\n"; #### The constant 'PRE' has the value 1 The constant 'REGULAR' has the value 2 The constant 'POST' has the value 3