AutoReloader
view release on metacpan or search on metacpan
the value at load time, the function is reloaded. If the
reload fails, only the memorized check value is updated, and
the function's previous version is retained. After checking,
a magic 'goto $funcref' is performed - the function is called.
This is most useful for development and for long running
applications that must be updated at runtime, or for those that
wish to extend, grow or shrink packages at runtime.
This package depends on Scalar::Util (XS version), since it
makes use of the weaken and reftype functions therein.
Tested under perl-5.6.2.
INSTALLATION
To install this module type the following:
perl Makefile.PL
make
make test
lib/AutoReloader.pm view on Meta::CPAN
check => \$AL {'check'},
checksub => \$chkfunc,
checkref => \$cr,
function => $subname,
};
my $outer = load ($package, $file, $h) or die $@;
my $outeraddr = Scalar::Util::refaddr ($outer);
$h -> {'outer'} = $outer;
Scalar::Util::weaken ($h -> {'outer'});
$AL{Sub} -> {$outeraddr} = $h;
$AL{Inc} -> {$subname} = $outeraddr;
return bless $outer, __PACKAGE__;
}
};
{
my $load = \&load;
sub load {
my ($package, $file, $h) = @_;
( run in 0.398 second using v1.01-cache-2.11-cpan-65fba6d93b7 )