Still being something of a newbie (AKA the more I know, the more I realize how little I know), I got a bit stuck recently whilst trying to write some test scripts for uploading an image to a CGI::Application web page. So I had a look at the test scripts for CGI. It's all pretty much laid out in http://cpansearch.perl.org/src/LDS/CGI.pm-3.49/t/upload.t. This script first sets various environment variables, and then localizes the STDIN, feeds a MIME formatted file into the STDIN and then finally creates a CGI object, which then of course reads the environment variables and the STDIN.
I thought to myself there has to be a better way. I propose to shamelessly rip out the guts of that test script and turn it into a more reusable Test module. I was thinking of calling it "Test::CGI::POST". Although in the Test namespace it would not be a standard test module with ever more esoteric "ok_...." methods. Rather I was thinking of the following more OO interface:
Edit: I have started work on this at http://github.com/periapt/Test-CGI-Multipart. Nothing useable so far but as a proof of concept it is there.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: RFC: Systemizing CGI upload testing
by GrandFather (Saint) on Jun 24, 2010 at 10:46 UTC | |
by SilasTheMonk (Chaplain) on Jun 24, 2010 at 11:03 UTC | |
by GrandFather (Saint) on Jun 24, 2010 at 11:28 UTC | |
by SilasTheMonk (Chaplain) on Jun 24, 2010 at 11:42 UTC |