Mercurial > pub > Impl
comparison Lib/IMPL/Class/Member.pm @ 278:4ddb27ff4a0b
core refactoring
author | cin |
---|---|
date | Mon, 04 Feb 2013 02:10:37 +0400 |
parents | 6585464c4664 |
children |
comparison
equal
deleted
inserted
replaced
277:6585464c4664 | 278:4ddb27ff4a0b |
---|---|
1 package IMPL::Class::Member; | 1 package IMPL::Class::Member; |
2 use strict; | 2 use strict; |
3 use parent qw(Exporter); | 3 use parent qw(Exporter); |
4 our @EXPORT = qw(&public &private &protected); | 4 our @EXPORT = qw(&public &private &protected &_direct); |
5 | 5 |
6 | 6 |
7 use IMPL::Const qw(:access); | 7 use IMPL::Const qw(:access); |
8 | 8 |
9 require IMPL::Class::MemberInfo; | 9 require IMPL::Class::MemberInfo; |
10 | 10 |
11 sub public($) { | 11 sub public($) { |
12 my $info = shift; | 12 my $info = shift; |
13 $info->{access} = ACCESS_PUBLIC; | 13 $info->{access} = ACCESS_PUBLIC; |
14 my ($class,$implementor) = delete $info->{'class','-implementor'}; | 14 my $implementor = delete $info->{implementor}; |
15 $class->$implementor($info); | 15 $implementor->Implement($info); |
16 } | 16 } |
17 | 17 |
18 sub private($) { | 18 sub private($) { |
19 my $info = shift; | 19 my $info = shift; |
20 $info->{access} = ACCESS_PRIVATE; | 20 $info->{access} = ACCESS_PRIVATE; |
21 my ($class,$implementor) = delete $info->{'class','-implementor'}; | 21 my $implementor = delete $info->{implementor}; |
22 $class->$implementor($info); | 22 $implementor->Implement($info); |
23 } | 23 } |
24 | 24 |
25 sub protected($) { | 25 sub protected($) { |
26 my $info = shift; | 26 my $info = shift; |
27 $info->{access} = ACCESS_PROTECTED; | 27 $info->{access} = ACCESS_PROTECTED; |
28 my ($class,$implementor) = delete $info->{'class','-implementor'}; | 28 my $implementor = delete $info->{implementor}; |
29 $class->$implementor($info); | 29 $implementor->Implement($info); |
30 } | |
31 | |
32 sub _direct($) { | |
33 my $info = shift; | |
34 $info->{direct} = 1; | |
35 return $info; | |
30 } | 36 } |
31 | 37 |
32 1; | 38 1; |