Skip to content

Instantly share code, notes, and snippets.

@taiyoh
Created April 22, 2013 05:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save taiyoh/5432615 to your computer and use it in GitHub Desktop.
Save taiyoh/5432615 to your computer and use it in GitHub Desktop.
package MyApp::Web::ViewFunctions;
use Tiffany::Text::MicroTemplate::Extended;
package Tiffany::Text::MicroTemplate::Extended;
use strict;
use warnings;
sub c { Amon2->context }
sub uri_with { Amon2->context->req->uri_with(@_) }
sub uri_for { Amon2->context->uri_for(@_) }
sub mark_raw { Text::MicroTemplate::EncodedString->new($_[0]) }
sub nl2br {
my $str = shift || '';
$str =~ s{\r?\n}{<br />}g;
mark_raw($str);
}
1;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment