110
|
1 package IMPL::Web::Application::ControllerUnit;
|
|
2
|
|
3 use base qw(IMPL::Object);
|
|
4
|
|
5 use IMPL::Class::Property;
|
|
6
|
|
7 BEGIN {
|
|
8 public property action => prop_get | owner_set;
|
|
9 public property application => prop_get | owner_set;
|
|
10 public property query => prop_get | owner_set;
|
|
11 }
|
|
12
|
|
13 sub CTOR {
|
|
14 my ($this,$action) = @_;
|
|
15
|
|
16 $this->action($action);
|
|
17 $this->application($action->application);
|
|
18 $this->query($action->query);
|
|
19 }
|
|
20
|
|
21 sub InvokeAction {
|
|
22 my ($self,$method,$action) = @_;
|
|
23
|
|
24 if ($self->can($method)) {
|
|
25 my $unit = $self->new($action);
|
|
26 $unit->$method();
|
|
27 } else {
|
|
28 die new IMPL::InvalidOperationException("Invalid method call",$self,$method);
|
|
29 }
|
|
30 } |