Mercurial > pub > Impl
diff Lib/IMPL/Web/Application/CustomResourceContract.pm @ 331:2ff1726c066c
removed operation contract (due it's useless)
author | cin |
---|---|
date | Wed, 05 Jun 2013 18:21:11 +0400 |
parents | fe725fad2d90 |
children |
line wrap: on
line diff
--- a/Lib/IMPL/Web/Application/CustomResourceContract.pm Tue Jun 04 19:25:54 2013 +0400 +++ b/Lib/IMPL/Web/Application/CustomResourceContract.pm Wed Jun 05 18:21:11 2013 +0400 @@ -4,8 +4,7 @@ use IMPL::Const qw(:prop); use IMPL::declare { require => { - NotAllowedException => 'IMPL::Web::NotAllowedException', - OperationContract => 'IMPL::Web::Application::OperationContract' + NotAllowedException => 'IMPL::Web::NotAllowedException' }, base => [ 'IMPL::Web::Application::ResourceContract' => '@_' @@ -23,21 +22,18 @@ sub CTOR { my ($this) = @_; - $this->verbs->{options} ||= OperationContract->new( binding => \&_HttpOptionsBinding ); + $this->verbs->{options} ||= \&_HttpOptionsBinding; while(my ($verb,$methodName) = each %RESOURCE_BINDINGS) { - $this->verbs->{lc($verb)} ||= OperationContract->new ( - binding => sub { - my ($resource,$action) = @_; - - if (eval { $resource->can($methodName) }) { - return $resource->$methodName($action); - } else { - die NotAllowedException->new(allow => join(',', _GetAllowedHttpMethods($resource))); - } - + $this->verbs->{lc($verb)} ||= sub { + my ($resource,$action) = @_; + + if (eval { $resource->can($methodName) }) { + return $resource->$methodName($action); + } else { + die NotAllowedException->new(allow => join(',', _GetAllowedHttpMethods($resource))); } - ); + } } }