On Fri, Mar 5, 2010 at 5:10 AM, David <oldskif...@yahoo.es> wrote: > Hi, > > I need to generate an XML output (Content-type: application/xml), but this > XML output is the XML content which is stored in an XML file. I don't need > to dinamically generate this XML content. > I have searched in google but I don't find any catalyst view module for > managing this case. I don't know if exists any module for generating XML > output from a static file as, for example, Catalyst::View::XSLT module > (http://search.cpan.org/~janus/Catalyst-View-XSLT-0.08/lib/Catalyst/View/XSLT.pm) > does. That is, generate an output from a static file, in this case, an XML > output. > > I am not finding much information about designing your own views in > Catalyst, or at least, I don't see much flexibility. All examples I have > found need to be generated, through the helper view, with TT template or any > other templates. > Is it possible to create your own view, with no template, and for example, > in my case, read the output from a static file and send this output to the > client? (I don't know exactly how Views works in Catalyst, though I have > already read Catalyst tutorial and cookbook) > > Thanks in advanced, > > > David >
Well, you could do your own view or just rely on Catalyst::Plugin::Static::Simple: http://search.cpan.org/~mstrout/Catalyst-Plugin-Static-Simple-0.29/lib/Catalyst/Plugin/Static/Simple.pm#serve_static_file_$file_path You could wrap this in a view: package MyApp::View::StaticFile; use parent 'Catalyst::View'; sub process { my ( $self, $c ) = @_; $c->serve_static_file( $c->stash->{static_file} ); } 1; Then just do $c->forward( $c->view('StaticFile') ); after setting the stash key. -Jay _______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/