view 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 source

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);
	}
}