On Thursday 10 January 2008 21:15:25 Octavian Rasnita wrote: > From: "Ash Berlin" <[EMAIL PROTECTED]> > > > 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.
You could use MyApp::Root::auto to lookup the hostname from the request and set it in config as you wish. Example: # MyApp::Root; sub auto : Private { my ( $self, $c ) = @_; $c->config->{cookie_domain} = $c->req->hostname; } > > But anyway, what I need is working because I can avoid setting a domain > name for the cookie. > > Octavian > > > _______________________________________________ > List: Catalyst@lists.scsys.co.uk > Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst > Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ > Dev site: http://dev.catalyst.perl.org/ -- Knut-Olav Hoven Systemutvikler mob: +47 986 71 700 Linpro AS http://www.linpro.no/
signature.asc
Description: This is a digitally signed message part.
_______________________________________________ List: Catalyst@lists.scsys.co.uk Listinfo: http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/catalyst Searchable archive: http://www.mail-archive.com/catalyst@lists.scsys.co.uk/ Dev site: http://dev.catalyst.perl.org/