Mercurial > pub > Impl
comparison Lib/IMPL/Web/View/TTFactory.pm @ 309:5e4e7c8fbca1
sync
author | cin |
---|---|
date | Fri, 19 Apr 2013 00:27:51 +0400 |
parents | b5d5793f348e |
children | 75a78cbf7dcf |
comparison
equal
deleted
inserted
replaced
308:47a09a8dc23a | 309:5e4e7c8fbca1 |
---|---|
16 OpException => '-IMPL::InvalidOperationException', | 16 OpException => '-IMPL::InvalidOperationException', |
17 ArgException => '-IMPL::InvalidArgumentException' | 17 ArgException => '-IMPL::InvalidArgumentException' |
18 }, | 18 }, |
19 base => [ | 19 base => [ |
20 'IMPL::Object::Factory' => sub { | 20 'IMPL::Object::Factory' => sub { |
21 shift->class || 'IMPL::Web::View::TTControl'; | 21 shift; |
22 } | 22 } |
23 ], | 23 ], |
24 props => [ | 24 props => [ |
25 template => PROP_RW, | 25 template => PROP_RW, |
26 context => PROP_RW, | 26 context => PROP_RW, |
32 initialized => PROP_RO | 32 initialized => PROP_RO |
33 ] | 33 ] |
34 }; | 34 }; |
35 | 35 |
36 sub CTOR { | 36 sub CTOR { |
37 my ($this,$template,$context,$path,$registry) = @_; | 37 my ($this,$class,$template,$context,$path,$registry) = @_; |
38 | 38 |
39 die ArgException->new("A control class must be specified") | |
40 unless $class; | |
39 die ArgException->new("A template is required") unless $template; | 41 die ArgException->new("A template is required") unless $template; |
40 | 42 |
41 Loader->safe->Require($this->factory) | 43 Loader->safe->Require($class) |
42 if $this->factory and not ref $this->factory; | 44 unless ref $class ; |
43 | 45 |
44 $context ||= new Template::Context(); | 46 $context ||= new Template::Context(); |
45 my $baseLocation = join( '/', splice( @{[split(/\//,$path)]}, 0, -1 ) ); | 47 my $baseLocation = join( '/', splice( @{[split(/\//,$path)]}, 0, -1 ) ); |
46 | 48 |
47 $this->template($template); | 49 $this->template($template); |