diff options
author | amacleay <a.macleay@gmail.com> | 2014-01-07 11:52:07 -0500 |
---|---|---|
committer | amacleay <a.macleay@gmail.com> | 2014-01-07 11:52:07 -0500 |
commit | 576c62dbe64c582eb94ad60fd4782ab4b3057bf0 (patch) | |
tree | 4d77353e1c6429487697bfa04fc867865d707aac /lib | |
parent | f0153f9e0aa32910bef579d7956e59d933108261 (diff) | |
download | class-refresh-576c62dbe64c582eb94ad60fd4782ab4b3057bf0.tar.gz class-refresh-576c62dbe64c582eb94ad60fd4782ab4b3057bf0.zip |
Do not die if last require failed
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Class/Refresh.pm | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/Class/Refresh.pm b/lib/Class/Refresh.pm index eb1dda8..320490d 100644 --- a/lib/Class/Refresh.pm +++ b/lib/Class/Refresh.pm @@ -187,11 +187,20 @@ sub load_module { my ($mod) = @_; $mod = $class->_file_to_mod($mod); + my $file = $class->_mod_to_file($mod); + my $last_require_failed = exists $INC{$file} && !defined $INC{$file}; + try { Class::Load::load_class($mod); } catch { - die $_; + if ($last_require_failed) { + # This file failed to load previously. + # Presumably that error has already been caught, so that's fine + } + else { + die $_; + } } finally { $class->_update_cache_for($mod); |