[Templates] Apache::Request from Apache::Template

Mark Mills mark@xodiax.com
Fri, 8 Mar 2002 08:44:20 -0500


> > I just started using Apache::Template.  Is there a way to access the
> > Apache request object from inside a template?  It sure=20
> would be useful.
>=20
> No there isn't.  Yes it would.  I must admit it's so obvious=20
> I'm puzzled as to
> why I didn't put it in from the start.
>=20
> > In Apache::Template::handler() we can add:
> >
> > $params->{r} =3D $r;
>=20
> I think a better approach would be to a 'request' option to TT2Params
> which would do the right thing in Template::Service::Apache::params().
> Make it optional for those who want it without getting in the=20
> way of those
> who don't.

That is an awfully big gun to be pointing at everybody's feet. =3D)=20

IMHO this is one of the "leave it obscure" features. If you are =
separating content and code, you rarely need the Request object. And you =
are better off calling for it in perl code rather than within the =
template.

--mark