#!/usr/bin/perl use strict; use warnings; use Plack::Request; sub { my $req = 'Plack::Request'->new(shift); my %method = ( GET => sub { [] }, POST => sub { ['Hello ', $req->body_parameters->{text}] }); my $action = $method{ $req->method } or return [405, [Allow => join ', ', keys %method], []]; return [200, ['Content-type' => 'text/html'], $action->()] } __DATA__
Your name: