| Catalyst-View-Download documentation | view source | Contained in the Catalyst-View-Download distribution. |
Catalyst::View::Download::Plain
0.02
# lib/MyApp/View/Download/Plain.pm
package MyApp::View::Download::Plain;
use base qw( Catalyst::View::Download::Plain );
1;
# lib/MyApp/Controller/SomeController.pm
sub example_action_1 : Local {
my ($self, $c) = @_;
my $content = "Some Text";
# To output your data just pass your content into the 'plain' key of the stash
$c->stash->{'plain'} = {
data => $content
};
# Or into the body of the response for this action
$c->response->body($content);
# Finally forward processing to the Plain View
$c->forward('MyApp::View::Download::Plain');
}
Takes content and outputs the content as plain 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.
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. Content when passed via the stash must be passed in a hashref in the key labeled 'data'
$c->view('MyApp::View::Download::Plain')->config->{'stash_key'} = 'content';
Travis Chase, <gaudeon at cpan.org>
Catalyst Catalyst::View Catalyst::View::Download
Copyright 2008 Travis Chase.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
| Catalyst-View-Download documentation | view source | Contained in the Catalyst-View-Download distribution. |