annotate lib/IMPL/Object/Accessor.pm @ 413:af8d359ee4cc ref20150831

working on di container
author cin
date Thu, 24 Sep 2015 12:19:30 +0300
parents c6e90e02dd17
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
1 package IMPL::Object::Accessor;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
2 use strict;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
3
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
4 use parent qw(
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
5 IMPL::Object::Abstract
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
6 Class::Accessor
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
7 );
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
8
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
9 use IMPL::require {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
10 ClassPropertyImplementor => '-IMPL::Code::AccessorPropertyImplementor'
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
11 };
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
12
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
13 require IMPL::Code::AccessorPropertyImplementor;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
14
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
15 sub new {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
16 my $class = shift;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
17 my $self = $class->Class::Accessor::new( @_ == 1 && ref $_[0] && UNIVERSAL::isa($_[0],'HASH') ? $_[0] : ());
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
18 $self->callCTOR(@_);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
19 return $self;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
20 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
21
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
22 sub surrogate {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
23 $_[0]->Class::Accessor::new;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
24 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
25
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
26 1;