annotate Lib/IMPL/Class/MemberInfo.pm @ 8:fffb153be599

DOM Schema
author Sergey
date Tue, 25 Aug 2009 17:36:37 +0400
parents 03e58a454b20
children 16ada169ca75
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
1 package IMPL::Class::MemberInfo;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
2 use strict;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
3 use base qw(IMPL::Object::Accessor);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
4
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
5 require IMPL::Exception;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
6 require IMPL::Class::Member;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
7
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
8 __PACKAGE__->mk_accessors(
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
9 qw(
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
10 Name
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
11 Access
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
12 Virtual
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
13 Class
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
14 Frozen
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
15 Implementor
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
16 Attributes
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
17 )
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
18 );
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
19 __PACKAGE__->PassThroughArgs;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
20
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
21 sub CTOR {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
22 my $this = shift;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
23
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
24 die new IMPL::Exception('The name is required for the member') unless $this->Name;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
25 die new IMPL::Exception('The class is required for the member') unless $this->Class;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
26
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
27 $this->Frozen(0);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
28 $this->Virtual(0) unless defined $this->Virtual;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
29 $this->Access(3) unless $this->Access;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
30 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
31
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
32 sub Implement {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
33 my ($this) = @_;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
34 $this->Implementor->Make($this);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
35 $this->Frozen(1);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
36 $this->Class->set_meta($this);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
37 return;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
38 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
39
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
40 sub set {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
41 my $this = shift;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
42 if ($this->Frozen) {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
43 die new IMPL::Exception('The member information can\'t be modified', $this->Name);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
44 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
45 $this->SUPER::set(@_);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
46 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
47
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
48 1;