Mercurial > pub > Impl
comparison Lib/IMPL/Web/RestContract.pm @ 199:e743a8481327
Added REST support for forms (with only get and post methods)
author | sergey |
---|---|
date | Mon, 23 Apr 2012 01:36:52 +0400 |
parents | 2ffe6f661605 |
children | a9dbe534d236 |
comparison
equal
deleted
inserted
replaced
198:2ffe6f661605 | 199:e743a8481327 |
---|---|
22 $this->templates->{-default} = sub { die ForbiddenException->new(); }; | 22 $this->templates->{-default} = sub { die ForbiddenException->new(); }; |
23 $this->templates->{TRestResource} = sub { $_[0] }; | 23 $this->templates->{TRestResource} = sub { $_[0] }; |
24 } | 24 } |
25 | 25 |
26 sub ProcessTemplate { | 26 sub ProcessTemplate { |
27 my ($this,$t,$obj,@args) = @_; | 27 my ($this,$t,$obj,$props) = @_; |
28 | |
29 $props ||= {}; | |
28 | 30 |
29 if (ref $t eq 'HASH') { | 31 if (ref $t eq 'HASH') { |
30 my $factory = $t->{factory} || TRestResource; | 32 my $factory = $t->{factory} || TRestResource; |
31 return $factory->new(%$t, target => $obj); | 33 return $factory->new(%$t, target => $obj, %$props); |
32 } elsif (ref $t eq 'CODE') { | 34 } elsif (ref $t eq 'CODE') { |
33 return $this->$t($obj,@args); | 35 return $this->$t($obj,$props); |
34 } else { | 36 } else { |
35 die InvalidOpException->new(); | 37 die InvalidOpException->new(); |
36 } | 38 } |
37 } | 39 } |
38 | 40 |