WebApp/Segment/Decline/StaticContent.pm untested

filter: Statementstmt 0.0% 0 / 15 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 6 MC/DCmcdc 0.0% 0 / 3 Subroutinesub 0.0% 0 / 3 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 32 CC 3 SCAR 20.8
CC
3
Cov
0%
should_decline
12.0
BEGIN
2.0
BEGIN
2.0
CRAP 8.0
1 =head1 NAME
2  
3 OpenFrame::WebApp::Segment::Decline::StaticContent - decline if request uri is for static content.
4  
5 =head1 SYNOPSIS
6  
7 $pipe->add_segment( OpenFrame::WebApp::Segment::StaticContent->new )
8  
9 =cut
10  
11 package OpenFrame::WebApp::Segment::Decline::StaticContent;
12  
13 use MIME::Types;
14  
15 use base qw( OpenFrame::WebApp::Segment::Decline );
16  
17 our $VERSION = (split(/ /, '$Revision: 1.1 $'))[1];
18  
19 sub should_decline {
20 my $self = shift;
21 my $request = $self->store->get('OpenFrame::Request') || return;
22 my $uri = $request->uri || return;
23 my $mtype = MIME::Types->new->mimeTypeOf( $uri ) || return;
24  
25 return 1 if ($mtype->subType eq 'css');
26 return 1 if ($mtype->mediaType eq 'image');
27  
28 return 0;
29 }
30  
31 1;
32  
33 __END__