Rhesa already answered your immediate question. I'm going to give you
some advice in terms of why what you're doing isn't the best.
In general, headers and footers should be managed by the templating
system you're using. For example, I use Template Toolkit (TT) and it
has the [% INCLUDE %] directive. HTML::Template has <TMPL_INCLUDE> and
the others have similar directives.
So, why should you do this? It all boils down to MVC - Model vs. View
vs. Controller. Read
http://en.wikipedia.org/wiki/Model-view-controller then come back to
the following.
The content you present to the user should be managed by your view,
not your controller. In this case,your CGI::Application subclass is
your controller and TT (or H::T, Mason, Embperl, etc) is your view.
(Your model would be your database, in most cases, plus whatever
business objects you have.) In the cases where you have headers, your
template should be doing the right thing. In the cases where you
don't, your template should still be doing the right thing. Your
controller doesn't want to care about headers and such. It's too much
work for it.
Rob
On 8/5/06, Carlos Ramirez <[EMAIL PROTECTED]> wrote:
I'm using cgiapp_postrun() to add header and footer to outgoing content.
I'm some runmodes, I'm setting the outgoing content type to 'text/plain'
which means that I do not want to add header and footer content to the
outgoing content. According to the docs, I should be able to use
header_props() to get the outgoing headers so that I can do the
following in my cgiapp_postrun subroutine:
sub cgiapp_postrun {
my $headers = $self->header_props;
if ($headers->{'-type'} eq 'text/html') {
## add header/footer to $$output_ref
}
}
Unfortunately the above doesn't work. Printing $headers gives the
string: 1/8?
Any help is appreciated. Thanks.
-Carlos
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
---------------------------------------------------------------------
Web Archive: http://www.mail-archive.com/[email protected]/
http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]