comparison Lib/IMPL/Web/Handler/View.pm @ 371:d5c8b955bf8d

refactoring
author cin
date Fri, 13 Dec 2013 16:49:47 +0400
parents 833e663796c4
children e12c14177848
comparison
equal deleted inserted replaced
370:cbf4febf0930 371:d5c8b955bf8d
39 sub Invoke { 39 sub Invoke {
40 my ( $this, $action, $next ) = @_; 40 my ( $this, $action, $next ) = @_;
41 41
42 my $result = $next ? $next->($action) : undef; 42 my $result = $next ? $next->($action) : undef;
43 43
44 my ($model,$template); 44 my $model;
45 if( ref $result and eval { $result->isa(ViewResult) } ) { 45 if( ref $result and eval { $result->isa(ViewResult) } ) {
46 $model = $result->model; 46 $model = $result->model;
47 $template = $result->template;
48 } else { 47 } else {
49 $model = $result; 48 $model = $result;
50 $result = ViewResult->new(model => $model); 49 $result = ViewResult->new(model => $model);
51 } 50 }
52 51
65 my %responseParams = ( 64 my %responseParams = (
66 type => $this->contentType, 65 type => $this->contentType,
67 charset => $this->contentCharset, 66 charset => $this->contentCharset,
68 body => $this->view->display( 67 body => $this->view->display(
69 $model, 68 $model,
70 $template || $this->SelectView( $action, ref $model ), 69 $this->SelectView( $action, ref $model ),
71 $vars 70 $vars
72 ) 71 )
73 ); 72 );
74 73
75 $responseParams{status} = $result->status if $result->status; 74 $responseParams{status} = $result->status if $result->status;