File Coverage

blib/lib/Filename/Media.pm
Criterion Covered Total %
statement 13 13 100.0
branch 2 2 100.0
condition n/a
subroutine 5 5 100.0
pod 1 1 100.0
total 21 21 100.0


line stmt bran cond sub pod time code
1             package Filename::Media;
2              
3             our $DATE = '2017-08-12'; # DATE
4             our $VERSION = '0.001'; # VERSION
5              
6 1     1   50053 use 5.010001;
  1         3  
7 1     1   4 use strict;
  1         1  
  1         17  
8 1     1   4 use warnings;
  1         1  
  1         25  
9              
10 1     1   5 use Exporter qw(import);
  1         2  
  1         261  
11             our @EXPORT_OK = qw(check_media_filename);
12              
13             our $RE = qr(\.(?:movie|mpega|aifc|aiff|djvu|flac|jpeg|jpg2|midi|mpeg|mpga|opus|svgz|tiff|wbmp|webm|3gp|aif|amr|art|asf|asx|avi|awb|axa|axv|bmp|cdr|cdt|cpt|cr2|crw|csd|dif|djv|erf|fli|flv|gif|gsm|ico|ief|jng|jp2|jpe|jpf|jpg|jpm|jpx|kar|lsf|lsx|m3u|m4a|mid|mkv|mng|mov|mp2|mp3|mp4|mpe|mpg|mpv|mxu|nef|oga|ogg|ogv|orc|orf|pat|pbm|pcx|pgm|pls|png|pnm|ppm|psd|ram|ras|rgb|sco|sd2|sid|snd|spx|svg|tif|wav|wax|wma|wmv|wmx|wvx|xbm|xpm|xwd|au|dl|dv|gl|qt|ra|rm|ts|wm)\z)i; # RE
14              
15             sub check_media_filename {
16 5     5 1 88 my %args = @_;
17              
18 5 100       47 $args{filename} =~ $RE ? {} : 0;
19             }
20              
21             1;
22             # ABSTRACT: Check whether filename indicates being a media (audio/video/image) file
23              
24             __END__