File Coverage

blib/lib/re/engine/GNU.pm
Criterion Covered Total %
statement 27 28 96.4
branch 5 10 50.0
condition 2 6 33.3
subroutine 8 8 100.0
pod n/a
total 42 52 80.7


line stmt bran cond sub pod time code
1             package re::engine::GNU;
2 1     1   79456 use strict;
  1         14  
  1         31  
3 1     1   5 use warnings FATAL => 'all';
  1         1  
  1         30  
4 1     1   32 use 5.010000;
  1         3  
5 1     1   4 use XSLoader ();
  1         2  
  1         93  
6              
7             # ABSTRACT: GNU Regular Expression Engine
8              
9             our $AUTHORITY = 'cpan:JDDPAUSE'; # AUTHORITY
10              
11             # All engines should subclass the core Regexp package
12             our @ISA = 'Regexp';
13              
14             BEGIN {
15             #
16 1     1   4 our $VERSION = '0.027'; # VERSION
17             #
18             # Note that $VERSION is always defined when you use a distributed CPAN package.
19             # With old versions of perl, only the XSLoader::load(__PACKAGE__, $version) works.
20             # E.g. with perl-5.10, doing directly:
21             # make test
22             # within the repository may yell like this:
23             # Error: XSLoader::load('Your::Module', $Your::Module::VERSION)
24             # In this case, you can put the module version in the RE_ENGINE_GNU_VERSION
25             # environment variable, e.g.:
26             # RE_ENGINE_GNU_VERSION=0.026 make test
27             #
28 1   33     71 my $version = eval q{$VERSION} // $ENV{RE_ENGINE_GNU_VERSION}; ## no critic
29 1 50       808 defined($version) ? XSLoader::load(__PACKAGE__, $version) : XSLoader::load();
30             }
31              
32             {
33 1     1   7 no strict 'subs'; ## no critic
  1         2  
  1         703  
34             our $RE_SYNTAX_AWK = RE_SYNTAX_AWK;
35             our $RE_SYNTAX_ED = RE_SYNTAX_ED;
36             our $RE_SYNTAX_EGREP = RE_SYNTAX_EGREP;
37             our $RE_SYNTAX_EMACS = RE_SYNTAX_EMACS;
38             our $RE_SYNTAX_GNU_AWK = RE_SYNTAX_GNU_AWK;
39             our $RE_SYNTAX_GREP = RE_SYNTAX_GREP;
40             our $RE_SYNTAX_POSIX_AWK = RE_SYNTAX_POSIX_AWK;
41             our $RE_SYNTAX_POSIX_BASIC = RE_SYNTAX_POSIX_BASIC;
42             our $RE_SYNTAX_POSIX_EGREP = RE_SYNTAX_POSIX_EGREP;
43             our $RE_SYNTAX_POSIX_EXTENDED = RE_SYNTAX_POSIX_EXTENDED;
44             our $RE_SYNTAX_POSIX_MINIMAL_BASIC = RE_SYNTAX_POSIX_MINIMAL_BASIC;
45             our $RE_SYNTAX_POSIX_MINIMAL_EXTENDED = RE_SYNTAX_POSIX_MINIMAL_EXTENDED;
46             our $RE_SYNTAX_SED = RE_SYNTAX_SED;
47             #
48             # __USE_GNU specifics
49             #
50             our $RE_BACKSLASH_ESCAPE_IN_LISTS = RE_BACKSLASH_ESCAPE_IN_LISTS;
51             our $RE_BK_PLUS_QM = RE_BK_PLUS_QM;
52             our $RE_CHAR_CLASSES = RE_CHAR_CLASSES;
53             our $RE_CONTEXT_INDEP_ANCHORS = RE_CONTEXT_INDEP_ANCHORS;
54             our $RE_CONTEXT_INDEP_OPS = RE_CONTEXT_INDEP_OPS;
55             our $RE_CONTEXT_INVALID_OPS = RE_CONTEXT_INVALID_OPS;
56             our $RE_DOT_NEWLINE = RE_DOT_NEWLINE;
57             our $RE_DOT_NOT_NULL = RE_DOT_NOT_NULL;
58             our $RE_HAT_LISTS_NOT_NEWLINE = RE_HAT_LISTS_NOT_NEWLINE;
59             our $RE_INTERVALS = RE_INTERVALS;
60             our $RE_LIMITED_OPS = RE_LIMITED_OPS;
61             our $RE_NEWLINE_ALT = RE_NEWLINE_ALT;
62             our $RE_NO_BK_BRACES = RE_NO_BK_BRACES;
63             our $RE_NO_BK_PARENS = RE_NO_BK_PARENS;
64             our $RE_NO_BK_REFS = RE_NO_BK_REFS;
65             our $RE_NO_BK_VBAR = RE_NO_BK_VBAR;
66             our $RE_NO_EMPTY_RANGES = RE_NO_EMPTY_RANGES;
67             our $RE_UNMATCHED_RIGHT_PAREN_ORD = RE_UNMATCHED_RIGHT_PAREN_ORD;
68             our $RE_NO_POSIX_BACKTRACKING = RE_NO_POSIX_BACKTRACKING;
69             our $RE_NO_GNU_OPS = RE_NO_GNU_OPS;
70             our $RE_DEBUG = RE_DEBUG;
71             our $RE_INVALID_INTERVAL_ORD = RE_INVALID_INTERVAL_ORD;
72             our $RE_ICASE = RE_ICASE;
73             our $RE_CARET_ANCHORS_HERE = RE_CARET_ANCHORS_HERE;
74             our $RE_CONTEXT_INVALID_DUP = RE_CONTEXT_INVALID_DUP;
75             our $RE_NO_SUB = RE_NO_SUB;
76             }
77              
78             sub import {
79 6     6   873 my $class = shift;
80              
81 6         27 $^H{regcomp} = ENGINE;
82              
83 6 50       21 if (@_) {
84 6         33 my %args = @_;
85 6 50       14 if ( exists $args{'-debug'} ) {
86 6         19 $^H{ __PACKAGE__ . '/debug' } = $args{'-debug'};
87             }
88 6 50       1051 if ( exists $args{'-syntax'} ) {
89 0         0 $^H{ __PACKAGE__ . '/syntax' } = $args{'-syntax'};
90             }
91             }
92              
93             }
94              
95             sub unimport {
96 6     6   48 my $class = shift;
97              
98 6 50 33     44 if ( exists( $^H{regcomp} ) && $^H{regcomp} == ENGINE ) {
99 6         2073 delete( $^H{regcomp} );
100             }
101              
102             }
103              
104             1;
105              
106             __END__