Mercurial > pub > Impl
comparison _test/temp.pl @ 371:d5c8b955bf8d
refactoring
| author | cin |
|---|---|
| date | Fri, 13 Dec 2013 16:49:47 +0400 |
| parents | feeb3bc4a818 |
| children | ced5937ff21a |
comparison
equal
deleted
inserted
replaced
| 370:cbf4febf0930 | 371:d5c8b955bf8d |
|---|---|
| 1 #!/usr/bin/perl | 1 #!/usr/bin/perl |
| 2 use strict; | 2 use strict; |
| 3 | 3 |
| 4 use IMPL::require { | 4 { |
| 5 TTView => 'IMPL::Web::View::TTView' | 5 local $@; |
| 6 }; | 6 eval { |
| 7 | |
| 8 die "oops"; | |
| 9 }; | |
| 10 } | |
| 7 | 11 |
| 8 use Time::HiRes qw(gettimeofday tv_interval); | 12 print $@; |
| 9 | 13 |
| 10 my $t = [gettimeofday]; | |
| 11 | |
| 12 my $view = TTView->new( | |
| 13 options => { | |
| 14 INCLUDE_PATH => './Resources/view', | |
| 15 INTERPOLATE => 1, | |
| 16 RECURSION => 1000, | |
| 17 COMPILE_DIR => '/tmp/ttc' | |
| 18 }, | |
| 19 viewBase => 'site', | |
| 20 layoutBase => 'layout', | |
| 21 layout => 'default', | |
| 22 includes => [ | |
| 23 'packages' | |
| 24 ] | |
| 25 ); | |
| 26 | |
| 27 my $model = { | |
| 28 name => 'debugger', | |
| 29 manufacture => { | |
| 30 name => 'DEBUGGERS INC', | |
| 31 address => [ | |
| 32 { | |
| 33 coutry => 'Russuia', | |
| 34 city => 'Moscow' | |
| 35 }, | |
| 36 { | |
| 37 country => 'GB', | |
| 38 city => 'Essex' | |
| 39 } | |
| 40 ] | |
| 41 } | |
| 42 }; | |
| 43 | |
| 44 print $view->display( | |
| 45 $model, | |
| 46 'product/view' | |
| 47 ), "\n"; | |
| 48 | |
| 49 print "render page: ",tv_interval($t,[gettimeofday]),"s\n"; | |
| 50 | |
| 51 $t = [gettimeofday]; | |
| 52 | |
| 53 $view->display( | |
| 54 $model, | |
| 55 'product/view' | |
| 56 ); | |
| 57 | |
| 58 print "2nd render page: ",tv_interval($t,[gettimeofday]),"s\n"; | |
| 59 |
