comparison Lib/IMPL/Config/Activator.pm @ 194:4d0e1962161c

Replaced tabs with spaces IMPL::Web::View - fixed document model, new features (control classes, document constructor parameters)
author cin
date Tue, 10 Apr 2012 20:08:29 +0400
parents d1676be8afcc
children c8fe3f84feba
comparison
equal deleted inserted replaced
193:8e8401c0aea4 194:4d0e1962161c
3 3
4 use parent qw(IMPL::Object IMPL::Object::Autofill IMPL::Object::PublicSerializable); 4 use parent qw(IMPL::Object IMPL::Object::Autofill IMPL::Object::PublicSerializable);
5 use IMPL::Class::Property; 5 use IMPL::Class::Property;
6 6
7 BEGIN { 7 BEGIN {
8 public property factory => prop_all; 8 public property factory => prop_all;
9 public property parameters => prop_all; 9 public property parameters => prop_all;
10 public property object => prop_get | owner_set; 10 public property object => prop_get | owner_set;
11 } 11 }
12 12
13 __PACKAGE__->PassThroughArgs; 13 __PACKAGE__->PassThroughArgs;
14 14
15 sub CTOR { 15 sub CTOR {
30 unless ($this->object) { 30 unless ($this->object) {
31 my @args; 31 my @args;
32 32
33 my $params = $this->parameters; 33 my $params = $this->parameters;
34 if (UNIVERSAL::isa($params,'HASH')) { 34 if (UNIVERSAL::isa($params,'HASH')) {
35 while ( my ($key,$value) = each %$params ) { 35 while ( my ($key,$value) = each %$params ) {
36 push @args,$key, UNIVERSAL::isa($value,'IMPL::Config::Activator') ? $value->activate : $value; 36 push @args,$key, UNIVERSAL::isa($value,'IMPL::Config::Activator') ? $value->activate : $value;
37 } 37 }
38 } elsif (UNIVERSAL::isa($params,'ARRAY')) { 38 } elsif (UNIVERSAL::isa($params,'ARRAY')) {
39 push @args, map UNIVERSAL::isa($_,'IMPL::Config::Activator') ? $_->activate : $_, @$params; 39 push @args, map UNIVERSAL::isa($_,'IMPL::Config::Activator') ? $_->activate : $_, @$params;
40 } else { 40 } else {
41 push @args, UNIVERSAL::isa($params,'IMPL::Config::Activator') ? $params->activate : $params; 41 push @args, UNIVERSAL::isa($params,'IMPL::Config::Activator') ? $params->activate : $params;
42 } 42 }
43 43
44 push @args, map UNIVERSAL::isa($_,'IMPL::Config::Activator') ? $_->activate : $_, @_ if @_; 44 push @args, map UNIVERSAL::isa($_,'IMPL::Config::Activator') ? $_->activate : $_, @_ if @_;
45 45
46 my $factory = $this->factory; 46 my $factory = $this->factory;
47 eval "require $factory; 1;" unless (ref $factory or _is_class($factory)); 47 eval "require $factory; 1;" unless (ref $factory or _is_class($factory));
48 48
49 return $this->object($factory->new(@args)); 49 return $this->object($factory->new(@args));
50 } else { 50 } else {
51 return $this->object; 51 return $this->object;
52 } 52 }
53 } 53 }
54 54
55 1; 55 1;