Catalyst-Plugin-AutoCRUD

 view release on metacpan or  search on metacpan

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


    (my $pkg_path = __PACKAGE__) =~ s{::}{/}g;
    my (undef, $directory, undef) = fileparse(
        $INC{ $pkg_path .'.pm' }
    );

    my $path = "$directory../static/$file";

    if ( ($file =~ m/\w+\.(\w{2,3})$/i) and (-f $path) ) {
        my $ext = $1;
        my $stat = stat($path);

        if ( $c->req->headers->header('If-Modified-Since') ) {

            if ( $c->req->headers->if_modified_since == $stat->mtime ) {
                $c->res->status(304); # Not Modified
                $c->res->headers->remove_content_headers;
                return 1;
            }
        }



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