Gareth Kirwan wrote: >> I have a website which uses autohandlers for formatting. >> I have a dhandler buried three directories down. >> Most of the time the dhandler renders content which wants to >> be wrapped. >> Occasionally it needs to send a file. >> >> To achieve this I wanted to do something like: >> $r->conent_type('application/excel'); >> $m->clear_buffer; >> print $content; >> $m->flush_buffer; >> return $m->abort(200); > > Okay, errie... > This actually works, so problem solved.
I think a better way to do this, is to just stop that particular component inheriting from the autohandler (or any other components that would normally make up the wrapping chain). <%flags> inherit => undef </%flags> This will cause the component not to be wrapped by any autohandlers. In my own Mason app, I had the root autohandler inherit from another component, init.mas (and init.mas obviously had to explicitly be set not to inherit from anything). The autohandler dealt with the basic HTML skeleton, but init.mas dealt with checking user logins etc. That way, some basic init stuff could be done even when serving other files, if the component set init.mas to be the component it inherited from (instead of the usual chain of autohandlers). The only case in which this method wouldn't work, is if a component sometimes produced HTML, and sometimes produced something else. I think this would probably mean that the app was badly designed though. -Oli
signature.asc
Description: OpenPGP digital signature
------------------------------------------------------------------------- This SF.net email is sponsored by: Splunk Inc. Still grepping through log files to find problems? Stop. Now Search log events and configuration files using AJAX and a browser. Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________ Mason-users mailing list Mason-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mason-users