annotate Lib/IMPL/Web/QueryHandler/SecureCall.pm @ 98:00d88c5e8203

minor changes
author wizard
date Wed, 05 May 2010 01:07:31 +0400
parents 964587c5183c
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
97
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
1 package IMPL::Web::QueryHandler::SecureCall;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
2 use strict;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
3 use base qw(IMPL::Web::QueryHandler);
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
4
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
5 use IMPL::Class::Property;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
6 use IMPL::Exception;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
7 use Carp;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
8
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
9 BEGIN {
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
10 public property namespace => prop_all;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
11 }
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
12
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
13 __PACKAGE__->PassThroughArgs;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
14
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
15 sub Process {
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
16 my ($this,$action,$nextHandler) = @_;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
17
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
18 my $namespace = $this->namespace || $action->application->type;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
19
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
20 my @target = grep $_, split /\//, ($ENV{PATH_INFO} || '') or die new IMPL::Exception("No target specified");
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
21
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
22 my $method = pop @target;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
23 $method =~ s/\.\w+$//;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
24
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
25 my $module = join '::',$namespace,@target;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
26
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
27 eval "require $module; 1;";
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
28 carp $@ if $@;
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
29
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
30 if(UNIVERSAL::can($module,'InvokeAction')) {
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
31 $module->InvokeAction($method,$action);
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
32 } else {
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
33 die new IMPL::InvalidOperationException("Failed to invoke action",$ENV{PATH_INFO},$module,$method);
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
34 }
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
35 }
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
36
964587c5183c Added SecureCall to Web QueryHandlers stack
wizard
parents:
diff changeset
37 1;