view _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
line wrap: on
line source

#!/usr/bin/perl
use strict;

use IMPL::require {
	TTView => 'IMPL::Web::View::TTView'
};

use Time::HiRes qw(gettimeofday tv_interval);

my $t = [gettimeofday];

my $view = TTView->new(
	options => {
		INCLUDE_PATH => './Resources/view',
		INTERPOLATE => 1,
		RECURSION => 1000,
		COMPILE_DIR => '/tmp/ttc'
	},
	view => 'site',
	layout => 'layout',
	includes => [
		'packages'
	]
);

my $model = {
	name => 'debugger',
	manufacture => {
		name => 'DEBUGGERS INC',
		address => [
			{
				coutry => 'Russuia',
				city => 'Moscow'
			},
			{
				country => 'GB',
				city => 'Essex'
			}
		]
	}
}; 

print $view->display(
	$model,
	'product/view',
	{ layout => 'default' }
), "\n";

print "render page: ",tv_interval($t,[gettimeofday]),"s\n";

$t = [gettimeofday];

$view->display(
	$model,
	'product/view',
	{ layout => 'default' }
);

print "2nd render page: ",tv_interval($t,[gettimeofday]),"s\n";