[Pdx-pm] testing simulated CGI input

Randall Hansen randall at sonofhans.net
Sun Sep 12 01:03:55 CDT 2004


folks ~

i have a module which validates CGI parameters.  i have a test suite, 
most of which is straightforward.  you can pass the module parameters 
yourself (easy to test); if you ask nicely, it will get the parameters 
from CGI.pm directly.

the way i'm testing this now is to have a "dispatch" test make system 
calls to smaller test files.  e.g.:

# dispatch.t:

     system 'perl',
         '-Ilib',     # to find the modules in the dev directory
         't/91cgi_methods.cgi',     # the name of the test
         'number=3172',     # parameters ...
         'name=Lava lamp',
         'price=27.99',
         'crackme=;rm / -rf',
     ;

and then 91cgi_methods.cgi gets the CGI parameters and does it's thing. 
  it works quite well.

but the hard-coded slash in the test path ("t/9cgi_methods.cgi") seems 
like a portability issue.  i'm looking into File::Spec to solve that.  
does anyone see other portability issues?

and i wonder, more generally, if anyone knows of a better way to do 
this?

tia,

randalL :)



More information about the Pdx-pm-list mailing list