Mercurial > pub > Impl
comparison _test/Test/Object/Common.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 | 16ada169ca75 |
children | ced5937ff21a |
comparison
equal
deleted
inserted
replaced
164:eb3e9861a761 | 165:76515373dac0 |
---|---|
1 package Test::Object::Common; | 1 package Test::Object::Common; |
2 use strict; | 2 use strict; |
3 use warnings; | 3 use warnings; |
4 | 4 |
5 use base qw( IMPL::Test::Unit ); | 5 use parent qw( IMPL::Test::Unit ); |
6 use IMPL::Test qw(test failed cmparray); | 6 use IMPL::Test qw(test failed cmparray); |
7 | 7 |
8 __PACKAGE__->PassThroughArgs; | 8 __PACKAGE__->PassThroughArgs; |
9 | 9 |
10 { | 10 { |
11 package Foo; | 11 package Foo; |
12 use base qw(IMPL::Object); | 12 use parent qw(IMPL::Object); |
13 | 13 |
14 sub CTOR { | 14 sub CTOR { |
15 my ($this,$refarg) = @_; | 15 my ($this,$refarg) = @_; |
16 $$refarg = 1; | 16 $$refarg = 1; |
17 } | 17 } |
18 | 18 |
19 package Bar; | 19 package Bar; |
20 use base qw(Foo); | 20 use parent qw(-norequire Foo); |
21 | 21 |
22 __PACKAGE__->PassThroughArgs; | 22 __PACKAGE__->PassThroughArgs; |
23 | 23 |
24 sub CTOR { | 24 sub CTOR { |
25 my ($this,$ref,$array) = @_; | 25 my ($this,$ref,$array) = @_; |
26 | 26 |
27 push @$array,__PACKAGE__; | 27 push @$array,__PACKAGE__; |
28 } | 28 } |
29 | 29 |
30 package Baz; | 30 package Baz; |
31 use base qw(Bar); | 31 use parent qw(-norequire Bar); |
32 | 32 |
33 our %CTOR = ( | 33 our %CTOR = ( |
34 Bar => sub { | 34 Bar => sub { |
35 my $t; | 35 my $t; |
36 (\$t,$_[0]); | 36 (\$t,$_[0]); |
41 my ($this,$array) = @_; | 41 my ($this,$array) = @_; |
42 push @$array,__PACKAGE__; | 42 push @$array,__PACKAGE__; |
43 } | 43 } |
44 | 44 |
45 package Zoo; | 45 package Zoo; |
46 use base qw(Bar); | 46 use parent qw(-norequire Bar); |
47 | 47 |
48 __PACKAGE__->PassThroughArgs; | 48 __PACKAGE__->PassThroughArgs; |
49 | 49 |
50 sub CTOR { | 50 sub CTOR { |
51 my ($this,$ref,$array) = @_; | 51 my ($this,$ref,$array) = @_; |
52 | 52 |
53 push @$array,__PACKAGE__; | 53 push @$array,__PACKAGE__; |
54 }; | 54 }; |
55 | 55 |
56 package Complex; | 56 package Complex; |
57 use base qw(Baz Zoo); | 57 use parent qw(-norequire Baz Zoo); |
58 | 58 |
59 our %CTOR = ( | 59 our %CTOR = ( |
60 Baz => sub { @_ }, | 60 Baz => sub { @_ }, |
61 Zoo => sub { | 61 Zoo => sub { |
62 my $t; | 62 my $t; |