annotate lib/IMPL/Class/Member.pm @ 411:ee36115f6a34 ref20150831

sync
author cin
date Mon, 21 Sep 2015 00:53:10 +0300
parents c6e90e02dd17
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
407
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
1 package IMPL::Class::Member;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
2 use strict;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
3 use parent qw(Exporter);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
4 our @EXPORT = qw(&public &private &protected &_direct);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
5
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
6
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
7 use IMPL::Const qw(:access);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
8
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
9 require IMPL::Class::MemberInfo;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
10
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
11 sub public($) {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
12 my $info = shift;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
13 $info->{access} = ACCESS_PUBLIC;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
14 my $implementor = delete $info->{implementor};
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
15 $implementor->Implement($info);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
16 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
17
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
18 sub private($) {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
19 my $info = shift;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
20 $info->{access} = ACCESS_PRIVATE;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
21 my $implementor = delete $info->{implementor};
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
22 $implementor->Implement($info);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
23 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
24
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
25 sub protected($) {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
26 my $info = shift;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
27 $info->{access} = ACCESS_PROTECTED;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
28 my $implementor = delete $info->{implementor};
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
29 $implementor->Implement($info);
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
30 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
31
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
32 sub _direct($) {
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
33 my $info = shift;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
34 $info->{direct} = 1;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
35 return $info;
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
36 }
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
37
c6e90e02dd17 renamed Lib->lib
cin
parents:
diff changeset
38 1;