[Catalyst] Testing against local but 'external' server?

Jesse Sheidlower jester at panix.com
Thu Oct 9 21:13:13 BST 2008

This is either a question about the
Test::WWW::Mechanized::Catalyst docs, or a question about how
to do something that should be necessary, I think.

I'm about to migrate to a new server, and this seemed like a
good occasion to actually learn how to write tests, so I've
been looking through the various docs and modules for this.

The T::W::M::Cat docs talk about the fact that the module
doesn't make real HTTP requests, instead it passes an HTTP
object to Cat; "localhost" or a link starting with "/" signals
that you're using this system. However, you can use a remote
server by using the allow_external method or setting the
CATALYST_SERVER env var. This does seem useful, so you don't
need a running server to do your tests.

However, it's not clear whether you can use these
remote-server techniques to _force_ the local address to be
regarded as an external server.

That is, if I want to test my Catalyst app against a real
server (for example, if I have server configuration settings
in an httpd.conf file, or some other reason why I need to test
my app against Apache instead of a Perl HTTP object), but I
want to do so on my local machine, how do I do it? I see from
the Catalyst::Test source that CATALYST_SERVER will override
the use of the HTTP object, but I can't quite follow what
T::W::M::Cat is doing. I'd like to be able to point to
http://localhost/myapp but have this be regarded as a remote
address that does use the server.

Thanks. I'd offer to fix the docs myself, but this isn't in
the Catalyst repo....there are minor typos, too.

Jesse Sheidlower

More information about the Catalyst mailing list