annotate Lib/IMPL/Object.pm @ 64:259cd3df6e53

Doc generation Minor fixes
author wizard
date Mon, 15 Mar 2010 17:45:13 +0300
parents cf23fd8423f4
children e6447ad85cb4
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
1 package IMPL::Object;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
2 use strict;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
3
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
4 use base qw(IMPL::Object::Abstract);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
5
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
6 sub surrogate {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
7 bless {}, ref $_[0] || $_[0];
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
8 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
9
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
10 sub new {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
11 my $class = shift;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
12 my $self = bless {}, ref($class) || $class;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
13 $self->callCTOR(@_);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
14
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
15 $self;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
16 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
17
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
18 sub _PropertyImplementor {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
19 'IMPL::Class::Property::Direct'
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
20 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
21
53
cf23fd8423f4 minor changes
wizard
parents: 49
diff changeset
22 1;
cf23fd8423f4 minor changes
wizard
parents: 49
diff changeset
23
cf23fd8423f4 minor changes
wizard
parents: 49
diff changeset
24 __END__
cf23fd8423f4 minor changes
wizard
parents: 49
diff changeset
25
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
26 =pod
53
cf23fd8423f4 minor changes
wizard
parents: 49
diff changeset
27
cf23fd8423f4 minor changes
wizard
parents: 49
diff changeset
28 =head1 SYNOPSIS
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
29
64
259cd3df6e53 Doc generation
wizard
parents: 53
diff changeset
30 =begin code
259cd3df6e53 Doc generation
wizard
parents: 53
diff changeset
31
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
32 package Foo;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
33 use base qw(IMPL::Object);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
34
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
35 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
36 my ($this,$arg) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
37 print "Foo: $arg\n";
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
38 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
39
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
40 package Bar;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
41 use base qw(IMPL::Object);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
42
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
43 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
44 my ($this,$arg) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
45 print "Bar: $arg\n";
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
46 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
47
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
48 package Baz;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
49 use base qw(Foo Bar);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
50
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
51 our %CTOR = (
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
52 Foo => sub { my %args = @_; $args{Mazzi}; },
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
53 Bar => sub { my %args = @_; $args{Fugi}; }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
54 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
55
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
56 package Composite;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
57 use base qw(Baz Foo Bar);
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
58
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
59 our %CTOR = (
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
60 Foo => undef,
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
61 Bar => undef
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
62 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
63
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
64 sub CTOR {
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
65 my ($this,%args) = @_;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
66
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
67 print "Composite: $args{Text}\n";
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
68 }
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
69
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
70 package main;
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
71
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
72 my $obj = new Composite(
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
73 Text => 'Hello World!',
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
74 Mazzi => 'Mazzi',
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
75 Fugi => 'Fugi'
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
76 );
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
77
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
78 # will print
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
79 #
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
80 # Foo: Mazzi
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
81 # Bar: Fugi
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
82 # Bar:
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
83 # Composite: Hello World!
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
84
64
259cd3df6e53 Doc generation
wizard
parents: 53
diff changeset
85 =end code
259cd3df6e53 Doc generation
wizard
parents: 53
diff changeset
86
53
cf23fd8423f4 minor changes
wizard
parents: 49
diff changeset
87 =head1 Description
cf23fd8423f4 minor changes
wizard
parents: 49
diff changeset
88
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
89 Базовый класс для объектов, основанных на хеше.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
90
53
cf23fd8423f4 minor changes
wizard
parents: 49
diff changeset
91 =head1 Members
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
92
53
cf23fd8423f4 minor changes
wizard
parents: 49
diff changeset
93 =over
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
94
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
95 =item operator C<new>(@args)
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
96
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
97 Создает экземпляр объекта и вызывает конструктор с параметрами @args.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
98
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
99 =item operator C<surrogate>()
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
100
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
101 Создает неинициализированный экземпляр объекта.
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
102
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
103 =back
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
104
53
cf23fd8423f4 minor changes
wizard
parents: 49
diff changeset
105 =head1 Cavearts
49
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
106
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
107 Нужно заметить, что директива C<use base> работает не совсем прозрачно, если в нашем примере
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
108 класс C<Composite> наследуется от C<Baz>, а затем C<Foo>, то наследование от
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
109 C<Foo> не произойдет поскольку он уже имеется в C<Baz>. Вот не задача:)
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
110
16ada169ca75 migrating to the Eclipse IDE
wizard@linux-odin.local
parents: 4
diff changeset
111 =cut