As rhesa mentioned, you don't do output directly from your view. Rather you give the output generated by your view back to the Catalyst. (In this way, Catalyst is like CGI::Appl and several other MVC frameworks)

While this interface seems cumbersome and adds a little overhead, it does allow for some nice capabilities, like centralized error processing, wrappers, or post-processing (think XSL transformations). I'm sure other people have really good examples of capabilities.

Anyway, you want to be looking in the documentation for how to use $c->response->body (the shorthand reference you'll often see is $c->res->body . If you look into other view code sources, you will that view actions can end with code like:

$c->response->body($output); return 1;
where previously generated output in $output is given to Catalyst and the view routine simply returns. You replace or add to the output body contents using the API. When you return from the view component, Catalyst (or other components in your application) may examine or modify the contents of the body. Then Catalyst will output the header, then the body.

You will also want to check out things like $c->response->status and $c->response->content_type to see how to interact with Catalyst to specify the other HTTP output data.


In reply to Re: creating a Catalyst View component by shenme
in thread creating a Catalyst View component by holli

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.