Catalyst::View::JavaScript - Cache and/or compress JavaScript output
version 0.995
This module fetches JavaScript either from the stash or from $c->output. By default the JavaScript code is read from $c->stash->{js} and compressed. The content type is set to text/javascript.
$c->output
$c->stash->{js}
text/javascript
By default this view will not compress and/or cache if your application is in the debug mode.
If $c is able to cache (i. e. if $c->can('cache')) the value of cache is used as key to cache the JavaScript output. This method returns the view so you can invoke it like this:
$c
if $c->can('cache')
cache
$c->detach( $c->view('JavaScript')->cache('unique-cache-key') );
Set this to a true value to enable compression of the code. See JavaScript::Minifier::XS for more information on how this minification works. Defaults to 1.
This string will be displayed on the top of the output enclosed in a commentary tag.
If you set the debug flag on your application caching and compressing is disabled. Defaults to 1.
If this is set to a true value this module fetches the JavaScript code from $c->output and ignores the value of "stash". Defaults to 0.
This module looks in the stash for this value for JavaScript if "stash" is enabled. Defaults to js.
js
Set this to a true value if the JavaScript code is on the stash. Set the stash value with "key". Defaults to 1.
1
Moritz Onken, <onken at netcubed.de>
<onken at netcubed.de>
Please report any bugs or feature requests to bug-catalyst-view-javascript at rt.cpan.org, or through the web interface at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-View-JavaScript. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
bug-catalyst-view-javascript at rt.cpan.org
Copyright 2009 Moritz Onken, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install Catalyst::View::JavaScript, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::View::JavaScript
CPAN shell
perl -MCPAN -e shell install Catalyst::View::JavaScript
For more information on module installation, please visit the detailed CPAN module installation guide.