I have a method that takes a cgi object and creates a CGI::FormBuilder object. if it is submitted, does a db connection and process data otherwise, prepopulates some data and renders the form.
I want to write a unit test for it. Therefore, I want to give it a cgi object and it will create a submitted form and pr开发者_运维知识库ocess data.
Which parameter must be specified in cgi to do form to be submitted?
Thanks in advance.
Parameter is (submittedname_of_the_form)_(name_of_the_form)
Probably you want:
$q = CGI->new(INPUTFILE);
#or
$q = CGI->new(\*STDIN);
#or
$q = CGI->new($my_query_string);
#or
$q = CGI->new(\%my_form_params);
As described on CPAN CGI page
精彩评论