comparison Lib/IMPL/Class/Meta.pm @ 165:76515373dac0

Added Class::Template, Rewritten SQL::Schema 'use parent' directive instead of 'use base'
author wizard
date Sat, 23 Apr 2011 23:06:48 +0400
parents eb3e9861a761
children 59e5fcb59d86
comparison
equal deleted inserted replaced
164:eb3e9861a761 165:76515373dac0
105 105
106 =begin code 106 =begin code
107 107
108 package InfoMeta; 108 package InfoMeta;
109 109
110 use base qw(IMPL::Object IMPL::Object::Autofill); 110 use parent qw(IMPL::Object IMPL::Object::Autofill);
111 use IMPL::Class::Property; 111 use IMPL::Class::Property;
112 112
113 __PACKAGE__->PassThroughArgs; 113 __PACKAGE__->PassThroughArgs;
114 114
115 BEGIN { 115 BEGIN {
116 public property name => prop_get | owner_set; 116 public property name => prop_get | owner_set;
117 } 117 }
118 118
119 package InfoExMeta; 119 package InfoExMeta;
120 use base qw(InfoMeta); 120 use parent qw(InfoMeta);
121 121
122 __PACKAGE__->PassThroughArgs; 122 __PACKAGE__->PassThroughArgs;
123 123
124 BEGIN { 124 BEGIN {
125 public property description => prop_all; 125 public property description => prop_all;
213 которые могут быть изменены или заменены субклассами. 213 которые могут быть изменены или заменены субклассами.
214 214
215 =begin code 215 =begin code
216 216
217 package Foo; 217 package Foo;
218 use base qw(IMPL::Class::Meta); 218 use parent qw(IMPL::Class::Meta);
219 219
220 __PACKAGE__->class_data( info => { version => 1 } ); # will be default for all subclasses 220 __PACKAGE__->class_data( info => { version => 1 } ); # will be default for all subclasses
221 221
222 sub say_version { 222 sub say_version {
223 my ($self) = @_; 223 my ($self) = @_;
224 224
225 print $self->class_data('info')->{version}; 225 print $self->class_data('info')->{version};
226 } 226 }
227 227
228 package Bar; 228 package Bar;
229 use base qw(Foo); 229 use parent qw(Foo);
230 230
231 __PACKAGE__->class_data('info')->{ language } = 'English'; 231 __PACKAGE__->class_data('info')->{ language } = 'English';
232 232
233 package main; 233 package main;
234 234
247 изменение которых не коснется ни базового класса, ни соседей. 247 изменение которых не коснется ни базового класса, ни соседей.
248 248
249 =begin code 249 =begin code
250 250
251 package Foo; 251 package Foo;
252 use base qw(IMPL::Class::Meta); 252 use parent qw(IMPL::Class::Meta);
253 253
254 __PACKAGE__->static_accessor( info => { version => 1 } ); 254 __PACKAGE__->static_accessor( info => { version => 1 } );
255 255
256 package Bar; 256 package Bar;
257 use base qw(Foo); 257 use parent qw(Foo);
258 258
259 __PACKAGE__->info->{language} = 'English'; # Foo->info->{language} will become 'English' to!!! 259 __PACKAGE__->info->{language} = 'English'; # Foo->info->{language} will become 'English' to!!!
260 __PACKAGE__->info({language => 'English'}); # will define own 'info' but will loose original data. 260 __PACKAGE__->info({language => 'English'}); # will define own 'info' but will loose original data.
261 261
262 =end code 262 =end code