|
From: A. P. <pag...@gm...> - 2005-09-03 18:11:54
|
* Terrence Brannon <ba...@me...> [2005-09-03 19:10]:
> This being the case, should these two aspects of the CGI
> response be two different methods, with $self->content_type
> existing in a base class and re-used for most of the app and
> $self->content (which is known as $self->render) be variant on
> each page?
That used to bug me until I started using CGI::Prototype::Hidden,
where the WRAPPER template takes care of this adequately. The
variables are all shared between the main template and the
wrapper, which includes `self`, so you just can do something like
Content-type: [% self.content_type %]
at the top of the wrapper and have a `content_type` method which
sets the default in your application class, and then change it
for pages which deliver a different type of content.
I found responsibilities are actually separated more cleanly this
way.
Regards,
--
#Aristotle
*AUTOLOAD=*_=sub{s/(.*)::(.*)/print$2,(",$\/"," ")[defined wantarray]/e;$1};
&Just->another->Perl->hacker;
|