blib/lib/DDC/Format/Raw.pm

filter: Statementstmt 61.1% 11 / 18 Branchbran n/a Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 50.0% 3 / 6 Podpod 100% 3 / 3 totaltotal 53.1% 17 / 32 CC 2 SCAR 10.0
CC
2
Cov
52%
new
6.0
hitString
2.0
toString
2.0
CRAP 2.7
« blib/lib/DDC/PP/CQFilter.pm ↑ Summary blib/lib/DDC/Format/YAML.pm »
1 ##-*- Mode: CPerl -*-
2  
3 ## File: DDC::Format::Raw.pm
4 ## Author: Bryan Jurish <moocow@cpan.org>
5 ## Description:
6 ## + DDC Query utilities: output formatting: Data::Raw
7 ##======================================================================
8  
9 package DDC::Format::Raw;
10 26 ▶use IO::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 26 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 26 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
13  
14 ##======================================================================
15 ## Globals
16 26 our @ISA = qw(DDC::Format);
17  
18 ##======================================================================
19 ## Constructors, etc.
20  
21 ## $fmt = $CLASS_OR_OBJ->new(%args)
22 ## + %args:
23 ## (
24 ## hitSeparator => $sep, ##-- raw hit separator (default="\n\n")
25 ## )
26 0 ▶sub new {
Subroutine new: not called CC=2 SCAR=17.9
Pod documented
27 0 my $that = shift;
28 0 ▶ my $fmt = bless {
Condition0%0/3
ref $that || $that
l!l&&r!l&&!r
000
MC/DC0%0/2
ref $that || $that
ref $that $that
Truth table0%0/3
A || B
A= ref $thatB= $that
ABresult
1X1
011
000
29 hitSeparator => "\n\n",
30 @_
31 }, ref($that)||$that;
32 0 return $fmt;
33 }
34  
35 ## $fmt = $fmt->reset()
36 ## + reset counters, etc.
37 #sub reset {
38 # return $_[0]->SUPER::reset();
39 #}
40  
41 ##======================================================================
42 ## Helper functions
43  
44 ## $hitStr = $fmt->hitString($hit)
45 ## + increments $fmt->{start}
46 0 ▶sub hitString {
Subroutine hitString: not called CC=1 SCAR=6.9
Pod documented
47 0 return $_[1]{$_[0]{raw}};
48 }
49  
50 ##======================================================================
51 ## API
52  
53 ## $str = $fmt->toString(\@hits)
54 0 ▶sub toString {
Subroutine toString: not called CC=1 SCAR=6.9
Pod documented
55 0 return join('',map {$_->{raw}.$_[0]{hitSeparator}} @{$_[1]->{hits_}});
56 }
57  
58 26 1; ##-- be happy
59  
60 __END__
« blib/lib/DDC/PP/CQFilter.pm ↑ Summary blib/lib/DDC/Format/YAML.pm »