Skip to content

Commit

Permalink
import Module-Reload 1.06 from CPAN
Browse files Browse the repository at this point in the history
git-cpan-module:   Module-Reload
git-cpan-version:  1.06
git-cpan-authorid: JPRIT
git-cpan-file:     authors/id/J/JP/JPRIT/Module-Reload-1.06.tar.gz
  • Loading branch information
jpritikin authored and schwern committed Dec 12, 2009
1 parent 7f6f10f commit f42a7c4
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions Reload.pm
@@ -1,7 +1,7 @@
use strict;
package Module::Reload;
use vars qw($VERSION $Debug %Stat);
$VERSION = "1.05";
$VERSION = "1.06";

sub check {
my $c=0;
Expand All @@ -13,11 +13,17 @@ sub check {
unless defined $Stat{$file};
if ($mtime > $Stat{$file}) {
delete $INC{$key};
require $key;
if ($Debug) {
warn "Module::Reload: process $$ reloading $key\n"
eval {
local $SIG{__WARN__} = \&warn;
require $key;
};
if ($@) {
warn "Module::Reload: error during reload of '$key': $@\n"
}
elsif ($Debug) {
warn "Module::Reload: process $$ reloaded '$key'\n"
if $Debug == 1;
warn("Module::Reload: process $$ reloading $key (\@INC=".
warn("Module::Reload: process $$ reloaded '$key' (\@INC=".
join(', ',@INC).")\n")
if $Debug > 1;
}
Expand Down Expand Up @@ -50,6 +56,14 @@ changed on disk.
Set $Module::Reload::Debug to enable debugging output.
=head1 BUGS
A growing number of pragmas (C<base>, C<fields>, etc.) make the
assumption that they are only loaded once. When you reload the same
file, they tend to show their surprised by not working. If you feel
motivated to submit patches for these problems, I would encourage
that.
=head1 SEE ALSO
mod_perl, Event, ObjStore
Expand Down

0 comments on commit f42a7c4

Please sign in to comment.