comparison Lib/IMPL/Transform.pm @ 198:2ffe6f661605

Implemented IMPL::Web::Handler::RestController fixes in IMPL::Serialization completed IMPL::Web::Application::RestResource added IMPL::Web::Handler::JSONView added IMPL::Web::RestContract
author cin
date Fri, 20 Apr 2012 16:06:36 +0400
parents 6b1dda998839
children e743a8481327
comparison
equal deleted inserted replaced
197:6b1dda998839 198:2ffe6f661605
13 public _direct property plain => PROP_ALL; 13 public _direct property plain => PROP_ALL;
14 private _direct property _cache => PROP_ALL; 14 private _direct property _cache => PROP_ALL;
15 } 15 }
16 16
17 sub CTOR { 17 sub CTOR {
18 my ($this,%args) = @_; 18 my $this = shift;
19 my $args = @_ == 1 ? shift : { @_ };
19 20
20 $this->{$plain} = delete $args{-plain}; 21 $this->{$plain} = delete $args->{-plain};
21 $this->{$default} = delete $args{-default}; 22 $this->{$default} = delete $args->{-default};
22 23
23 $this->{$templates} = \%args; 24 $this->{$templates} = $args;
24 } 25 }
25 26
26 sub Transform { 27 sub Transform {
27 my ($this,$object,@args) = @_; 28 my ($this,$object,@args) = @_;
28 29
57 while (@isa) { 58 while (@isa) {
58 my $sclass = shift @isa; 59 my $sclass = shift @isa;
59 60
60 $t = $this->{$templates}->{$sclass}; 61 $t = $this->{$templates}->{$sclass};
61 62
63 #cache and return
62 return $this->{$_cache}->{$class} = $t if $t; 64 return $this->{$_cache}->{$class} = $t if $t;
63 65
64 push @isa, @{"${sclass}::ISA"}; 66 push @isa, @{"${sclass}::ISA"};
65 } 67 }
66 }; 68 };