comparison _test/temp.pl @ 427:09e0086a82a7 ref20150831 tip

Merge
author cin
date Tue, 15 May 2018 00:51:33 +0300
parents eed50c01e758 c27434cdd611
children
comparison
equal deleted inserted replaced
426:eed50c01e758 427:09e0086a82a7
6 use Scalar::Util qw(blessed refaddr); 6 use Scalar::Util qw(blessed refaddr);
7 use YAML::XS qw(Dump Load); 7 use YAML::XS qw(Dump Load);
8 use Data::Dumper; 8 use Data::Dumper;
9 use URI; 9 use URI;
10 10
11 package Bar;
12 use base qw(IMPL::Object);
13
14 sub CTOR {
15 }
16
17 package Bar2;
18 use base qw(Bar);
19
20 sub CTOR {
21 }
22
23 package Foo; 11 package Foo;
24 use base qw(IMPL::Object::_Base); 12 use base qw(IMPL::Object::_Base);
25 13
26 sub new { 14 sub new {
27 my $instance = bless {}, shift; 15 my $instance = bless {}, shift;
28 $instance->__construct(); 16 $instance->__construct(@_);
29 return $instance; 17 return $instance;
30 } 18 }
31 19
32 sub CTOR { 20 sub CTOR {
21 say "Foo @_";
33 } 22 }
34 23
35 package Foo2; 24 package Foo2;
36 use base qw(Foo); 25 use base qw(Foo);
37 26
38 sub CTOR { 27 sub CTOR {
39 28 say "Foo2 @_";
40 } 29 }
30
31 package Bar;
32
33 sub CTOR {
34 say "Bar";
35 }
36
37 package Baz;
38 use base qw(Foo2 Bar);
39
40 sub CTOR {
41 say "Baz";
42 }
43
44
41 45
42 package main; 46 package main;
43 47
44 my $t = [gettimeofday]; 48 my $t = [gettimeofday];
45 49
46 for(my $i=0; $i <1000000; $i++) { 50 new Baz("-hi!");
47 my $v = new Foo2;
48 }
49 51
50 say tv_interval($t); 52 say tv_interval($t);
51 53
52 1; 54 1;