File Coverage

blib/lib/WebApp/Helpers/MimeTypes.pm
Criterion Covered Total %
statement 15 15 100.0
branch n/a
condition n/a
subroutine 6 6 100.0
pod 1 1 100.0
total 22 22 100.0


line stmt bran cond sub pod time code
1             package WebApp::Helpers::MimeTypes;
2              
3 2     2   12334 use strict;
  2         5  
  2         76  
4 2     2   11 use warnings;
  2         5  
  2         79  
5              
6 2     2   1886 use MIME::Types;
  2         11418  
  2         101  
7              
8 2     2   997 use Moo::Role;
  2         27267  
  2         18  
9              
10             our $VERSION = "0.02";
11              
12              
13             has mime_types => (is => 'ro', lazy => 1, builder => 1);
14 1     1   428 sub _build_mime_types { MIME::Types->new }
15              
16             sub mime_type_for {
17 1     1 1 6179 my ($self, $ext) = @_;
18 1         5 return $self->mime_types->mimeTypeOf($ext)->type();
19             }
20              
21              
22              
23              
24             1;
25             __END__