comparison Lib/IMPL/Web/QueryHandler/UrlController.pm @ 148:e6447ad85cb4

DOM objects now have a schema and schemaSource properties RegExp now can launder data Improved post to DOM transformation (multiple values a now supported) Added new axes to navigation queries: ancestor and descendant minor changes and bug fixes
author wizard
date Mon, 16 Aug 2010 08:26:44 +0400
parents 5a9f64890c31
children 3f09584bf189
comparison
equal deleted inserted replaced
147:c2aa10fbb396 148:e6447ad85cb4
3 use base qw(IMPL::Web::QueryHandler); 3 use base qw(IMPL::Web::QueryHandler);
4 4
5 use IMPL::Class::Property; 5 use IMPL::Class::Property;
6 use IMPL::Exception; 6 use IMPL::Exception;
7 use Carp qw(croak); 7 use Carp qw(croak);
8 use Scalar::Util qw(tainted);
8 9
9 BEGIN { 10 BEGIN {
10 public property namespace => prop_all; 11 public property namespace => prop_all;
11 } 12 }
12 13
18 my $namespace = $this->namespace || $action->application->type; 19 my $namespace = $this->namespace || $action->application->type;
19 20
20 my @target = grep $_, split /\//, ($ENV{PATH_INFO} || '') or die new IMPL::Exception("No target specified"); 21 my @target = grep $_, split /\//, ($ENV{PATH_INFO} || '') or die new IMPL::Exception("No target specified");
21 22
22 my $method = pop @target; 23 my $method = pop @target;
23 $method =~ s/\.\w+$//; 24 if ( $method =~ /^(\w+)/ ) {
25 $method = $1;
26 } else {
27 die new IMPL::Exception("Invalid method name",$method);
28 }
29
30 (/^(\w+)$/ or die new IMPL::Exception("Invalid module name part", $_)) and $_=$1 foreach @target;
24 31
25 my $module = join '::',$namespace,@target; 32 my $module = join '::',$namespace,@target;
33
34 die new IMPL::Exception("A module name is untrusted", $module) if tainted($module);
26 35
27 eval "require $module; 1;" unless eval{ $module->can('InvokeAction'); }; 36 eval "require $module; 1;" unless eval{ $module->can('InvokeAction'); };
28 if (my $err = $@ ) { 37 if (my $err = $@ ) {
29 die new IMPL::Exception("Failed to load module",$module,$err); 38 die new IMPL::Exception("Failed to load module",$module,$err);
30 } 39 }