Catalyst::View::Download::XML
0.04
# lib/MyApp/View/Download/XML.pm package MyApp::View::Download::XML; use base qw( Catalyst::View::Download::XML ); 1; # lib/MyApp/Controller/SomeController.pm sub example_action_1 : Local { my ($self, $c) = @_; # supported content can be an xml document my $content = "<?xml version="1.0"?>\n<root>\n<text>Some Text\n</text>\n</root>"; # supported content can also be a hashref which will converted into xml # using XMLout from L<XML::Simple> $content = { 'root' => { 'text' => 'Some Text' } }; # To output your data just pass your content into the 'xml' key of the stash $c->stash->{'xml'} = $content; # Or into the body of the response for this action $c->response->body($content); # Finally forward processing to the XML View $c->forward('MyApp::View::Download::XML'); }
Takes content and outputs the content as html text.
This method will be called by Catalyst if it is asked to forward to a component without a specified action.
Allows others to use this view for much more fine-grained content generation.
If a hashref is passed as content it will be converted using the XMLout function from the XML::Simple module. The following options are used to instantiate the XML::Simple object.
Determines the key in the stash this view will look for when attempting to retrieve content to process. If this key isn't found it will then look at $c->response->body for content.
$c->view('MyApp::View::Download::XML')->config->{'stash_key'} = 'content';
Travis Chase, <gaudeon at cpan dot org>
<gaudeon at cpan dot org>
Catalyst Catalyst::View Catalyst::View::Download XML::Simple
This program is free software. You can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::View::Download, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::View::Download
CPAN shell
perl -MCPAN -e shell install Catalyst::View::Download
For more information on module installation, please visit the detailed CPAN module installation guide.