Perl - Amon2::Plugin::Web::Text
text/plain な response を返したいときがよくあるので plugin にしてみた。
SYNOPSIS
use Amon2::Lite; __PACKAGE__->load_plugins('Web::Text'); get '/' => sub { my $c = shift; return $c->render_text('hello, world.'); }; get '/not-found' => sub { my $c = shift; return $c->render_text( 404 => "Not found" ); }; __PACKAGE__->to_app;
引数の個数によって挙動が変わります :-)