| 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
MC/DC0%0/2
ref $that || $that
ref $that
$that
Truth table0%0/3
A || B
A= ref $thatB= $that
| |||||||||||||||||||||
| 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__ | ||||||||||||||||||||