If I understand you right, I have a framework that does this for you:
DateTimeX::Format. And, a module for it DateTimeX::Format::Strptime -
it permits you to override all of the environment in runtime, and it
doesn't use a perl-rewrite of strptime, instead it uses the POSIX
binding.
use DateTimeX::Format::Strptime;
my $dtf = DateTimeX::Format::Strptime({ locale => 'en_US',
timezone => 'America/Chicago', pattern => $pattern });
$dtf->parse_datetime( "time" );
$dtf->pattern( $newPattern );
## Call-only pattern won't be cached
$dtf->parse_datetime( "time", { pattern => $pattern } );
$dtf->format_datetime( $dt, $pattern );
Just override the environmnent in the anon hash that is the second
argument to ->parse_datetime, all DateTimeX::Format modules file the
same api (there is no current API for other DateTime::Format modules).
--
Evan Carroll
System Lord of the Internets
http://www.evancarroll.com