| 1 | package Regexp::Pattern::Filename::Compressed; | ||
| 2 | |||
| 3 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 4 | 1 | our $DATE = '2020-05-31'; # DATE | |
| 5 | 1 | our $DIST = 'Regexp-Pattern-Filename-Compressed'; # DIST | |
| 6 | 1 | our $VERSION = '0.002'; # VERSION | |
| 7 | |||
| 8 | 1 | ▶ | use 5.010001; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 9 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 1 | ▶ | use warnings; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 11 | #use utf8; | ||
| 12 | |||
| 13 | 1 | ▶ | use Filename::Compressed (); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | 1 | our %RE; | |
| 16 | |||
| 17 | 1 | my $re = join '|', map {quotemeta} sort keys %Filename::Compressed::SUFFIXES; | |
| 18 | 1 | $re = qr((?:$re)\z)i; | |
| 19 | |||
| 20 | $RE{filename_compressed} = { | ||
| 21 | 1 | summary => 'Compressed data filename', | |
| 22 | pat => $re, | ||
| 23 | tags => ['anchored'], | ||
| 24 | examples => [ | ||
| 25 | {str=>'foo', matches=>0, summary=>'No extension'}, | ||
| 26 | {str=>'gz', matches=>0, summary=>'Not an extension'}, | ||
| 27 | {str=>'foo.gz', matches=>1}, | ||
| 28 | {str=>'foo bar.TAR.BZ2', matches=>1, summary=>'Case insensitive'}, | ||
| 29 | {str=>'foo.xz is the file', matches=>0, summary=>'Regex is anchored'}, | ||
| 30 | {str=>'foo.mp3', matches=>0}, | ||
| 31 | ], | ||
| 32 | }; | ||
| 33 | |||
| 34 | 1 | 1; | |
| 35 | # ABSTRACT: Compressed data filename | ||
| 36 | |||
| 37 | __END__ | ||