"goEbusiness.com Mail Lists" wrote:
>
> Ok, here's the scenarious.
<snip>
> Is there a quick easy way to reset all of those variables for
> each time the script is run? I'm assuming no. I did make a
> function that ran through the package, like so:
<snip>
>From my own bag-o-tricks, this simply obliterates the contents of
the desired package. YMMV.
# Nuke the template's package namespace.
# Based on the inner workings of Safe
#
sub _kill_package {
my $package = shift;
no strict 'refs';
my $pkg = "main::$package\::"; # expand to full symbol table name
my ($stem, $leaf) = $pkg =~ m/(.*::)(\w+::)$/;
my $stem_symtab = *{$stem}{HASH};
if(my $leaf_glob = $stem_symtab->{$leaf}){
my $leaf_symtab = *{$leaf_glob}{HASH};
%$leaf_symtab = ();
return(1);
}
return();
}
-jh