| 1 | package Regexp::Pattern::Perl::Module; | ||
| 2 | |||
| 3 | 1 | ▶ | use strict; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | #use warnings; | ||
| 5 | |||
| 6 | 1 | our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY | |
| 7 | 1 | our $DATE = '2022-07-30'; # DATE | |
| 8 | 1 | our $DIST = 'Regexp-Pattern-Perl'; # DIST | |
| 9 | 1 | our $VERSION = '0.007'; # VERSION | |
| 10 | |||
| 11 | 1 | our %RE = ( | |
| 12 | perl_modname => { | ||
| 13 | summary => 'Perl module name e.g. Foo::Bar', | ||
| 14 | pat => '[A-Za-z_][A-Za-z_0-9]*(::[A-Za-z_0-9]+)*', | ||
| 15 | examples => [ | ||
| 16 | {str=>'', anchor=>1, matches=>0}, | ||
| 17 | {str=>'Foo::Bar', anchor=>1, matches=>1}, | ||
| 18 | {str=>'Foo::0Bar', anchor=>1, matches=>1}, | ||
| 19 | {str=>'0Foo::Bar', anchor=>1, matches=>0}, | ||
| 20 | {str=>'Foo/Bar', anchor=>1, matches=>0}, | ||
| 21 | ], | ||
| 22 | }, | ||
| 23 | perl_modname_pm => { | ||
| 24 | summary => 'Perl module name in Foo/Bar.pm', | ||
| 25 | pat => '[A-Za-z_][A-Za-z_0-9]*(/[A-Za-z_0-9]+)*\.pm', | ||
| 26 | examples => [ | ||
| 27 | {str=>'', anchor=>1, matches=>0}, | ||
| 28 | {str=>'Foo/Bar.pm', anchor=>1, matches=>1}, | ||
| 29 | {str=>'Foo/0Bar.pm', anchor=>1, matches=>1}, | ||
| 30 | {str=>'0Foo/Bar.pm', anchor=>1, matches=>0}, | ||
| 31 | {str=>'Foo/Bar', anchor=>1, matches=>0}, | ||
| 32 | {str=>'Foo::Bar', anchor=>1, matches=>0}, | ||
| 33 | ], | ||
| 34 | }, | ||
| 35 | perl_modname_with_optional_args => { | ||
| 36 | pat => '[A-Za-z_][A-Za-z_0-9]*(::[A-Za-z_0-9]+)*(?:=.*)?', | ||
| 37 | examples => [ | ||
| 38 | {str=>'', anchor=>1, matches=>0}, | ||
| 39 | {str=>'Foo::Bar', anchor=>1, matches=>1}, | ||
| 40 | {str=>'Foo::0Bar', anchor=>1, matches=>1}, | ||
| 41 | {str=>'0Foo::Bar', anchor=>1, matches=>0}, | ||
| 42 | {str=>'Foo/Bar', anchor=>1, matches=>0}, | ||
| 43 | |||
| 44 | {str=>'Foo::Bar=', anchor=>1, matches=>1}, | ||
| 45 | {str=>'Foo::Bar=a', anchor=>1, matches=>1}, | ||
| 46 | {str=>'Foo::Bar=a,b,c', anchor=>1, matches=>1}, | ||
| 47 | {str=>'Foo::Bar=a=1', anchor=>1, matches=>1}, | ||
| 48 | {str=>'=Foo::Bar', anchor=>1, matches=>0}, | ||
| 49 | ], | ||
| 50 | }, | ||
| 51 | ); | ||
| 52 | |||
| 53 | 1 | 1; | |
| 54 | # ABSTRACT: Regexp patterns related to Perl modules | ||
| 55 | |||
| 56 | __END__ | ||