in reply to strict refs and package namespaces

I'm not sure why you're putting the work of selecting the template into the autoload. If you pushed the problem down into the "accessor" method, then you'd simply be passing the subroutine name to accessor, and it could chose to return $acc or undef, and for undef you croak. The accessor method could own the hash as a lexical variable to control the mapping.

Also, you're working far too hard to install the $acc as a coderef in the current package. It's much easier to use a glob (warning untested code, but it's close to this):

*{$pkg."::$method"} = eval "sub { $acc }";

-- Randal L. Schwartz, Perl hacker