in reply to Re^2: importing/removing functions from a module into the main namespace
in thread importing/removing functions from a module into the main namespace
If you really want to reload a module while running the program, you can do something like this (not 100% foolproof):
use Symbol qw(delete_package); sub re_use { my $module = shift; # "Module::To::Reload" my $fname = $module; $fname =~ s#::#/#g; $fname .= ".pm"; # "Module/To/Reload.pm" delete_package($module); # remove the Module::To::Reload namespace delete $INC{$fname}; # delete the filename from the # "loaded" list eval "use $module" or die $@; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: importing/removing functions from a module into the main namespace
by agaffney (Beadle) on Mar 14, 2005 at 10:38 UTC |