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

Refactoring, ControllerUnit
author wizard
date Mon, 17 May 2010 17:42:27 +0400
parents
children 6c25ea91c985
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/Lib/IMPL/Web/Application/ControllerUnit.pm	Mon May 17 17:42:27 2010 +0400
@@ -0,0 +1,30 @@
+package IMPL::Web::Application::ControllerUnit;
+
+use base qw(IMPL::Object);
+
+use IMPL::Class::Property;
+
+BEGIN {
+	public property action => prop_get | owner_set;
+	public property application => prop_get | owner_set;
+	public property query => prop_get | owner_set;
+}
+
+sub CTOR {
+	my ($this,$action) = @_;
+	
+	$this->action($action);
+	$this->application($action->application);
+	$this->query($action->query);
+}
+
+sub InvokeAction {
+	my ($self,$method,$action) = @_;
+	
+	if ($self->can($method)) {
+		my $unit = $self->new($action);
+		$unit->$method();
+	} else {
+		die new IMPL::InvalidOperationException("Invalid method call",$self,$method);
+	}
+}
\ No newline at end of file