comparison Lib/IMPL/Class/Member.pm @ 276:8a5da17d7ef9

*IMPL::Class refactoring property definition mechanism (incomplete).
author sergey
date Thu, 31 Jan 2013 17:37:44 +0400
parents 6253872024a4
children 6585464c4664
comparison
equal deleted inserted replaced
275:6253872024a4 276:8a5da17d7ef9
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(virtual public private protected); 4 our @EXPORT = qw(virtual public private protected);
5 5
6
7 use IMPL::Const qw(:access);
8
6 use IMPL::Class::Meta; 9 use IMPL::Class::Meta;
7 require IMPL::Class::MemberInfo; 10 require IMPL::Class::MemberInfo;
8 11
9 #TODO: remove
10 use constant {
11 MOD_PUBLIC => 1,
12 MOD_PROTECTED => 2,
13 MOD_PRIVATE => 3
14 };
15
16 sub public($) { 12 sub public($) {
17 $_[0]->access(MOD_PUBLIC); 13 my $info = shift;
18 $_[0]->Implement; 14 $info->{access} = ACCESS_PUBLIC;
19 $_[0]; 15 my ($class,$implementor) = delete $info->{'class','-implementor'};
16 $class->$implementor($info);
20 } 17 }
21 18
22 sub private($) { 19 sub private($) {
23 $_[0]->access(MOD_PRIVATE); 20 my $info = shift;
24 $_[0]->Implement; 21 $info->{access} = ACCESS_PRIVATE;
25 $_[0]; 22 my ($class,$implementor) = delete $info->{'class','-implementor'};
23 $class->$implementor($info);
26 } 24 }
27 25
28 sub protected($) { 26 sub protected($) {
29 $_[0]->access(MOD_PROTECTED); 27 my $info = shift;
30 $_[0]->Implement; 28 $info->{access} = ACCESS_PROTECTED;
31 $_[0]; 29 my ($class,$implementor) = delete $info->{'class','-implementor'};
30 $class->$implementor($info);
32 } 31 }
33 1; 32 1;