diff --git a/lib/AccountManager/Template/Plugin/Quote.pm b/lib/AccountManager/Template/Plugin/Quote.pm new file mode 100644 index 0000000000000000000000000000000000000000..73e35eeee50656539013e6c0453db5faa1d0f5b3 --- /dev/null +++ b/lib/AccountManager/Template/Plugin/Quote.pm @@ -0,0 +1,21 @@ +package AccountManager::Template::Plugin::Quote; + +use strict; +use warnings; +use Template::Stash; + +use constant DEFAULT_CHAR => '"'; + +$Template::Stash::SCALAR_OPS->{ quote } = sub { + my $scalar = shift; + my $char = shift || DEFAULT_CHAR; + return $char . $scalar . $char; +}; + +$Template::Stash::LIST_OPS->{ quote } = sub { + my $list = shift; + my $char = shift || DEFAULT_CHAR; + return [ map { $char . $_ . $char } @$list ]; +}; + +1;