#!perl -w use strict; use warnings; use utf8; use Plack::Builder; my $valid_html = q{ hoge

fuga

}; my $error_html = q{ hoge

fuga

hoge }; builder { enable 'HTMLLint'; mount '/text' => sub { return sub { my $responder = shift; my $writer = $responder->([200, ['Content-Type' => 'text/plain']]); $writer->write("OK"); $writer->close; }; }; mount '/valid_html' => sub { return sub { my $responder = shift; my $writer = $responder->([200, ['Content-Type' => 'text/html']]); foreach my $line (split /\n/, $valid_html) { $writer->write($line); $writer->write("\n"); } $writer->close; }; }; mount '/error_html' => sub { return sub { my $responder = shift; my $writer = $responder->([200, ['Content-Type' => 'text/html']]); foreach my $line (split /\n/, $error_html) { $writer->write($line); $writer->write("\n"); } $writer->close; }; }; };