comparison Lib/IMPL/Web/Application/ControllerUnit.pm @ 110:c13a215508ca

Refactoring, ControllerUnit
author wizard
date Mon, 17 May 2010 17:42:27 +0400
parents
children 6c25ea91c985
comparison
equal deleted inserted replaced
109:ddf0f037d460 110:c13a215508ca
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 }