comparison lib/IMPL/Config/ReferenceDescriptor.pm @ 416:cc2cf8c0edc2 ref20150831

sync
author cin
date Thu, 29 Oct 2015 03:50:25 +0300
parents 3d24b10dd0d5
children 3ed0c58e9da3
comparison
equal deleted inserted replaced
415:3d24b10dd0d5 416:cc2cf8c0edc2
20 sub CTOR { 20 sub CTOR {
21 my ( $this, $ref, %opts ) = @_; 21 my ( $this, $ref, %opts ) = @_;
22 22
23 $this->reference($ref) 23 $this->reference($ref)
24 or die IMPL::InvalidArgumentException->new('ref'); 24 or die IMPL::InvalidArgumentException->new('ref');
25
26 $this->lazy( $opts{lazy} ) if $opts{lazy};
27 $this->optional( $opts{optional} ) if $opts{optional};
28 $this->default( $opts{default} )
29 if $opts{optional} and exists $opts{default};
25 30
26 $this->_name( 'ref ' . $ref ); 31 $this->_name( 'ref ' . $ref );
27 } 32 }
28 33
29 sub Activate { 34 sub Activate {
48 53
49 $this->LeaveScope(); 54 $this->LeaveScope();
50 } 55 }
51 56
52 1; 57 1;
58
59 __END__
60
61 =pod
62
63 =head1 NAME
64
65 C<IMPL::Config::ReferenceDescriptor> - A descriptor which is points to the other service
66
67 =head1 MEMBERS
68
69 =head2 PROPS
70
71 =head3 reference
72
73 =head3 lazy
74
75 =head3 optional
76
77 =head3 default
78
79 =head2 METHODS
80
81 =head3 CTOR($ref, %opts)
82
83 =head3 Activate($context)
84
85 Returns a result of the activation of the service specified by the C<reference> property.
86
87 If the reference is lazy the method returns a closure.The C<$context> will be cloned and the clone will be used to create the closure.
88 =cut