Apache2-WebApp-Plugin-File

 view release on metacpan or  search on metacpan

lib/Apache2/WebApp/Plugin/File.pm  view on Meta::CPAN

        $c->request->headers_out->add( 'Content-Type'        => $content_type                   );
        $c->request->headers_out();
    }
    else {
        $c->request->content_type($content_type);
    }

    my $buffer = "";

    # send file as a binary stream
    binmode STDOUT;

    local *FILE;
    open (FILE, $file) or $self->error("Cannot open file: $!");
    while ( read( FILE, $buffer, 4_096 ) ) {
        print STDOUT $buffer;
    }
    close(FILE);
    exit;
}



( run in 0.388 second using v1.01-cache-2.11-cpan-8d75d55dd25 )