File Coverage

blib/lib/Filename/Video.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::Video;
2              
3             our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
4             our $DATE = '2020-04-01'; # DATE
5             our $DIST = 'Filename-Video'; # DIST
6             our $VERSION = '0.002'; # VERSION
7              
8 1     1   58851 use 5.010001;
  1         11  
9 1     1   4 use strict;
  1         2  
  1         28  
10 1     1   6 use warnings;
  1         1  
  1         27  
11              
12 1     1   5 use Exporter qw(import);
  1         1  
  1         156  
13             our @EXPORT_OK = qw(check_video_filename);
14              
15             our $STR_RE = "movie|mpeg|webm|3gp|asf|asx|avi|axv|dif|fli|flv|lsf|lsx|mkv|mng|mov|mp4|mpe|mpg|mpv|mxu|ogv|wmv|wmx|wvx|dl|dv|gl|qt|ts|wm"; # STR_RE
16              
17             our $RE = qr(\.(?:$STR_RE)\z)i;
18              
19             sub check_video_filename {
20 4     4 1 91 my %args = @_;
21              
22 4 100       45 $args{filename} =~ $RE ? {} : 0;
23             }
24              
25             1;
26             # ABSTRACT: Check whether filename indicates being a video file
27              
28             __END__