Mercurial > pub > Impl
comparison Lib/IMPL/Web/View/ObjectFactory.pm @ 240:abc7c26bf615
+Added ObjectFactory for templates with static members support
*fixed web-resource model errors
author | sergey |
---|---|
date | Wed, 17 Oct 2012 17:41:29 +0400 |
parents | |
children | 7c517134c42f |
comparison
equal
deleted
inserted
replaced
239:23daf2fae33a | 240:abc7c26bf615 |
---|---|
1 package IMPL::Web::View::ObjectFactory; | |
2 use strict; | |
3 | |
4 our $AUTOLOAD; | |
5 | |
6 use IMPL::declare { | |
7 require => { | |
8 Exception => 'IMPL::Exception', | |
9 OpException => '-IMPL::InvalidOperationException' | |
10 }, | |
11 base =>[ | |
12 'IMPL::Object::Factory' => '@_' | |
13 ] | |
14 }; | |
15 | |
16 sub AUTOLOAD { | |
17 my $this = shift; | |
18 my ($method) = ($AUTOLOAD =~ m/(\w+)$/); | |
19 | |
20 return if $method eq 'DESTROY'; | |
21 my $target = $this->factory; | |
22 if ( $target->can($method) ) { | |
23 return $target->$method(@_); | |
24 } else { | |
25 die OpException->new("Method '$method' isn't found in '$target'") | |
26 } | |
27 } | |
28 | |
29 1; |