Pgtools/Fingerprint.pm

filter: Statementstmt 58.0% 18 / 31 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 71.4% 5 / 7 Podpod 0.0% 0 / 3 totaltotal 48.9% 23 / 47 CC 4 SCAR 21.6
CC
4
Cov
49%
exec
20.0
print_queries
2.0
BEGIN
1.0
CRAP 8.7
« Pgtools/Kill.pm ↑ Summary Pgtools/Connection.pm »
1 package Pgtools::Fingerprint;
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use parent qw(Class::Accessor);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 __PACKAGE__->mk_accessors(qw(file query));
6  
7 1 ▶use File::Spec;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 0 ▶sub exec {
Subroutine exec: not called CC=4 SCAR=30.0
Pod undocumented
10 0 my ($self, $query, $filename) = @_;
11  
12 0 ▶ if($query ne "") {
Branch: 1 branch
BranchTrueFalseTotal
if ($query ne "") 0 0 0
13 0 $query = &symbolize_query($self, $query);
14 0 &print_queries($self, $query);
15 0 return;
16 }
17 0 $filename = File::Spec->rel2abs($filename);
18  
19 0 ▶ open(my $in, '<', $filename) or die "$!";
Branch: 1 branch
BranchTrueFalseTotal
open my $in, "<", $filename or die "$!" 0 0 0
20 0 ▶ while(<$in>) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined($_ = readline $in)) 0 0 0
21 0 chomp $_;
22 0 $_ = &symbolize_query($self, $_);
23 0 &print_queries($self, $_);
24 }
25 }
26  
27 8 ▶sub symbolize_query {
Subroutine symbolize_query: called CC=1 SCAR=0.0
Pod undocumented
28 8 my ($self, $q) = @_;
29 8 $q =~ s/([\s<>=])([-\+])?[.0123456789]+/$1?/g;
30 8 $q =~ s/(true|false)/?/ig;
31  
32 8 return $q;
33 }
34  
35 0 ▶sub print_queries {
Subroutine print_queries: not called CC=1 SCAR=6.9
Pod undocumented
36 0 my ($self, $query) = @_;
37 0 print $query."\n";
38 }
39  
40 1 1;
41  
« Pgtools/Kill.pm ↑ Summary Pgtools/Connection.pm »