Will this work to undefine everything in package Test ?
sub ClearGlobals { my $globalspace = "Test"; foreach (keys %{"${globalspace}::"}) { unless ($_ eq 'dbh') { ## Don't undef the cached database handle! local *symbol = "${globalspace}::${_}"; undef $symbol; undef @symbol; undef %symbol; } } }
This is quite dangerous, as you may undef things you didn't create. (e.g. some 3rd party module may use the same package for its own things). A better approach is to explicitly undef only things that you created. But again, you won't need that when using Singleton, which can contain all the "globals" now as private vars and you can nuke it at once.
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html