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