Are they?
So far I had a look at CGI.pm and CGI::Simple.
The trouble starts when you are handling non-mainstream requests that contain payload, like the PUT method. That means, the HTTP message has a body or content attached, which is not the result of a POST action or is not labeled as being 'application/x-www-form-urlencoded'.
My experience is that CGI.pm 3.49 does not read in the put data correctly, although it should do so and store it in param('PUTDATA') (after a lot of
effort).
Other non-standard methods do send content as well, for example the PROPFIND method common in WebDAV. CGI.pm simply ignores it. CGI::Simple at least tells me it skipped it by raising the '.cgi_error' => '400 Unknown method PROPFIND' error flag.
In both cases I can resort to reading in STDIN. But things with STDIN get messy when your helper module *thinks* it did the right thing, garbled everything into key/value param nonsense or similar. And then, STDIN is cleared.
Building on the best there is, you decide to use CGI::Simple, but what about large payloads, gigabytes? Reading all this into memory is a bad idea. CGI.pm has hooks to process chunk by chunk or send everything to a file - CGI::Simple doesn't (right?).
Or have you every tried to output all capitalized/partly capitalized headers like "ABC-Value: test"? The
header(-abc_alue => 'test') interface is your only chance and it only ever capitalizes the first letter!
So, is there a .cgi helper module which I can use as a replacement for CGI.pm which doesn't try to marshall which method is okay or not and lets me handle method evaluation. Is there a helper which reads in whole HTTP requests while providing hooks to do it in slurps, or in chunks, to a file, etc.
In one sentence: is there a .cgi helper module which is fit for REST?
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.