annotate Lib/IMPL/Object.pm @ 38:d660fb38b7cc

small fixes ORM shema to SQL schema transformation
author Sergey
date Mon, 23 Nov 2009 17:57:07 +0300
parents e59f44f75f20
children 16ada169ca75
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
1 package IMPL::Object;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
2 use strict;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
3
2
78cd38551534 in develop
Sergey
parents: 0
diff changeset
4 use base qw(IMPL::Object::Abstract);
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
5
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
6 sub surrogate {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
7 bless {}, ref $_[0] || $_[0];
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
8 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
9
2
78cd38551534 in develop
Sergey
parents: 0
diff changeset
10 sub new {
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
11 my $class = shift;
2
78cd38551534 in develop
Sergey
parents: 0
diff changeset
12 my $self = bless {}, ref($class) || $class;
78cd38551534 in develop
Sergey
parents: 0
diff changeset
13 $self->callCTOR(@_);
78cd38551534 in develop
Sergey
parents: 0
diff changeset
14
78cd38551534 in develop
Sergey
parents: 0
diff changeset
15 $self;
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
16 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
17
4
e59f44f75f20 DOM - в разработке
Sergey
parents: 2
diff changeset
18 sub _PropertyImplementor {
e59f44f75f20 DOM - в разработке
Sergey
parents: 2
diff changeset
19 'IMPL::Class::Property::Direct'
e59f44f75f20 DOM - в разработке
Sergey
parents: 2
diff changeset
20 }
e59f44f75f20 DOM - в разработке
Sergey
parents: 2
diff changeset
21
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
22 =pod
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
23 =h1 SYNOPSIS
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
24
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
25 package Foo;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
26 use base qw(IMPL::Object);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
27
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
28 sub CTOR {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
29 my ($this,$arg) = @_;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
30 print "Foo: $arg\n";
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
31 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
32
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
33 package Bar;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
34 use base qw(IMPL::Object);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
35
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
36 sub CTOR {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
37 my ($this,$arg) = @_;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
38 print "Bar: $arg\n";
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
39 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
40
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
41 package Baz;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
42 use base qw(Foo Bar);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
43
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
44 our %CTOR = (
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
45 Foo => sub { my %args = @_; $args{Mazzi}; },
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
46 Bar => sub { my %args = @_; $args{Fugi}; }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
47 );
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
48
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
49 package Composite;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
50 use base qw(Baz Foo Bar);
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
51
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
52 our %CTOR = (
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
53 Foo => undef,
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
54 Bar => undef
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
55 );
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
56
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
57 sub CTOR {
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
58 my ($this,%args) = @_;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
59
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
60 print "Composite: $args{Text}\n";
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
61 }
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
62
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
63 package main;
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
64
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
65 my $obj = new Composite(
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
66 Text => 'Hello World!',
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
67 Mazzi => 'Mazzi',
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
68 Fugi => 'Fugi'
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
69 );
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
70
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
71 # will print
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
72 #
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
73 # Foo: Mazzi
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
74 # Bar: Fugi
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
75 # Bar:
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
76 # Composite: Hello World!
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
77
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
78 =h1 Description
2
78cd38551534 in develop
Sergey
parents: 0
diff changeset
79 Áàçîâûé êëàññ äëÿ îáúåêòîâ, îñíîâàííûõ íà õåøå.
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
80
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
81 =h1 Members
2
78cd38551534 in develop
Sergey
parents: 0
diff changeset
82
78cd38551534 in develop
Sergey
parents: 0
diff changeset
83 =level 4
78cd38551534 in develop
Sergey
parents: 0
diff changeset
84
78cd38551534 in develop
Sergey
parents: 0
diff changeset
85 =item operator C<new>(@args)
78cd38551534 in develop
Sergey
parents: 0
diff changeset
86
78cd38551534 in develop
Sergey
parents: 0
diff changeset
87 Ñîçäàåò ýêçåìïëÿð îáúåêòà è âûçûâàåò êîíñòðóêòîð ñ ïàðàìåòðàìè @args.
78cd38551534 in develop
Sergey
parents: 0
diff changeset
88
78cd38551534 in develop
Sergey
parents: 0
diff changeset
89 =item operator C<surrogate>()
78cd38551534 in develop
Sergey
parents: 0
diff changeset
90
78cd38551534 in develop
Sergey
parents: 0
diff changeset
91 Ñîçäàåò íåèíèöèàëèçèðîâàííûé ýêçåìïëÿð îáúåêòà.
78cd38551534 in develop
Sergey
parents: 0
diff changeset
92
78cd38551534 in develop
Sergey
parents: 0
diff changeset
93 =back
78cd38551534 in develop
Sergey
parents: 0
diff changeset
94
78cd38551534 in develop
Sergey
parents: 0
diff changeset
95 =ð1 Cavearts
78cd38551534 in develop
Sergey
parents: 0
diff changeset
96
78cd38551534 in develop
Sergey
parents: 0
diff changeset
97 Íóæíî çàìåòèòü, ÷òî äèðåêòèâà C<use base> ðàáîòàåò íå ñîâñåì ïðîçðà÷íî, åñëè â íàøåì ïðèìåðå
78cd38551534 in develop
Sergey
parents: 0
diff changeset
98 êëàññ C<Composite> íàñëåäóåòñÿ îò C<Baz>, à çàòåì C<Foo>, òî íàñëåäîâàíèå îò
78cd38551534 in develop
Sergey
parents: 0
diff changeset
99 C<Foo> íå ïðîèçîéäåò ïîñêîëüêó îí óæå èìååòñÿ â C<Baz>. Âîò íå çàäà÷à:)
78cd38551534 in develop
Sergey
parents: 0
diff changeset
100
0
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
101 =cut
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
102
03e58a454b20 Создан репозитарий
Sergey
parents:
diff changeset
103 1;