Re: Re: CGI testing with a mock object in Perl
Tony Byrne <[email protected]>
| Newsgroups | gmane.comp.programming.test-driven-development,gmane.comp.programming.test-first-user-interfaces |
|---|---|
| Organization | ByrneHQ |
| Message-ID | <[email protected]> |
Hello Phlip,
Saturday, July 17, 2004, 9:28:04 PM, you wrote:
P> I converted that sample code into bookyuck:
Bookyuck? Should I feel complimented or offended?
P> $ENV{'REQUEST_METHOD'} = 'GET';
P> $ENV{'QUERY_STRING'} = 'payload=Daddy+Warbucks';
P> my $cgi = CGI->new();
P> # build the page
P> my $response = GuiLayer->processRequest($cgi);
I maybe missing something in your technique, but I prefer to use the simpler:
my $cgi = CGI->new("payload=Daddy+Warbucks");
or
my $cgi = CGI->new({ payload => 'Daddy Warbucks' });
since, in our production code, we can trust CGI.pm to interact with
the environment for us, giving us a higher level interface to the
query. I realize that a lot of existing CGI code mixes CGI.pm code
with lower level access to the CGI environment, so maybe you intended
to avoid breaking such code.
Regards,
Tony.
--
Tony Byrne
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/NhFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/testdrivendevelopment/
<*> To unsubscribe from this group, send an email to:
[email protected]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/