| 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'
$ENV{"DTA_CAB_FORMAT_RAW_DEFAULT_SUBCLASS"} or "DTA::CAB::Format::Raw::Waste"
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"}
| |||||||||||||||||||||||||||||||||||||||||||
| 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
Condition0%0/6
not $class and (ref $that || $that) eq __PACKAGE__
ref $that || $that
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
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | 0 | ▶ | if ($class) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 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__ | ||||||||||||||||||||||||||||||||||||||||||