File Coverage

blib/lib/re/engine/TRE.pm
Criterion Covered Total %
statement 27 27 100.0
branch 7 8 87.5
condition n/a
subroutine 9 9 100.0
pod n/a
total 43 44 97.7


line stmt bran cond sub pod time code
1             package re::engine::TRE;
2             # ABSTRACT: TRE regular expression engine
3              
4              
5 11     11   304808 use strict;
  11         31  
  11         483  
6 11     11   11391 use utf8;
  11         101  
  11         58  
7 11     11   1081 use warnings qw(all);
  11         19  
  11         442  
8              
9 11     11   289 use 5.010000;
  11         37  
  11         433  
10 11     11   66 use Scalar::Util qw(looks_like_number);
  11         29  
  11         1637  
11 11     11   62 use XSLoader ();
  11         21  
  11         871  
12              
13             # All engines should subclass the core Regexp package
14             our @ISA = 'Regexp';
15              
16             BEGIN {
17 11     11   25 our $VERSION = '0.09'; # VERSION
18 11         17237 XSLoader::load __PACKAGE__, $VERSION;
19             }
20              
21              
22             sub import {
23 18     18   2263 shift;
24              
25 18         111 $^H{regcomp} = ENGINE;
26              
27 18 100       22079 if (@_) {
28 7         20 my %args = @_;
29 56 100       3080 $^H{__PACKAGE__ . '::' . $_} =
30             $args{$_} < 0
31             ? 0x7fff
32             : int($args{$_})
33 7 100       11 for grep {
34             exists $args{$_}
35             and looks_like_number($args{$_})
36             } qw(
37             cost_ins
38             cost_del
39             cost_subst
40             max_cost
41             max_ins
42             max_del
43             max_subst
44             max_err
45             );
46             }
47             }
48              
49             sub unimport {
50 1 50   1   1924 delete $^H{regcomp}
51             if $^H{regcomp} == ENGINE;
52             }
53              
54             1;
55              
56             __END__