Next Tricks of the Wizards 49

A Templating System

Do the eval in the New Package

        sub my_eval {
          my ($program, $hash) = @_;
          my $pack = new_package();
          package_install($hash => $pack);
          my $result = eval "package $pack; $program";
          return $result;
        }


Next Copyright © 2003 M. J. Dominus