comparison _test/temp.pl @ 348:f116cd9fe7d9

working on TTView: pre-alpha version
author cin
date Thu, 03 Oct 2013 19:48:57 +0400
parents 8d36073411b1
children 86b470004d47
comparison
equal deleted inserted replaced
347:3eafa6fefa9f 348:f116cd9fe7d9
1 #!/usr/bin/perl 1 #!/usr/bin/perl
2 use strict; 2 use strict;
3 3
4 {
5 package Foo;
6 use IMPL::declare {
7 base => [
8 'IMPL::Object::Disposable' => undef
9 ]
10 };
11 }
12
13 use Time::HiRes qw(gettimeofday tv_interval);
14
15
16 use IMPL::lang;
17 use IMPL::require { 4 use IMPL::require {
18 AutoDispose => 'IMPL::Object::AutoDispose', 5 TTContext => 'IMPL::Web::View::TTContext'
19 DBSchema => 'IMPL::SQL::Schema'
20 }; 6 };
21 7
22 my $real = DBSchema->new( name => 'simple', version => 1); 8 my $ctx = TTContext->new({
23 my $proxy = AutoDispose->new($real); 9 INCLUDE_PATH => './Resources/view',
10 INTERPOLATE => 1,
11 RECURSION => 1000
12 });
24 13
25 print typeof($proxy),"\n"; 14 warn $ctx->load_templates->[0]->include_path->[0];
26 15
27 my $t = [gettimeofday]; 16 print $ctx->invoke_environment(sub {
28 17 return shift->render(
29 for (1..1000000) { 18 'product/view',{
30 $proxy->name; 19 model => {
31 } 20 name => 'debugger',
32 21 manufature => {
33 print "proxy: ",tv_interval($t,[gettimeofday]),"\n"; 22 name => 'DEBUGGERS INC',
34 23 address => [
35 $t = [gettimeofday]; 24 {
36 25 coutry => 'Russuia',
37 for (1..1000000) { 26 city => 'Moscow'
38 $real->name; 27 },
39 } 28 {
40 29 country => 'GB',
41 print "real: ",tv_interval($t,[gettimeofday]),"\n"; 30 city => 'Essex'
31 }
32 ]
33 }
34 }
35 }
36 );
37 }, {
38 base => 'site',
39 includes => [
40 'packages'
41 ],
42 tt_ext => 'tt'
43 });
42 44