I'm writing some cookie-handling code, and I want to write the unit
tests first.  I've got a good idea how I'm going to do it, but I
wanted to know if there was a better way (or an example I could look
at).

I was planning on mocking up a CGI object to return my CGI::Cookie
when queried, then (somehow) causing that CGI object to be the one
that my code uses.  However, I'm not very fluent in how to hack the
list of loaded modules (which I'm accustomed to doing in Perl).

Could anybody point me in a direction?