[Catalyst] hostname
Jason Kohles
email at jasonkohles.com
Thu Jan 10 19:43:19 GMT 2008
On Jan 10, 2008, at 1:54 PM, Octavian Rasnita wrote:
> 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?
>
What you seem to be missing is that (in the current version at least)
MyApp *IS* $c.
package MyApp;
sub get_hostname {
my ( $self ) = @_;
return $self->request->header( 'host' );
}
--
Jason Kohles, RHCA RHCDS RHCE
email at jasonkohles.com - http://www.jasonkohles.com/
"A witty saying proves nothing." -- Voltaire
More information about the Catalyst
mailing list