vokbuz has asked for the wisdom of the Perl Monks concerning the following question:
Hi, monks.
I wrote kinda code reloader for a framework. Before reloading of modified code I want to "unload" already loaded code so I should clean a package. I'm doing it this way:
my $e = \%{ $package . '::' }; %$e = map { $_ => $e->{$_} } grep { /::$/ } keys %$e;
$package is the name of "unloading" package.
It works with current versions of Perl but I'm wonder is there any problem with this code that can potentially break it in future?
Thanks and sorry for my English.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: What is the correct way to clear package?
by ikegami (Patriarch) on May 05, 2011 at 20:15 UTC | |
by vokbuz (Novice) on May 06, 2011 at 07:55 UTC | |
|
Re: What is the correct way to clear package?
by Anonymous Monk on May 06, 2011 at 03:47 UTC | |
by vokbuz (Novice) on May 06, 2011 at 08:00 UTC | |
by LanX (Saint) on May 06, 2011 at 10:02 UTC | |
|
Re: What is the correct way to clear package?
by LanX (Saint) on May 05, 2011 at 18:48 UTC |