Hi Jörg, >> Do I need to reinvent the wheel, or is there some way that my plugin >> can pass the file to the serve_file plugin? The file only exists as a >> temporary file and/or a cached file. I can of course leave the temporary >> file intact and modify the header, but how do I tell serve_file to clean >> up then? > > Modifying $self->client->headers_in->filename is the way to go. You can clean > up in hook_response_sent. See perldoc lib/Axkit2/Plugin.pm for a list of > available hooks
Unfortunately, it doesn't seem to be that easy :-( I've tried a lot of combinations, but it seems I invariably run into the same basic problem: In my situation, I'll quite often have some data that should be served like an ordinary file. However, it isn't an ordinary file - sometimes it's a temporary file, at other times it's a memory image. The first is the case when I unzip a file from an OpenDocument archive, as example, the later would be the case if I fetch a file from cachecache. Temporary files are implicitly closed when 'you launch another program from within your script', to quote the Camel Book - and with the plugin architecture of Ax2, this seems to be the case. So even though I've tried modifying server_file to accept a filehandle instead of a filename, the filehandle of my temporary file is closed when it reaches server_file. And handing a memory image to server_file means even heavier modification. Changing server_file to a Perl module might solve the first problem - calling a module wouldn't count as an external program. But anyway, I don't think it's for me to decide how to handle this, though I would like to participate in finding the solution, of course. I think it would be a shame if I had to invent my own handling of MIME types, serving files, etc. Regards, Lars -- Lars Skjærlund Consultant Ubiquitech A/S Lyngby Hovedgade 4,3 2800 Kgs. Lyngby Denmark Tel: +4570200084 Mobile: +4523457157 http://www.ubiquitech.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]