Mercurial > pub > Impl
diff Lib/IMPL/Web/QueryHandler/UrlController.pm @ 194:4d0e1962161c
Replaced tabs with spaces
IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author | cin |
---|---|
date | Tue, 10 Apr 2012 20:08:29 +0400 |
parents | d1676be8afcc |
children |
line wrap: on
line diff
--- a/Lib/IMPL/Web/QueryHandler/UrlController.pm Tue Apr 10 08:13:22 2012 +0400 +++ b/Lib/IMPL/Web/QueryHandler/UrlController.pm Tue Apr 10 20:08:29 2012 +0400 @@ -8,41 +8,41 @@ use Scalar::Util qw(tainted); BEGIN { - public property namespace => prop_all; + public property namespace => prop_all; } __PACKAGE__->PassThroughArgs; sub Process { - my ($this,$action,$nextHandler) = @_; - - my $namespace = $this->namespace || $action->application->typeof; - - my @target = grep $_, split /\//, ($ENV{PATH_INFO} || '') or die new IMPL::Exception("No target specified"); - - my $method = pop @target; - if ( $method =~ /^(\w+)/ ) { - $method = $1; - } else { - die new IMPL::Exception("Invalid method name",$method); - } - - (/^(\w+)$/ or die new IMPL::Exception("Invalid module name part", $_)) and $_=$1 foreach @target; - - my $module = join '::',$namespace,@target; - - die new IMPL::Exception("A module name is untrusted", $module) if tainted($module); - - 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); - } else { - die new IMPL::InvalidOperationException("Failed to invoke action",$ENV{PATH_INFO},$module,$method); - } + my ($this,$action,$nextHandler) = @_; + + my $namespace = $this->namespace || $action->application->typeof; + + my @target = grep $_, split /\//, ($ENV{PATH_INFO} || '') or die new IMPL::Exception("No target specified"); + + my $method = pop @target; + if ( $method =~ /^(\w+)/ ) { + $method = $1; + } else { + die new IMPL::Exception("Invalid method name",$method); + } + + (/^(\w+)$/ or die new IMPL::Exception("Invalid module name part", $_)) and $_=$1 foreach @target; + + my $module = join '::',$namespace,@target; + + die new IMPL::Exception("A module name is untrusted", $module) if tainted($module); + + 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); + } else { + die new IMPL::InvalidOperationException("Failed to invoke action",$ENV{PATH_INFO},$module,$method); + } } 1;