CAB/Format/Raw.pm

filter: Statementstmt 68.7% 22 / 32 Branchbran 0.0% 0 / 4 Conditioncond 20.0% 2 / 10 MC/DCmcdc 0.0% 0 / 4 Subroutinesub 70.0% 7 / 10 Podpod 100% 3 / 3 totaltotal 53.9% 34 / 63 CC 5 SCAR 24.4
CC
5
Cov
52%
new
30.0
mimeType
2.0
defaultExtension
2.0
CRAP 11.5
« CAB/Format/Raw/HTTP.pm ↑ Summary CAB/Analyzer/TextPhonetic.pm »
1 ## -*- Mode: CPerl -*-
2 ##
3 ## File: DTA::CAB::Format::Raw.pm
4 ## Author: Bryan Jurish <moocow@cpan.org>
5 ## Description: Datum parser: raw untokenized text (dispatch)
6  
7 package DTA::CAB::Format::Raw;
8 1 ▶use DTA::CAB::Format;
Subroutine BEGIN: called CC=1 SCAR=0.0
9 1 ▶use DTA::CAB::Datum ':all';
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use IO::File;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Encode qw(encode decode);
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Carp;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 ##==============================================================================
16 ## Globals
17 ##==============================================================================
18  
19 1 our @ISA = qw(DTA::CAB::Format);
20  
21 1 ▶BEGIN {
Subroutine BEGIN: called CC=1 SCAR=0.0
22 1 DTA::CAB::Format->registerFormat(name=>__PACKAGE__, filenameRegex=>qr/\.(?i:raw)$/);
23 }
24  
25 ## $DEFAULT_SUBCLASS : default subclass to use
26 our $DEFAULT_SUBCLASS = (
27 $ENV{DTA_CAB_FORMAT_RAW_DEFAULT_SUBCLASS}
28 1 ▶ || "DTA::CAB::Format::Raw::Waste"
Condition50%2/4
$ENV{'DTA_CAB_FORMAT_RAW_DEFAULT_SUBCLASS'} || 'DTA::CAB::Format::Raw::Waste' || 'DTA::CAB::Format::Raw::HTTP'
l!l
10
$ENV{"DTA_CAB_FORMAT_RAW_DEFAULT_SUBCLASS"} or "DTA::CAB::Format::Raw::Waste"
l!l
01
MC/DC0%0/1
$ENV{'DTA_CAB_FORMAT_RAW_DEFAULT_SUBCLASS'} || 'DTA::CAB::Format::Raw::Waste' || 'DTA::CAB::Format::Raw::HTTP'
$ENV{"DTA_CAB_FORMAT_RAW_DEFAULT_SUBCLASS"}
Truth table50%1/2
A
A= $ENV{"DTA_CAB_FORMAT_RAW_DEFAULT_SUBCLASS"}
Aresult
11
00
29 || "DTA::CAB::Format::Raw::HTTP"
30 );
31  
32 ##==============================================================================
33 ## Constructors etc.
34 ##==============================================================================
35  
36 ## $fmt = CLASS_OR_OBJ->new(%args)
37 ## + object structure: nothing here!
38 0 ▶sub new {
Subroutine new: not called CC=5 SCAR=34.0
Pod documented
39 0 my ($that,%args) = @_;
40 0 my $class = $args{class};
41 0 ▶ $class = $DEFAULT_SUBCLASS if (!$class && (ref($that)||$that) eq __PACKAGE__);
Branch: 1 branch
BranchTrueFalseTotal
if not $class and (ref $that || $that) eq __PACKAGE__ 0 0 0
Condition0%0/6
not $class and (ref $that || $that) eq __PACKAGE__
!ll&&!rl&&r
000
ref $that || $that
l!l&&r!l&&!r
000
MC/DC0%0/3
not $class and (ref $that || $that) eq __PACKAGE__
not $class ref $that $that
Truth table0%0/4
not(A) and B || C
A= not $classB= ref $thatC= $that
ABCresult
0XX0
1000
11X1
1011
42 0 ▶ if ($class) {
Branch: 1 branch
BranchTrueFalseTotal
if ($class) 0 0 0
43 0 $that = __PACKAGE__ . "::$class";
44 0 delete($args{class});
45 #__PACKAGE__->trace("new(): dispatching to $class");
46 0 return $class->new(%args);
47 }
48 0 return $that->SUPER::new(%args);
49 }
50  
51 ##==============================================================================
52 ## Methods: Output
53 ## (output not supported)
54 ##==============================================================================
55  
56 ##--------------------------------------------------------------
57 ## Methods: Output: Generic
58  
59 ## $type = $fmt->mimeType()
60 ## + default returns text/plain
61 0 ▶sub mimeType { return 'text/plain'; }
Subroutine mimeType: not called CC=1 SCAR=6.9
Pod documented
62  
63 ## $ext = $fmt->defaultExtension()
64 ## + returns default filename extension for this format
65 0 ▶sub defaultExtension { return '.raw'; }
Subroutine defaultExtension: not called CC=1 SCAR=6.9
Pod documented
66  
67 1 1; ##-- be happy
68  
69 __END__
« CAB/Format/Raw/HTTP.pm ↑ Summary CAB/Analyzer/TextPhonetic.pm »