| 1 | package Pipe::Tube::Csv; | ||||||||||||||||||||||||||||
| 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 | |||||||||||||||||||||||||||||
| 5 | 1 | our $VERSION = '0.05'; | |||||||||||||||||||||||||||
| 6 | |||||||||||||||||||||||||||||
| 7 | 1 | ▶ | use base 'Pipe::Tube'; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | 1 | ▶ | use Text::CSV; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 9 | 1 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||
| 12 | 1 | ▶ | sub init { | ||||||||||||||||||||||||||
|
Subroutine
init: called CC=4 SCAR=15.0
Pod
undocumented
| |||||||||||||||||||||||||||||
| 13 | 1 | my ($self, $attr) = @_; | |||||||||||||||||||||||||||
| 14 | 1 | ▶ | die "First paramater of csv should be HASH reference or nothing" if $attr and ref $attr ne 'HASH'; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$attr and ref $attr ne "HASH"
MC/DC0%0/2
$attr and ref $attr ne "HASH"
$attr
ref $attr ne "HASH"
Truth table33%1/3
A and B
A= $attrB= ref $attr ne "HASH"
| |||||||||||||||||||||||||||||
| 15 | 1 | ▶ | $attr ||= {}; | ||||||||||||||||||||||||||
|
Condition50%1/2
$attr ||= {}
MC/DC0%0/1
$attr ||= {}
$attr
Truth table50%1/2
A
A= $attr
| |||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | 1 | $self->logger("Receiving Csv definition: " . Dumper $attr); | |||||||||||||||||||||||||||
| 18 | |||||||||||||||||||||||||||||
| 19 | 1 | $self->{csv} = Text::CSV->new($attr); | |||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 1 | return $self; | |||||||||||||||||||||||||||
| 22 | } | ||||||||||||||||||||||||||||
| 23 | |||||||||||||||||||||||||||||
| 24 | 4 | ▶ | sub run { | ||||||||||||||||||||||||||
|
Subroutine
run: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||
| 25 | 4 | my ($self, @input) = @_; | |||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||
| 27 | 4 | my @resp; | |||||||||||||||||||||||||||
| 28 | 4 | foreach my $line (@input) { | |||||||||||||||||||||||||||
| 29 | 2 | $self->{csv}->parse($line); | |||||||||||||||||||||||||||
| 30 | 2 | push @resp, [ $self->{csv}->fields ]; | |||||||||||||||||||||||||||
| 31 | } | ||||||||||||||||||||||||||||
| 32 | 4 | return @resp; | |||||||||||||||||||||||||||
| 33 | } | ||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||
| 35 | 1 | 1; | |||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | __END__ | ||||||||||||||||||||||||||||