comparison Lib/IMPL/Web/View/TTRegistry.pm @ 345:72799d1211c5

sync
author cin
date Fri, 27 Sep 2013 16:28:27 +0400
parents 5e4e7c8fbca1
children
comparison
equal deleted inserted replaced
344:f1d67615a5b1 345:72799d1211c5
7 require => { 7 require => {
8 TTFactory => 'IMPL::Web::View::TTFactory', 8 TTFactory => 'IMPL::Web::View::TTFactory',
9 TTControl => '-IMPL::Web::View::TTControl' 9 TTControl => '-IMPL::Web::View::TTControl'
10 }, 10 },
11 base => [ 11 base => [
12 'IMPL::Object' => undef, 12 'IMPL::Object' => undef
13 'IMPL::Object::Disposable' => undef
14 ], 13 ],
15 props => [ 14 props => [
16 loader => PROP_RW,
17 context => PROP_RW, 15 context => PROP_RW,
18 _cache => PROP_RW, 16 _cache => PROP_RW,
19 ] 17 ]
20 }; 18 };
21 19
22 sub CTOR { 20 sub CTOR {
23 my ($this,$loader,$context) = @_; 21 my ($this,$context) = @_;
24 22
25 $this->loader($loader);
26 $this->context($context); 23 $this->context($context);
27 $this->_cache({}); 24 $this->_cache({});
28 } 25 }
29 26
30 sub Require { 27 sub Require {
37 or die AppException->new("Failed to load a template $name"); 34 or die AppException->new("Failed to load a template $name");
38 35
39 $factory = TTFactory->new( 36 $factory = TTFactory->new(
40 $template->class || TTControl, 37 $template->class || TTControl,
41 $template, 38 $template,
42 $this->context, 39 $this->context->clone,
43 $name, 40 $name,
44 $this 41 $this
45 ); 42 );
46 43
47 $this->_cache->{$name} = $factory; 44 $this->_cache->{$name} = $factory;
48 return $factory; 45 return $factory;
49 } 46 }
50 }
51
52 sub Dispose {
53 my ($this) = @_;
54
55 $this->_cache(undef);
56 $this->context(undef);
57 $this->loader(undef);
58
59 $this->next::method();
60 } 47 }
61 48
62 1; 49 1;
63 50
64 __END__ 51 __END__