From 442851e3eb7e0bc3110fdcf4c0ebd8b24ae7d863 Mon Sep 17 00:00:00 2001 From: Mark Harrison <mark@omniti.com> Date: Mon, 16 Jun 2008 14:55:45 +0000 Subject: [PATCH] Fix a problem reloading modules included from a different dir specified by the LIB config option. git-svn-id: https://labs.omniti.com/resmon/trunk@125 8c0face9-b7db-6ec6-c4b3-d5f7145c7d55 --- lib/Resmon/Module.pm | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/Resmon/Module.pm b/lib/Resmon/Module.pm index 98d2753..cd57233 100755 --- a/lib/Resmon/Module.pm +++ b/lib/Resmon/Module.pm @@ -80,6 +80,12 @@ sub reload_module { my $class = ref($self) || $self; $class =~ s/::/\//g; my $file = $INC{"$class.pm"}; + # Deal with modules loaded from a LIB directory and not in + # lib/Resmon/Module: try MODNAME.pm instead of Resmon/Module/MODNAME.pm + unless ($file) { + $class =~ s/^.*\/([^\/]+)$/\1/; + $file = $INC{"$class.pm"}; + } print STDERR "Reloading module: $class\n"; # my $fh = FileHandle->new($file); # local($/); -- GitLab