[Catalyst] hostname

Octavian Rasnita orasnita at gmail.com
Thu Jan 10 20:15:25 GMT 2008


From: "Ash Berlin" <ash_cpan at firemirror.com>
> How did you get to a function in MyApp.pm during a request....
>
> # in MyApp.pm
>
> sub foobarbaz {
>    my ($c) = @_;
> }
>
> # In controller code.
> $c->foobarbaz();
>
> Make sense?

Not really.

I've tried (in MyApp.pm):

sub the_host {
my ($c) = @_;
return $c->req->hostname;
}

and then I've tried to use

cookie_domain => the_host()
in the MyApp config, but when I try to start the server it gives an error 
telling that I can't use the method "req" because $c is undefined.

But anyway, what I need is working because I can avoid setting a domain name 
for the cookie.

Octavian




More information about the Catalyst mailing list