comparison Lib/IMPL/Web/View/TTDocument.pm @ 188:029c9610528c

Memory leak tests in IMPL::Web::View
author cin
date Tue, 03 Apr 2012 20:08:42 +0400
parents 927653d01f4f
children 08015e2803f1
comparison
equal deleted inserted replaced
187:927653d01f4f 188:029c9610528c
45 my ($this, $control) = @_; 45 my ($this, $control) = @_;
46 46
47 if (my $factory = $this->controls->{$control}) { 47 if (my $factory = $this->controls->{$control}) {
48 return $factory; 48 return $factory;
49 } else { 49 } else {
50 50 =pod
51 my $path = $control; 51 my $path = $control;
52 if ( my $template = $this->loader->template($path) ) { 52 if ( my $template = $this->loader->template($path) ) {
53 my $opts = { %{$this->opts} }; 53 #my $opts = { %{$this->opts} };
54 $opts->{STASH} = $this->context->stash->clone(); 54 #$opts->{STASH} = $this->context->stash->clone();
55 55
56 my $ctx = new Template::Context($opts); 56 my $ctx = new Template::Context();#$opts);
57 57
58 $factory = new IMPL::Web::View::TTFactory( 58 $factory = new IMPL::Web::View::TTFactory(
59 typeof IMPL::Web::View::TTControl, 59 typeof IMPL::Web::View::TTControl,
60 $template, 60 $template,
61 $ctx, 61 $ctx,
62 $opts 62 {} #$opts
63 ); 63 );
64 64
65 my @parts = split(/\/+/,$control); 65 my @parts = split(/\/+/,$control);
66 66
67 $this->controls->{$control} = $factory; 67 $this->controls->{$control} = $factory;
68 $this->context->stash->set([map { $_, 0 } @parts], $factory); 68 $this->context->stash->set([map { $_, 0 } @parts], $factory);
69 69
70 return $factory; 70 return $factory;
71
71 } else { 72 } else {
72 die new IMPL::KeyNotFoundException($control); 73 die new IMPL::KeyNotFoundException($control);
73 } 74 }
74 75 =cut
75 } 76 }
76 } 77 }
77 78
78 sub renderBlock { 79 sub renderBlock {
79 $_[0]->template; 80 $_[0]->template;
80 } 81 }
81 82
82 sub Render { 83 sub Render {
83 my ($this,$args) = @_; 84 my ($this,$args) = @_;
84 85
85 my $output = $this->IMPL::Web::TTControl::Render( { document => $this } ); 86 my $output = $this->SUPER::Render( { document => $this } );
86 87
87 if ($this->layout) { 88 if ($this->layout) {
88 $output = $this->context->include($this->layout, { content => $output } ); 89 $output = $this->context->include($this->layout, { content => $output } );
89 } 90 }
90 91