Hi

I am experiencing a problem that I do not see solved or named in the 
mailing list, but this can be due to my lack of search terms. So I try 
here and hope not to get flamed. The problem bearer is content_type.

I have created some inheriting objects that deal with handling a certain 
request. As per normal behaviour each object has a method 'handler' 
that does the basics: the requested action is derived from the URL 
folowing "/(ObjectName)/(Action)(/Parameters)". To accommodate for 
unexisting actions I created an AUTOLOAD in the parent object. So far so 
good.

Now one of the derived object does something like this:

        $r->content_type('text/xml')
        $self->SUPER::handler($r)

This object does some basic things for generating XML, hence the 
content_type. This, again, works fine. Now the problem - if an unexisting 
action for this "XML subclass" is requested, the AUTOLOAD kicks in. The 
AUTOLOAD sets the content-type back to HTML ($r->content_type('text/html'))
but this is completely ignored...

Now the docs state that overruling a content_type can only be done if that 
header is not yet send to the client. When does this get send, cause to me 
it seems as if there is not much room. What happens is:

        xml_object->handler:    set content type
                                call SUPER::handler
                SUPER::handler:         derive action
                                        call $self->action
                        $self->AUTOLOAD:        call $self->show_error
                                $self->show_error:      set content type
                                                        output error

Any pointers on this? I am using Apache 2.0.54 and mod_perl 2.0.1 if that 
sheds any light. Again I am appologising if this could have been found on 
the list or elsewhere, pointers are appreciated.

Regards,
Frank

Reply via email to