comparison lib/IMPL/Config/Descriptor.pm @ 420:df591e3afd10 ref20150831

sync
author cin
date Sat, 25 Feb 2017 22:35:26 +0300
parents 3d24b10dd0d5
children 7798345304bc
comparison
equal deleted inserted replaced
419:bbc4739c4d48 420:df591e3afd10
3 use IMPL::Exception(); 3 use IMPL::Exception();
4 use Scalar::Util qw(looks_like_number); 4 use Scalar::Util qw(looks_like_number);
5 5
6 sub ACTIVATE_SINGLETON() { 1 } 6 sub ACTIVATE_SINGLETON() { 1 }
7 sub ACTIVATE_CONTAINER() { 2 } 7 sub ACTIVATE_CONTAINER() { 2 }
8 sub ACTIVATE_CONTEXT() { 3 } 8 sub ACTIVATE_HIERARCHY() { 3 }
9 sub ACTIVATE_CALL() { 4 } 9 sub ACTIVATE_CONTEXT() { 4 }
10 sub ACTIVATE_CALL() { 5 }
10 11
11 my %activateNames = ( 12 my %activateNames = (
12 singleton => ACTIVATE_SINGLETON, 13 singleton => ACTIVATE_SINGLETON,
13 container => ACTIVATE_CONTAINER, 14 container => ACTIVATE_CONTAINER,
15 hierarchy => ACTIVATE_HIERARCHY,
14 context => ACTIVATE_CONTEXT, 16 context => ACTIVATE_CONTEXT,
15 call => ACTIVATE_CALL 17 call => ACTIVATE_CALL
16 ); 18 );
17 19
18 my %activateNamesLookup = map { $activateNames{$_}, $_ } keys %activateNames; 20 my %activateNamesLookup = map { $activateNames{$_}, $_ } keys %activateNames;
28 return ACTIVATE_CALL unless $val; 30 return ACTIVATE_CALL unless $val;
29 31
30 return grep $_ == $val, 32 return grep $_ == $val,
31 ACTIVATE_SINGLETON, 33 ACTIVATE_SINGLETON,
32 ACTIVATE_CONTAINER, 34 ACTIVATE_CONTAINER,
35 ACTIVATE_HIERARCHY,
33 ACTIVATE_CONTEXT, ACTIVATE_CALL ? $val : ACTIVATE_CALL 36 ACTIVATE_CONTEXT, ACTIVATE_CALL ? $val : ACTIVATE_CALL
34 if looks_like_number($val); 37 if looks_like_number($val);
35 38
36 return $activateNames{ lc($val) } || ACTIVATE_CALL; 39 return $activateNames{ lc($val) } || ACTIVATE_CALL;
37 } 40 }