diff Lib/IMPL/Web/QueryHandler/UrlController.pm @ 139:5a9f64890c31

Fixed module loading by the UriController
author wizard
date Thu, 01 Jul 2010 17:32:29 +0400
parents c13a215508ca
children e6447ad85cb4
line wrap: on
line diff
--- a/Lib/IMPL/Web/QueryHandler/UrlController.pm	Thu Jul 01 04:25:07 2010 +0400
+++ b/Lib/IMPL/Web/QueryHandler/UrlController.pm	Thu Jul 01 17:32:29 2010 +0400
@@ -4,7 +4,7 @@
 
 use IMPL::Class::Property;
 use IMPL::Exception;
-use Carp;
+use Carp qw(croak);
 
 BEGIN {
 	public property namespace => prop_all;
@@ -24,8 +24,10 @@
 	
 	my $module = join '::',$namespace,@target;
 	
-	eval "require $module; 1;" unless $INC{$module};
-	carp $@ if $@;
+	eval "require $module; 1;" unless eval{ $module->can('InvokeAction'); };
+	if (my $err = $@ ) {
+		die new IMPL::Exception("Failed to load module",$module,$err);
+	}
 	
 	if(UNIVERSAL::can($module,'InvokeAction')) {
 		$module->InvokeAction($method,$action);