comparison Lib/IMPL/Web/TT/Document.pm @ 134:44977efed303

Significant performance optimizations Fixed recursion problems due converting objects to JSON Added cache support for the templates Added discovery feature for the web methods
author wizard
date Mon, 21 Jun 2010 02:39:53 +0400
parents 0dce0470a3d8
children 5b849974bed8
comparison
equal deleted inserted replaced
133:a07a66fd8d5c 134:44977efed303
13 use Carp; 13 use Carp;
14 14
15 BEGIN { 15 BEGIN {
16 private property _provider => prop_all; 16 private property _provider => prop_all;
17 private property _context => prop_all; 17 private property _context => prop_all;
18 public property cache => prop_all;
18 public property template => prop_get | owner_set; 19 public property template => prop_get | owner_set;
19 public property presenter => prop_all, { validate => \&_validatePresenter }; 20 public property presenter => prop_all, { validate => \&_validatePresenter };
20 private property _controlClassMap => prop_all; 21 private property _controlClassMap => prop_all;
21 } 22 }
22 23
23 our %CTOR = ( 24 our %CTOR = (
24 'IMPL::DOM::Document' => sub { nodeName => 'document' } 25 'IMPL::DOM::Document' => sub { nodeName => 'document' }
25 ); 26 );
26 27
27 sub CTOR { 28 sub CTOR {
28 my ($this) = @_; 29 my ($this,%args) = @_;
29 30
30 $this->_controlClassMap({}); 31 $this->_controlClassMap({});
31 $this->registerControlClass( Control => 'IMPL::Web::TT::Control' ); 32 $this->registerControlClass( Control => 'IMPL::Web::TT::Control' );
32 $this->appendChild( $this->Create(body => 'IMPL::Web::TT::Collection') ); 33 $this->appendChild( $this->Create(body => 'IMPL::Web::TT::Collection') );
33 $this->appendChild( $this->Create(head => 'IMPL::Web::TT::Collection') ); 34 $this->appendChild( $this->Create(head => 'IMPL::Web::TT::Collection') );
35 $this->cache($args{cache}) if $args{cache};
34 } 36 }
35 37
36 sub CreateControl { 38 sub CreateControl {
37 my ($this,$name,$class,$args) = @_; 39 my ($this,$name,$class,$args) = @_;
38 40
169 $this->provider( 171 $this->provider(
170 ENCODING => $encoding, 172 ENCODING => $encoding,
171 INTERPOLATE => 1, 173 INTERPOLATE => 1,
172 PRE_CHOMP => 1, 174 PRE_CHOMP => 1,
173 POST_CHOMP => 1, 175 POST_CHOMP => 1,
176 COMPILE_EXT => $this->cache ? '.ttc' : undef,
177 COMPILE_DIR => $this->cache,
174 INCLUDE_PATH => [$inc,@includes] 178 INCLUDE_PATH => [$inc,@includes]
175 ); 179 );
176 180
177 $this->template($this->context->template($fileName)); 181 $this->template($this->context->template($fileName));
178 } 182 }