File Coverage

blib/lib/re/engine/GNU.pm
Criterion Covered Total %
statement 27 28 96.4
branch 5 10 50.0
condition 1 3 33.3
subroutine 8 8 100.0
pod n/a
total 41 49 83.6


line stmt bran cond sub pod time code
1             package re::engine::GNU;
2 1     1   81173 use strict;
  1         11  
  1         34  
3 1     1   5 use warnings FATAL => 'all';
  1         2  
  1         30  
4 1     1   26 use 5.010000;
  1         4  
5 1     1   6 use XSLoader ();
  1         2  
  1         115  
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.026'; # TRIAL VERSION
17             #
18             # Note that $VERSION is always defined when you use a distributed CPAN package.
19             #
20 1         57 my $version = eval q{$VERSION}; ## no critic
21 1 50       795 defined($version) ? XSLoader::load(__PACKAGE__, $version) : XSLoader::load();
22             }
23              
24             {
25 1     1   9 no strict 'subs'; ## no critic
  1         1  
  1         732  
26             our $RE_SYNTAX_AWK = RE_SYNTAX_AWK;
27             our $RE_SYNTAX_ED = RE_SYNTAX_ED;
28             our $RE_SYNTAX_EGREP = RE_SYNTAX_EGREP;
29             our $RE_SYNTAX_EMACS = RE_SYNTAX_EMACS;
30             our $RE_SYNTAX_GNU_AWK = RE_SYNTAX_GNU_AWK;
31             our $RE_SYNTAX_GREP = RE_SYNTAX_GREP;
32             our $RE_SYNTAX_POSIX_AWK = RE_SYNTAX_POSIX_AWK;
33             our $RE_SYNTAX_POSIX_BASIC = RE_SYNTAX_POSIX_BASIC;
34             our $RE_SYNTAX_POSIX_EGREP = RE_SYNTAX_POSIX_EGREP;
35             our $RE_SYNTAX_POSIX_EXTENDED = RE_SYNTAX_POSIX_EXTENDED;
36             our $RE_SYNTAX_POSIX_MINIMAL_BASIC = RE_SYNTAX_POSIX_MINIMAL_BASIC;
37             our $RE_SYNTAX_POSIX_MINIMAL_EXTENDED = RE_SYNTAX_POSIX_MINIMAL_EXTENDED;
38             our $RE_SYNTAX_SED = RE_SYNTAX_SED;
39             #
40             # __USE_GNU specifics
41             #
42             our $RE_BACKSLASH_ESCAPE_IN_LISTS = RE_BACKSLASH_ESCAPE_IN_LISTS;
43             our $RE_BK_PLUS_QM = RE_BK_PLUS_QM;
44             our $RE_CHAR_CLASSES = RE_CHAR_CLASSES;
45             our $RE_CONTEXT_INDEP_ANCHORS = RE_CONTEXT_INDEP_ANCHORS;
46             our $RE_CONTEXT_INDEP_OPS = RE_CONTEXT_INDEP_OPS;
47             our $RE_CONTEXT_INVALID_OPS = RE_CONTEXT_INVALID_OPS;
48             our $RE_DOT_NEWLINE = RE_DOT_NEWLINE;
49             our $RE_DOT_NOT_NULL = RE_DOT_NOT_NULL;
50             our $RE_HAT_LISTS_NOT_NEWLINE = RE_HAT_LISTS_NOT_NEWLINE;
51             our $RE_INTERVALS = RE_INTERVALS;
52             our $RE_LIMITED_OPS = RE_LIMITED_OPS;
53             our $RE_NEWLINE_ALT = RE_NEWLINE_ALT;
54             our $RE_NO_BK_BRACES = RE_NO_BK_BRACES;
55             our $RE_NO_BK_PARENS = RE_NO_BK_PARENS;
56             our $RE_NO_BK_REFS = RE_NO_BK_REFS;
57             our $RE_NO_BK_VBAR = RE_NO_BK_VBAR;
58             our $RE_NO_EMPTY_RANGES = RE_NO_EMPTY_RANGES;
59             our $RE_UNMATCHED_RIGHT_PAREN_ORD = RE_UNMATCHED_RIGHT_PAREN_ORD;
60             our $RE_NO_POSIX_BACKTRACKING = RE_NO_POSIX_BACKTRACKING;
61             our $RE_NO_GNU_OPS = RE_NO_GNU_OPS;
62             our $RE_DEBUG = RE_DEBUG;
63             our $RE_INVALID_INTERVAL_ORD = RE_INVALID_INTERVAL_ORD;
64             our $RE_ICASE = RE_ICASE;
65             our $RE_CARET_ANCHORS_HERE = RE_CARET_ANCHORS_HERE;
66             our $RE_CONTEXT_INVALID_DUP = RE_CONTEXT_INVALID_DUP;
67             our $RE_NO_SUB = RE_NO_SUB;
68             }
69              
70             sub import {
71 6     6   843 my $class = shift;
72              
73 6         39 $^H{regcomp} = ENGINE;
74              
75 6 50       19 if (@_) {
76 6         24 my %args = @_;
77 6 50       14 if ( exists $args{'-debug'} ) {
78 6         19 $^H{ __PACKAGE__ . '/debug' } = $args{'-debug'};
79             }
80 6 50       1086 if ( exists $args{'-syntax'} ) {
81 0         0 $^H{ __PACKAGE__ . '/syntax' } = $args{'-syntax'};
82             }
83             }
84              
85             }
86              
87             sub unimport {
88 6     6   50 my $class = shift;
89              
90 6 50 33     47 if ( exists( $^H{regcomp} ) && $^H{regcomp} == ENGINE ) {
91 6         1893 delete( $^H{regcomp} );
92             }
93              
94             }
95              
96             1;
97              
98             __END__