<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<p>Hi!</p>
<p>Sorry about this newbie question. I've honestly and desperatly
googled a lot, but still have no idea how to properly call
process() method from my view, inherited from Catalyst::View::JSON</p>
<p>Any advices are welcome!</p>
<p><br>
</p>
<p>I have a view in my project. It's created with a helper in a
standard manner.<br>
</p>
<p><tt>package my_app::View::JSON;</tt><tt><br>
</tt><tt><br>
</tt><tt>use strict;</tt><tt><br>
</tt><tt>use base 'Catalyst::View::JSON';</tt><tt><br>
</tt></p>
<p><tt>1;</tt><tt><br>
</tt></p>
<p><tt><br>
</tt></p>
<p>From my app I do following</p>
<p><tt>$c->stash->{id} = 777;<br>
$c->forward('View::JSON'); # It's not my default view</tt></p>
<p><br>
</p>
<p>It works flawlessy, but I need to preprocess my stash to exclude
or include some data or set additional headers. It's a pretty
standard logic, so I decided to create my own process method in my
view, process my stash and then pass control to the inherited
process method<tt><br>
</tt></p>
<p><tt># My</tt><tt><br>
sub process</tt><tt><br>
</tt><tt>{</tt><tt><br>
</tt><tt> my($self, $c) = @_;</tt><tt><br>
</tt><tt> $self->Catalyst::View::JSON::process($self, $c);</tt><tt><br>
</tt><tt>}</tt></p>
<p>is not working. <br>
</p>
<pre wrap=""><code class="error">Caught exception in my_app::View::JSON->process "Can't locate object method "stash" via package "my_app::View::JSON"</code></pre>
<p>I intuitively understand why (at least about $self), but don't
know how to make magic in a propper way <br>
</p>
<p><br>
</p>
<p>Many thank in advance!<br>
</p>
<p><br>
</p>
<p><br>
</p>
<p><br>
</p>
</body>
</html>