Mercurial > pub > Impl
annotate _test/temp.pl @ 352:675cd1829255
working on TTView: added control classes support
| author | cin |
|---|---|
| date | Thu, 10 Oct 2013 19:51:19 +0400 |
| parents | cfd7570c2af2 |
| children | feeb3bc4a818 |
| rev | line source |
|---|---|
| 210 | 1 #!/usr/bin/perl |
| 2 use strict; | |
| 3 | |
| 274 | 4 use IMPL::require { |
|
351
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
5 TTView => 'IMPL::Web::View::TTView' |
| 274 | 6 }; |
| 7 | |
|
351
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
8 use Time::HiRes qw(gettimeofday tv_interval); |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
9 |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
10 my $t = [gettimeofday]; |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
11 |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
12 my $view = TTView->new( |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
13 options => { |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
14 INCLUDE_PATH => './Resources/view', |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
15 INTERPOLATE => 1, |
| 352 | 16 RECURSION => 1000, |
| 17 COMPILE_DIR => '/tmp/ttc' | |
|
351
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
18 }, |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
19 view => 'site', |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
20 layout => 'layout', |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
21 includes => [ |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
22 'packages' |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
23 ] |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
24 ); |
| 210 | 25 |
| 352 | 26 my $model = { |
| 27 name => 'debugger', | |
| 28 manufacture => { | |
| 29 name => 'DEBUGGERS INC', | |
| 30 address => [ | |
| 31 { | |
| 32 coutry => 'Russuia', | |
| 33 city => 'Moscow' | |
| 34 }, | |
| 35 { | |
| 36 country => 'GB', | |
| 37 city => 'Essex' | |
| 38 } | |
| 39 ] | |
| 40 } | |
| 41 }; | |
| 42 | |
|
351
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
43 print $view->display( |
| 352 | 44 $model, |
|
351
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
45 'product/view', |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
46 { layout => 'default' } |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
47 ), "\n"; |
|
cfd7570c2af2
working on TTView: created TTView class for rendering models
cin
parents:
350
diff
changeset
|
48 |
| 352 | 49 print "render page: ",tv_interval($t,[gettimeofday]),"s\n"; |
| 50 | |
| 51 $t = [gettimeofday]; | |
| 52 | |
| 53 $view->display( | |
| 54 $model, | |
| 55 'product/view', | |
| 56 { layout => 'default' } | |
| 57 ); | |
| 58 | |
| 59 print "2nd render page: ",tv_interval($t,[gettimeofday]),"s\n"; | |
| 60 |
