blib/lib/Regexp/Pattern/Filename/Type/Archive.pm

filter: Statementstmt 100% 25 / 25 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 30 / 30 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
↑ Summary
1 package Regexp::Pattern::Filename::Type::Archive;
2  
3 1 ▶use 5.010001;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 #use utf8;
7  
8 1 ▶use Filename::Type::Archive ();
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use Filename::Type::Compressed ();
Subroutine BEGIN: called CC=1 SCAR=0.0
10  
11 1 our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY
12 1 our $DATE = '2024-12-21'; # DATE
13 1 our $DIST = 'Regexp-Pattern-Filename-Type-Archive'; # DIST
14 1 our $VERSION = '0.004'; # VERSION
15  
16 1 our %RE;
17  
18 my $re = join('',
19 13 '(?:', join('|', map {quotemeta} sort keys %Filename::Type::Archive::SUFFIXES ), ')',
20 1 '(?:', join('|', map {quotemeta} sort keys %Filename::Type::Compressed::SUFFIXES), ')*',
21 );
22 1 $re = qr($re\z)i;
23  
24 $RE{filename_type_archive} = {
25 1 summary => 'Archive filename',
26 pat => $re,
27 tags => ['anchored'],
28 examples => [
29 {str=>'foo', matches=>0, summary=>'No extension'},
30 {str=>'zip', matches=>0, summary=>'Not an extension'},
31 {str=>'foo.zip', matches=>1},
32 {str=>'foo.tar.gz', matches=>1, summary=>'Plus compression'},
33 {str=>'foo bar.TBZ', matches=>1, summary=>'Case insensitive'},
34 {str=>'foo.ARJ is the file', matches=>0, summary=>'Regex is anchored'},
35 {str=>'foo.txt', matches=>0},
36 ],
37 };
38  
39 1 1;
40 # ABSTRACT: Archive filename
41  
42 __END__
↑ Summary