in reply to Apache::ParseControl a work in progress

Suggestion: instead of using
    sysopen(FH, $filename, $flags); 
    while(<FH>){
        print;
    }
    close(FH);
you could use:
    my $fh = Apache::File->new($filename);
    $r->send_fd($fh);
    close $fh;
</pre<

You'll have to use Apache::File() for this
to work. It'll let Apache core routines send the file
and that can lead to good performance optimisations
(e.g. mmap or sendfile).

You should also handle HEAD requests, do not send the file if $r->header_only.