Catalyst-Plugin-Static-File

 view release on metacpan or  search on metacpan

lib/Catalyst/Plugin/Static/File.pm  view on Meta::CPAN


        binmode($fh);
        Plack::Util::set_io_path( $fh, $abs );
        $res->body($fh);

        $type //= Plack::MIME->mime_type($abs);

        my $headers = $res->headers;
        $headers->content_type("$type");

        my $stat = stat($fh);
        $headers->content_length( $stat->size );
        $headers->last_modified( $stat->mtime );

    }
    catch {

        my $error = $_;
        Catalyst::Exception->throw("Unable to open ${abs} for reading: ${error}");

    };



( run in 1.243 second using v1.01-cache-2.11-cpan-49f99fa48dc )