lib/TSQL/grepTSQL.pl untested

filter: Statementstmt 0.0% 0 / 39 Branchbran 0.0% 0 / 4 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 7 Podpod n/a totaltotal 0.0% 0 / 50 CC 1 SCAR 6.9
CC
1
Cov
0%
BEGIN
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 #!/bin/perl
2  
3 use Modern::Perl;
4  
5 use autodie qw(:all);
6 no indirect ':fatal';
7  
8 use Data::Dump 'pp';
9 use Getopt::Euclid qw( :vars<opt_> );
10  
11 use TSQL::SplitStatement;
12  
13 use version ; our $VERSION = qv('1.0.0');
14  
15 my @re = @opt_regexp ;
16 my @exre = @opt_ex_regexp ;
17  
18 my $s = do { local $/ = undef; <> ;} ;
19  
20 my $parser = TSQL::SplitStatement->new();
21 my @parsedInput = $parser->splitSQL($s);
22  
23 STATEMENT: foreach my $statement (@parsedInput) {
24 foreach my $re (@re) {
25 my $qr_re = qr{$re} ;
26 if ( $statement =~ m/$qr_re/imsg ) {
27 foreach my $exre (@exre) {
28 my $qr_exre = qr{$exre} ;
29 if ( $statement =~ m/$qr_exre/imsg ) {
30 next STATEMENT;
31 }
32 }
33 say $statement;
34 next STATEMENT;
35 }
36 }
37 }
38  
39  
40  
41 __DATA__