Mason::Plugin::QuoteFilters - Filters for making quoted strings
version 0.002
This plugin provides some filter sugar for quoting strings in Mason template output.
Say you have a Perl variable, $bar, that you need to inject into some JavaScript. Currently you would write:
var foo = '<% $bar %>';
which this author thinks is ugly because the quotes get lost in the syntax. It also has a tendency to throw off syntax highlighters.
Instead, using this filter you could write:
var foo = <% $bar |Q %>;
and get the same end result.
Single quote a string. Any embedded single quotes are escaped with backslashes.
Double quote a string. Any embedded double quotes are escaped with backslashes.
Mason
Stephen Clouse <stephenclouse@gmail.com>
This software is copyright (c) 2011 by Stephen Clouse.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Mason::Plugin::QuoteFilters, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Mason::Plugin::QuoteFilters
CPAN shell
perl -MCPAN -e shell install Mason::Plugin::QuoteFilters
For more information on module installation, please visit the detailed CPAN module installation guide.