Mercurial > pub > Impl
diff Lib/IMPL/Web/Application/RestBaseResource.pm @ 202:5146e17a7b76
IMPL::Web::Application::RestResource fixes, documentation
author | sergey |
---|---|
date | Wed, 25 Apr 2012 02:49:23 +0400 |
parents | 0c018a247c8a |
children | c8fe3f84feba |
line wrap: on
line diff
--- a/Lib/IMPL/Web/Application/RestBaseResource.pm Tue Apr 24 19:52:07 2012 +0400 +++ b/Lib/IMPL/Web/Application/RestBaseResource.pm Wed Apr 25 02:49:23 2012 +0400 @@ -81,61 +81,6 @@ return undef; } -sub InvokeMember { - my ($this,$method,$action) = @_; - - die ArgumentException->new("method","No method information provided") unless $method; - - #normalize method info - if (not ref $method) { - $method = { - method => $method - }; - } - - if (ref $method eq 'HASH') { - my $member = $method->{method} or die InvalidOpException->new("A member name isn't specified"); - - my @args; - - if (my $params = $method->{parameters}) { - if (ref $params eq 'HASH') { - @args = map { - $_, - $this->MakeParameter($params->{$_},$action) - } keys %$params; - } elsif (ref $params eq 'ARRAY') { - @args = map $this->MakeParameter($_,$action), @$params; - } else { - @args = ($this->MakeParameter($params,$action)); - } - } - return $this->target->$member(@args); - } elsif (ref $method eq TResolve) { - return $method->Invoke($this->target); - } elsif (ref $method eq 'CODE') { - return $method->($this,$action); - } else { - die InvalidOpException->new("Unsupported type of the method information", ref $method); - } -} - -sub MakeParameter { - my ($this,$param,$action) = @_; - - if ($param) { - if (is $param, TTransform ) { - return $param->Transform($this,$action->query); - } elsif ($param and not ref $param) { - return $action->query->param($param); - } else { - die new InvalidOpException->new("Unsupported parameter mapping", $param); - } - } else { - return undef; - } -} - 1;