Plack::Middleware::HttpMethodTunnel
These days RESTful web services are all the buzz, even though many who think they know what that means don't have a clue. But if you want to build a truly RESTful web app to go with your RESTful web services you'll quickly learn that web browsers only support GET and POST in HTML forms. Plack::Middleware::HttpMethodTunnel to the rescue after the jump.
Plack::Middleware::HttpMethodTunnel gets around this limitation by allowing you to do what is called HTTP Method Tunnelling. In essence you can either submit your HTTP method as as an HTTP header or a form parameter and then just use a POST as the method.
Here's an example form:
<form method="POST">
<input type="hidden" name="X-HTTP-Method" value="DELETE">
</form>
When you enable the HttpMethodTunnel middleware this then translates the $env->{REQUEST_METHOD} from POST into whatever is stored in X-HTTP-Method, thus allowing you to tunnel any HTTP method across a normal POST operation, and a GET or HEAD across a GET operation.
It was just pointed out to me that Plack::Middleware::MethodOverride (http://search.cpan.org/~dwheeler/Plack-Middleware-MethodOverride-0.10/lib/Plack/Middleware/MethodOverride.pm) does the same thing.
Where the fuck was that when I was searching for it this morning? God CPAN search sucks sometimes.
There's certainly no reason to have 2 modules that do precisely the same thing, so I've decided to delete mine from CPAN. If anybody needs this functionality, please use Plack::Middleware::MethodOverride instead.