49
+ − 1 package IMPL::Object;
+ − 2 use strict;
+ − 3
+ − 4 use base qw(IMPL::Object::Abstract);
+ − 5
+ − 6 sub surrogate {
+ − 7 bless {}, ref $_[0] || $_[0];
+ − 8 }
+ − 9
+ − 10 sub new {
+ − 11 my $class = shift;
+ − 12 my $self = bless {}, ref($class) || $class;
+ − 13 $self->callCTOR(@_);
+ − 14
+ − 15 $self;
+ − 16 }
+ − 17
+ − 18 sub _PropertyImplementor {
+ − 19 'IMPL::Class::Property::Direct'
+ − 20 }
+ − 21
53
+ − 22 1;
+ − 23
+ − 24 __END__
+ − 25
49
+ − 26 =pod
53
+ − 27
+ − 28 =head1 SYNOPSIS
49
+ − 29
64
+ − 30 =begin code
+ − 31
49
+ − 32 package Foo;
+ − 33 use base qw(IMPL::Object);
+ − 34
+ − 35 sub CTOR {
+ − 36 my ($this,$arg) = @_;
+ − 37 print "Foo: $arg\n";
+ − 38 }
+ − 39
+ − 40 package Bar;
+ − 41 use base qw(IMPL::Object);
+ − 42
+ − 43 sub CTOR {
+ − 44 my ($this,$arg) = @_;
+ − 45 print "Bar: $arg\n";
+ − 46 }
+ − 47
+ − 48 package Baz;
+ − 49 use base qw(Foo Bar);
+ − 50
+ − 51 our %CTOR = (
+ − 52 Foo => sub { my %args = @_; $args{Mazzi}; },
+ − 53 Bar => sub { my %args = @_; $args{Fugi}; }
+ − 54 );
+ − 55
+ − 56 package Composite;
+ − 57 use base qw(Baz Foo Bar);
+ − 58
+ − 59 our %CTOR = (
+ − 60 Foo => undef,
+ − 61 Bar => undef
+ − 62 );
+ − 63
+ − 64 sub CTOR {
+ − 65 my ($this,%args) = @_;
+ − 66
+ − 67 print "Composite: $args{Text}\n";
+ − 68 }
+ − 69
+ − 70 package main;
+ − 71
+ − 72 my $obj = new Composite(
+ − 73 Text => 'Hello World!',
+ − 74 Mazzi => 'Mazzi',
+ − 75 Fugi => 'Fugi'
+ − 76 );
+ − 77
+ − 78 # will print
+ − 79 #
+ − 80 # Foo: Mazzi
+ − 81 # Bar: Fugi
+ − 82 # Bar:
+ − 83 # Composite: Hello World!
+ − 84
64
+ − 85 =end code
+ − 86
53
+ − 87 =head1 Description
+ − 88
49
+ − 89 ������� ����� ��� ��������, ���������� �� ����.
+ − 90
53
+ − 91 =head1 Members
49
+ − 92
53
+ − 93 =over
49
+ − 94
+ − 95 =item operator C<new>(@args)
+ − 96
+ − 97 ������� ��������� ������� � �������� ����������� � ����������� @args.
+ − 98
+ − 99 =item operator C<surrogate>()
+ − 100
+ − 101 ������� �������������������� ��������� �������.
+ − 102
+ − 103 =back
+ − 104
53
+ − 105 =head1 Cavearts
49
+ − 106
+ − 107 ����� ��������, ��� ��������� C<use base> �������� �� ������ ���������, ���� � ����� �������
+ − 108 ����� C<Composite> ����������� �� C<Baz>, � ����� C<Foo>, �� ������������ ��
+ − 109 C<Foo> �� ���������� ��������� �� ��� ������� � C<Baz>. ��� �� ������:)
+ − 110
+ − 111 =cut