[Catalyst] hostname

Wade.Stuart at fallon.com Wade.Stuart at fallon.com
Thu Jan 10 19:24:06 GMT 2008


"Octavian Rasnita" <orasnita at gmail.com> wrote on 01/10/2008 12:54:06 PM:

> From: "Carl Johnstone" <catalyst at fadetoblack.me.uk>
> > Both the context object and the hostname should be available to code
> > within MyApp.pm, but only if the code is running during a request.
>
> Ok, but how to get the hostname during a request in MyApp.pm if a $c
> variable is not available?
>
> Octavian
>

Sys::Hostname or a statically set config var,  as there is no reference to
a request at that point (or any real way to derive the list of possible
hostnames hat could be requested).  But then again,  unless you "know" the
hostname that will always be requested why try to set it at that point at
all?  I would still opt for using the request to set a dynamic hostname
later in the process unless you have good reason not to (ssl cert tied to a
hostname for example).  I think most times it is better to not assume that
the hostname requested will be static in code. It makes for a more flexible
and  deployment easier for your app (do you really want to go change a
hardcoded hostname when dns changes need to happen).




-Wade









More information about the Catalyst mailing list