Mercurial > pub > Impl
changeset 56:117b6956d5a5
Web application in progress
author | wizard |
---|---|
date | Thu, 04 Mar 2010 15:46:17 +0300 (2010-03-04) |
parents | 609b59c9f03c |
children | bf59ee1cd506 |
files | Lib/IMPL/Web/Application/Action.pm |
diffstat | 1 files changed, 31 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/Lib/IMPL/Web/Application/Action.pm Wed Mar 03 17:40:18 2010 +0300 +++ b/Lib/IMPL/Web/Application/Action.pm Thu Mar 04 15:46:17 2010 +0300 @@ -26,18 +26,22 @@ sub ChainHandler { my ($this,$handler) = @_; - my $delegate; - my $delegateNext = $this->_entryPoint(); if (ref $handler eq 'CODE') { - $delegate = sub { + $this->_entryPoint( sub { $handler->($this,$delegateNext); - }; + } ); } elsif (UNIVERSAL::isa($handler,'IMPL::Web::Application::QueryHandler')) { - $delegate = sub { + $this->_entryPoint( sub { $handler->Invoke($this,$delegateNext); - } + } ); + } elsif ($handler and not ref $handler) { + my $method = $this->can($handler) or die new IMPL::InvalidArgumentException("An invalid handler supplied"); + + $this->_entryPoint( sub { + $method->($this,$delegateNext); + } ); } else { die new IMPL::InvalidArgumentException("An invalid handler supplied"); } @@ -95,4 +99,25 @@ � ������� ��������� � ���������� JSON ���������������. ����� ������� ������ ������ �� ��������� ����� � �������� �������, ��� ������ ��������� �������������� �������. +=head1 HANDLERS + +=head2 subroutines + +=over + +=item CODE ref + +������ �� ��������� ����� �������� ������������, ��� ���� ������� ����� ������� � +����� �����������: ������� �� action ������, � ������ ����� ���������� �����������. + +=item Method Name + +��� ������, ���������� � ���� ������. � �������� ������� action ������ ����� � +��������� ������, ����� ���� ������������ ������ �� ���� ����� ��� ������ � ����� +�����������: ������� �� action ������, � ������ ����� ���������� �����������. + +���������� ����� ���������� ���������� C<< $action->MethodName($nextHandler) >>; + +=back + =cut \ No newline at end of file