comparison Lib/IMPL/Web/View/TTView.pm @ 371:d5c8b955bf8d

refactoring
author cin
date Fri, 13 Dec 2013 16:49:47 +0400
parents 833e663796c4
children 6f2a494579cb
comparison
equal deleted inserted replaced
370:cbf4febf0930 371:d5c8b955bf8d
5 use IMPL::lang qw(hashMerge is); 5 use IMPL::lang qw(hashMerge is);
6 use IMPL::Const qw(:prop); 6 use IMPL::Const qw(:prop);
7 use IMPL::declare { 7 use IMPL::declare {
8 require => { 8 require => {
9 Context => 'IMPL::Web::View::TTContext', 9 Context => 'IMPL::Web::View::TTContext',
10 Loader => 'IMPL::Code::Loader' 10 Loader => 'IMPL::Code::Loader',
11 Factory => 'IMPL::Web::View::ObjectFactory'
11 }, 12 },
12 base => [ 13 base => [
13 'IMPL::Object' => undef, 14 'IMPL::Object' => undef,
14 'IMPL::Object::Autofill' => '@_', 15 'IMPL::Object::Autofill' => '@_',
15 'IMPL::Object::Serializable' => undef 16 'IMPL::Object::Serializable' => undef
84 tt_ext => $this->tt_ext, 85 tt_ext => $this->tt_ext,
85 debug => sub { 86 debug => sub {
86 warn @_; 87 warn @_;
87 }, 88 },
88 is => sub { 89 is => sub {
89 return is(shift,shift); 90 my ($obj,$class) = @_;
91 if (is($class,Factory)) {
92 return is($obj,$class->factory);
93 } else {
94 return is($obj,$class);
95 }
90 }, 96 },
91 import => sub { 97 import => sub {
92 return Loader->safe->Require(shift); 98 return Factory->new(Loader->safe->Require(shift));
93 }, 99 },
94 toJSON => sub { 100 toJSON => sub {
95 return JSON->new()->utf8->pretty->encode(shift); 101 return JSON->new()->utf8->pretty->encode(shift);
96 } 102 }
97 } 103 }