Mercurial > pub > Impl
annotate Lib/IMPL/Object.pm @ 171:59e5fcb59d86
Исправления, изменена концепция веб-форм
| author | sourcer |
|---|---|
| date | Mon, 06 Jun 2011 03:30:36 +0400 |
| parents | 76515373dac0 |
| children | d1676be8afcc |
| rev | line source |
|---|---|
| 49 | 1 package IMPL::Object; |
| 2 use strict; | |
| 3 | |
| 165 | 4 use parent qw(IMPL::Object::Abstract); |
| 49 | 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 |
|
148
e6447ad85cb4
DOM objects now have a schema and schemaSource properties
wizard
parents:
64
diff
changeset
|
28 =head1 SINOPSYS |
| 49 | 29 |
| 64 | 30 =begin code |
| 31 | |
| 49 | 32 package Foo; |
| 165 | 33 use parent qw(IMPL::Object); |
| 49 | 34 |
| 35 sub CTOR { | |
| 36 my ($this,$arg) = @_; | |
| 37 print "Foo: $arg\n"; | |
| 38 } | |
| 39 | |
| 40 package Bar; | |
| 165 | 41 use parent qw(IMPL::Object); |
| 49 | 42 |
| 43 sub CTOR { | |
| 44 my ($this,$arg) = @_; | |
| 45 print "Bar: $arg\n"; | |
| 46 } | |
| 47 | |
| 48 package Baz; | |
| 165 | 49 use parent qw(Foo Bar); |
| 49 | 50 |
| 51 our %CTOR = ( | |
| 52 Foo => sub { my %args = @_; $args{Mazzi}; }, | |
| 53 Bar => sub { my %args = @_; $args{Fugi}; } | |
| 54 ); | |
| 55 | |
| 56 package Composite; | |
| 165 | 57 use parent qw(Baz Foo Bar); |
| 49 | 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 |
| 165 | 107 , C<use parent> , |
| 49 | 108 C<Composite> C<Baz>, C<Foo>, |
| 109 C<Foo> C<Baz>. :) | |
| 110 | |
| 111 =cut |
