CGI::AppToolkit::Template::Filter - A superclass for CGI::AppToolkit::Template filters
CGI::AppToolkit::Template
CGI::AppToolkit::Template::Filter is intended for subclassing and overriding it's filter() method.
filter()
filter() is called as an object with two parameters. The first parameter (after the object reference) is a hashref of the arguments specified in the calling template. The second parameter is the value to be 'filtered.'
In addition to being able to write your own filters easily, CGI::AppToolkit comes with several filters:
CGI::AppToolkit
<BR>
+
%20
sprintf()
%.2f
abs()
This is the complete code of CGI::AppToolkit::Template::Filter::BR.
CGI::AppToolkit::Template::Filter::BR
package CGI::AppToolkit::Template::Filter::BR; $VERSION = '0.05'; require 5.004; use Carp; use base 'CGI::AppToolkit::Template::Filter'; use strict; sub filter { my $self = shift; my $args = shift; my $text = shift; my $br = ref $args && @$args ? $args->[0] : '<br>'; $text =~ s/(\r?\n)/$br\1/g; $text } 1;
To install CGI::AppToolkit, copy and paste the appropriate command in to your terminal.
cpanm
cpanm CGI::AppToolkit
CPAN shell
perl -MCPAN -e shell install CGI::AppToolkit
For more information on module installation, please visit the detailed CPAN module installation guide.