comparison lib/IMPL/Config/Descriptor.pm @ 421:7798345304bc ref20150831

working on IMPL::Config, removed old stuff
author cin
date Sun, 16 Jul 2017 22:59:39 +0300
parents df591e3afd10
children b0481c071bea
comparison
equal deleted inserted replaced
420:df591e3afd10 421:7798345304bc
8 sub ACTIVATE_HIERARCHY() { 3 } 8 sub ACTIVATE_HIERARCHY() { 3 }
9 sub ACTIVATE_CONTEXT() { 4 } 9 sub ACTIVATE_CONTEXT() { 4 }
10 sub ACTIVATE_CALL() { 5 } 10 sub ACTIVATE_CALL() { 5 }
11 11
12 my %activateNames = ( 12 my %activateNames = (
13 singleton => ACTIVATE_SINGLETON, 13 singleton => ACTIVATE_SINGLETON,
14 container => ACTIVATE_CONTAINER, 14 container => ACTIVATE_CONTAINER,
15 hierarchy => ACTIVATE_HIERARCHY, 15 hierarchy => ACTIVATE_HIERARCHY,
16 context => ACTIVATE_CONTEXT, 16 context => ACTIVATE_CONTEXT,
17 call => ACTIVATE_CALL 17 call => ACTIVATE_CALL
18 ); 18 );
19 19
20 my %activateNamesLookup = map { $activateNames{$_}, $_ } keys %activateNames; 20 my %activateNamesLookup = reverse %activateNames;
21 21
22 sub Activate { 22 sub Activate {
23 my ( $this, $context ) = @_; 23 my ( $this, $context ) = @_;
24 die IMPL::NotImplementedException->new(); 24 die IMPL::NotImplementedException->new();
25 } 25 }
26 26
27 sub ParseActivation { 27 sub ParseActivation {
28 my $val = pop @_; 28 my $val = pop @_;
29 29
30 return ACTIVATE_CALL unless $val; 30 return ACTIVATE_CALL unless $val;
31 31
32 return grep $_ == $val, 32 return grep( $_ == $val,
33 ACTIVATE_SINGLETON, 33 ACTIVATE_SINGLETON,
34 ACTIVATE_CONTAINER, 34 ACTIVATE_CONTAINER,
35 ACTIVATE_HIERARCHY, 35 ACTIVATE_HIERARCHY,
36 ACTIVATE_CONTEXT, ACTIVATE_CALL ? $val : ACTIVATE_CALL 36 ACTIVATE_CONTEXT, ACTIVATE_CALL ) ? $val : ACTIVATE_CALL
37 if looks_like_number($val); 37 if looks_like_number($val);
38 38
39 return $activateNames{ lc($val) } || ACTIVATE_CALL; 39 return $activateNames{ lc($val) } || ACTIVATE_CALL;
40 } 40 }
41 41
42 sub ActivationToString { 42 sub ActivationToString {
43 my $val = pop @_; 43 my $val = pop @_;
44 44
45 return ( $val && $activateNamesLookup{$val} ) || ''; 45 return ( $val && $activateNamesLookup{$val} ) || '';
46 } 46 }
47 47
48 1; 48 1;
49 49
50 __END__ 50 __END__