Mercurial > pub > Impl
diff Lib/IMPL/Web/Application/CustomResourceContract.pm @ 230:6d8092d8ce1b
*reworked IMPL::Security
*reworked IMPL::Web::Security
*refactoring
author | sergey |
---|---|
date | Mon, 08 Oct 2012 03:37:37 +0400 |
parents | 47f77e6409f7 |
children | 4abda21186cd |
line wrap: on
line diff
--- a/Lib/IMPL/Web/Application/CustomResourceContract.pm Sat Sep 29 02:34:47 2012 +0400 +++ b/Lib/IMPL/Web/Application/CustomResourceContract.pm Mon Oct 08 03:37:37 2012 +0400 @@ -1,7 +1,7 @@ package IMPL::Web::Application::CustomResourceContract; use strict; -use IMPL::lang qw(:constants); +use IMPL::Const qw(:prop); use IMPL::declare { require => { NotAllowedException => 'IMPL::Web::NotAllowedException', @@ -15,7 +15,7 @@ our %RESOURCE_BINDINGS = ( GET => 'HttpGet', POST => 'HttpPost', - PUT => 'HttpPut' + PUT => 'HttpPut', DELETE => 'HttpDelete', HEAD => 'HttpHead' ); @@ -29,8 +29,8 @@ $this->verbs->{lc($verb)} = OperationContract->new ( binding => sub { my ($resource,$action) = @_; - - if ($resource->can($methodName)) { + + if (eval { $resource->can($methodName) }) { return $resource->$methodName($action); } else { die NotAllowedException->new(allow => join(',', _GetAllowedHttpMethods($resource))); @@ -44,7 +44,7 @@ sub _HttpOptionsBinding { my ($resource) = @_; - my @allow = _GetAllowedHttpMethods; + my @allow = _GetAllowedHttpMethods($resource); retrun HttpResponse->new( status => '200 OK', headers => {