annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
240
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
1 package IMPL::Web::View::ObjectFactory;
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
2 use strict;
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
3
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
4 our $AUTOLOAD;
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
5
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
6 use IMPL::declare {
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
7 require => {
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
8 Exception => 'IMPL::Exception',
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
9 OpException => '-IMPL::InvalidOperationException'
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
10 },
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
11 base =>[
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
12 'IMPL::Object::Factory' => '@_'
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
13 ]
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
14 };
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
15
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
16 sub AUTOLOAD {
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
17 my $this = shift;
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
18 my ($method) = ($AUTOLOAD =~ m/(\w+)$/);
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
19
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
20 return if $method eq 'DESTROY';
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
21 my $target = $this->factory;
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
22 if ( $target->can($method) ) {
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
23 return $target->$method(@_);
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
24 } else {
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
25 die OpException->new("Method '$method' isn't found in '$target'")
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
26 }
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
27 }
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
28
abc7c26bf615 +Added ObjectFactory for templates with static members support
sergey
parents:
diff changeset
29 1;