| 1 | ######################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 2 | package AnyData::Storage::RAM; | ||||||||||||||||||||||||||||||||||||||||||
| 3 | ######################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 4 | # | ||||||||||||||||||||||||||||||||||||||||||
| 5 | # This module is copyright (c), 2000 by Jeff Zucker | ||||||||||||||||||||||||||||||||||||||||||
| 6 | # All rights reserved. | ||||||||||||||||||||||||||||||||||||||||||
| 7 | # | ||||||||||||||||||||||||||||||||||||||||||
| 8 | ######################################################################### | ||||||||||||||||||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||||||||||||||||
| 10 | 3 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | 3 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 12 | |||||||||||||||||||||||||||||||||||||||||||
| 13 | 3 | ▶ | use vars qw($VERSION $DEBUG); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 3 | $VERSION = '0.12'; | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | 3 | $DEBUG = 1; | |||||||||||||||||||||||||||||||||||||||||
| 18 | 3 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | 3 | ▶ | use AnyData::Storage::File; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||||||||||||||||
| 21 | 9 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=7.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 22 | 9 | my $class = shift; | |||||||||||||||||||||||||||||||||||||||||
| 23 | 9 | ▶ | my $self = shift || {}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || {}
MC/DC0%0/1
shift() || {}
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 24 | 9 | return bless $self, $class; | |||||||||||||||||||||||||||||||||||||||||
| 25 | } | ||||||||||||||||||||||||||||||||||||||||||
| 26 | |||||||||||||||||||||||||||||||||||||||||||
| 27 | ######## | ||||||||||||||||||||||||||||||||||||||||||
| 28 | # MOVE set_col_nums and open_table to Storage/Base.pm | ||||||||||||||||||||||||||||||||||||||||||
| 29 | # | ||||||||||||||||||||||||||||||||||||||||||
| 30 | # ALSO make DBD::AnyData::Statement and DBD::Table simple @ISA for AnyData | ||||||||||||||||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||||||||||||||||
| 32 | 9 | ▶ | sub set_col_nums { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
set_col_nums: called CC=6 SCAR=18.1
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 33 | 9 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 34 | 9 | my $col_names = $self->{col_names}; | |||||||||||||||||||||||||||||||||||||||||
| 35 | 9 | ▶ | return {} unless $col_names ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | 7 | ▶ | return {} unless ref $col_names eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 37 | 7 | ▶ | return {} unless scalar @$col_names; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 38 | 7 | my $col_nums={}; my $i=0; | |||||||||||||||||||||||||||||||||||||||||
| 39 | 7 | ▶ | for (@$col_names) { next unless $_; $col_nums->{$_} = $i; $i++; } | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | #use Data::Dumper; die Dumper $col_names; | ||||||||||||||||||||||||||||||||||||||||||
| 41 | 7 | $self->{col_nums}=$col_nums; | |||||||||||||||||||||||||||||||||||||||||
| 42 | 7 | return $col_nums; | |||||||||||||||||||||||||||||||||||||||||
| 43 | } | ||||||||||||||||||||||||||||||||||||||||||
| 44 | 9 | ▶ | sub open_table { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
open_table: called CC=45 SCAR=51.7
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 9 | my( $self, $parser, $file, $read_mode, $data ) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 46 | 9 | ▶ | $data = $self->{recs} if $self->{recs}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | #$data ||= $parser->{recs}; | ||||||||||||||||||||||||||||||||||||||||||
| 48 | #$data = $file if ref $file eq 'ARRAY' and !$data; | ||||||||||||||||||||||||||||||||||||||||||
| 49 | #use Data::Dumper; print Dumper $data; | ||||||||||||||||||||||||||||||||||||||||||
| 50 | #print ref $parser; | ||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 9 | my $rec_sep = $parser->{record_sep};# || "\n"; | |||||||||||||||||||||||||||||||||||||||||
| 53 | 9 | my $table_ary = []; | |||||||||||||||||||||||||||||||||||||||||
| 54 | 9 | ▶ | my $col_names = $parser->{col_names} || $self->{col_names}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition66%2/3
$parser->{'col_names'} || $self->{'col_names'}
MC/DC50%1/2
$parser->{'col_names'} || $self->{'col_names'}
$parser->{'col_names'}
$self->{'col_names'}
Truth table66%2/3
A || B
A= $parser->{'col_names'}B= $self->{'col_names'}
| |||||||||||||||||||||||||||||||||||||||||||
| 55 | 9 | my $cols_supplied = $col_names; | |||||||||||||||||||||||||||||||||||||||||
| 56 | 9 | ▶ | my $url = $file if $file =~ m"^http://|^ftp://"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 57 | 9 | ▶ | $self->{open_mode} = $read_mode || 'r'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
$read_mode || 'r'
MC/DC0%0/1
$read_mode || 'r'
$read_mode
Truth table50%1/2
A
A= $read_mode
| |||||||||||||||||||||||||||||||||||||||||||
| 58 | |||||||||||||||||||||||||||||||||||||||||||
| 59 | 9 | my $data_type; | |||||||||||||||||||||||||||||||||||||||||
| 60 | 9 | ▶ | $data_type='ARY-ARY' if ref $data eq 'ARRAY' and ref $data->[0] eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $data eq "ARRAY" and ref $data->[0] eq "ARRAY"
MC/DC0%0/2
ref $data eq "ARRAY" and ref $data->[0] eq "ARRAY"
ref $data eq "ARRAY"
ref $data->[0] eq "ARRAY"
Truth table66%2/3
A and B
A= ref $data eq "ARRAY"B= ref $data->[0] eq "ARRAY"
| |||||||||||||||||||||||||||||||||||||||||||
| 61 | 9 | ▶ | $data_type='ARY-HSH' if ref $data eq 'ARRAY' and ref $data->[0] eq 'HASH'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $data eq "ARRAY" and ref $data->[0] eq "HASH"
MC/DC0%0/2
ref $data eq "ARRAY" and ref $data->[0] eq "HASH"
ref $data eq "ARRAY"
ref $data->[0] eq "HASH"
Truth table66%2/3
A and B
A= ref $data eq "ARRAY"B= ref $data->[0] eq "HASH"
| |||||||||||||||||||||||||||||||||||||||||||
| 62 | 9 | ▶ | $data_type='ARY-STR' if ref $data eq 'ARRAY' and !$data_type; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%2/3
ref $data eq "ARRAY" and not $data_type
MC/DC50%1/2
ref $data eq "ARRAY" and not $data_type
ref $data eq "ARRAY"
not $data_type
Truth table66%2/3
A and not(B)
A= ref $data eq "ARRAY"B= not $data_type
| |||||||||||||||||||||||||||||||||||||||||||
| 63 | 9 | ▶ | $data_type ||= 'STR'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$data_type ||= "STR"
MC/DC100%1/1
$data_type ||= "STR"
$data_type
Truth table100%2/2
A
A= $data_type
| |||||||||||||||||||||||||||||||||||||||||||
| 64 | # print "[$data_type]" . ref $data if $data; | ||||||||||||||||||||||||||||||||||||||||||
| 65 | # MP3 and ARRAY | ||||||||||||||||||||||||||||||||||||||||||
| 66 | 9 | ▶ | if ( $self->{records} && !$data ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
Condition33%1/3
$self->{"records"} and not $data
MC/DC0%0/2
$self->{"records"} and not $data
$self->{"records"}
not $data
Truth table33%1/3
A and not(B)
A= $self->{"records"}B= not $data
| |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | $table_ary = $self->{records}; | |||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | $col_names ||= shift @$table_ary; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$col_names ||= shift @$table_ary
MC/DC0%0/2
$col_names ||= shift @$table_ary
$col_names
shift @$table_ary
Truth table0%0/3
A ||= B
A= $col_namesB= shift @$table_ary
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | } | ||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | # REMOTE | ||||||||||||||||||||||||||||||||||||||||||
| 72 | elsif ( $data ) { | ||||||||||||||||||||||||||||||||||||||||||
| 73 | 3 | ▶ | if ($parser->{slurp_mode}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 74 | 0 | ($table_ary,$col_names) = $parser->import($data,$self); | |||||||||||||||||||||||||||||||||||||||||
| 75 | 0 | ▶ | shift @$table_ary if (ref $parser) =~ /HTMLtable/ && $url && $cols_supplied; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/6
ref($parser) =~ /HTMLtable/ and $url and $cols_supplied
ref($parser) =~ /HTMLtable/ and $url
MC/DC0%0/3
ref($parser) =~ /HTMLtable/ and $url and $cols_supplied
ref($parser) =~ /HTMLtable/
$url
$cols_supplied
Truth table0%0/4
A and B and C
A= ref($parser) =~ /HTMLtable/B= $urlC= $cols_supplied
| |||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 78 | 3 | ▶ | if ($data_type eq 'ARY-STR') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 79 | 1 | $data = join '', @$data; | |||||||||||||||||||||||||||||||||||||||||
| 80 | } | ||||||||||||||||||||||||||||||||||||||||||
| 81 | 3 | ▶ | if ($data_type eq 'ARY-ARY') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 82 | 0 | $table_ary = $data; | |||||||||||||||||||||||||||||||||||||||||
| 83 | } | ||||||||||||||||||||||||||||||||||||||||||
| 84 | elsif ($data_type eq 'ARY-HSH') { | ||||||||||||||||||||||||||||||||||||||||||
| 85 | 0 | print "IMPORT OF HASHES NOT YET IMPLEMENTED!\n"; exit; | |||||||||||||||||||||||||||||||||||||||||
| 86 | } | ||||||||||||||||||||||||||||||||||||||||||
| 87 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 88 | 3 | $data =~ s/\015$//gsm; # ^M = CR from DOS | |||||||||||||||||||||||||||||||||||||||||
| 89 | #use Data::Dumper; print Dumper $data; | ||||||||||||||||||||||||||||||||||||||||||
| 90 | 3 | my @tmp = split /$rec_sep/, $data; | |||||||||||||||||||||||||||||||||||||||||
| 91 | #use Data::Dumper; print ref $parser, Dumper \@tmp; | ||||||||||||||||||||||||||||||||||||||||||
| 92 | 3 | ▶ | if ((ref $parser) =~ /Fixed/ && (!$col_names or !scalar @$col_names)) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition16%1/6
ref($parser) =~ /Fixed/ and not $col_names && scalar @$col_names
$col_names && scalar @$col_names
MC/DC0%0/3
ref($parser) =~ /Fixed/ and not $col_names && scalar @$col_names
ref($parser) =~ /Fixed/
$col_names
scalar @$col_names
Truth table25%1/4
A and not(B && C)
A= ref($parser) =~ /Fixed/B= $col_namesC= scalar @$col_names
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | my $colstr = shift @tmp; | |||||||||||||||||||||||||||||||||||||||||
| 94 | # $colstr =~ s/\015$//g; # ^M = CR from DOS | ||||||||||||||||||||||||||||||||||||||||||
| 95 | 0 | @$col_names = split ',',$colstr; | |||||||||||||||||||||||||||||||||||||||||
| 96 | } | ||||||||||||||||||||||||||||||||||||||||||
| 97 | 3 | ▶ | if ((ref $parser) =~ /Paragraph/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 98 | 0 | my $colstr = shift @tmp; | |||||||||||||||||||||||||||||||||||||||||
| 99 | 0 | @$col_names = $parser->read_fields($colstr); | |||||||||||||||||||||||||||||||||||||||||
| 100 | #print "@$col_names"; | ||||||||||||||||||||||||||||||||||||||||||
| 101 | } | ||||||||||||||||||||||||||||||||||||||||||
| 102 | 3 | for my $line( @tmp ) { | |||||||||||||||||||||||||||||||||||||||||
| 103 | # for (split /$rec_sep/, $data) { | ||||||||||||||||||||||||||||||||||||||||||
| 104 | # s/\015$//g; # ^M = CR from DOS | ||||||||||||||||||||||||||||||||||||||||||
| 105 | 14 | ▶ | next if $parser->{skip_pattern} and $line =~ $parser->{skip_pattern}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$parser->{"skip_pattern"} and $line =~ /$parser->{"skip_pattern"}/
MC/DC0%0/2
$parser->{"skip_pattern"} and $line =~ /$parser->{"skip_pattern"}/
$parser->{"skip_pattern"}
$line =~ /$parser->{"skip_pattern"}/
Truth table33%1/3
A and B
A= $parser->{"skip_pattern"}B= $line =~ /$parser->{"skip_pattern"}/
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 14 | my @row = $parser->read_fields($line); | |||||||||||||||||||||||||||||||||||||||||
| 107 | #print $_; | ||||||||||||||||||||||||||||||||||||||||||
| 108 | #use Data::Dumper; print Dumper \@row; | ||||||||||||||||||||||||||||||||||||||||||
| 109 | ###z MOD | ||||||||||||||||||||||||||||||||||||||||||
| 110 | # next unless scalar @row; | ||||||||||||||||||||||||||||||||||||||||||
| 111 | # push @$table_ary, \@row; | ||||||||||||||||||||||||||||||||||||||||||
| 112 | 14 | push @$table_ary, \@row | |||||||||||||||||||||||||||||||||||||||||
| 113 | # unless $parser->{skip_mark} | ||||||||||||||||||||||||||||||||||||||||||
| 114 | # and $row[0] eq $parser->{skip_mark}; | ||||||||||||||||||||||||||||||||||||||||||
| 115 | # | ||||||||||||||||||||||||||||||||||||||||||
| 116 | } | ||||||||||||||||||||||||||||||||||||||||||
| 117 | } | ||||||||||||||||||||||||||||||||||||||||||
| 118 | 3 | ▶ | if ((ref $parser) !~ /Fixed|Paragraph/ | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
ref($parser) =~ /Fixed|Paragraph/ or $parser->{"keep_first_line"} or $parser->{"col_names"}
ref($parser) =~ /Fixed|Paragraph/ or $parser->{"keep_first_line"}
MC/DC33%1/3
ref($parser) =~ /Fixed|Paragraph/ or $parser->{"keep_first_line"} or $parser->{"col_names"}
ref($parser) =~ /Fixed|Paragraph/
$parser->{"keep_first_line"}
$parser->{"col_names"}
Truth table50%2/4
A or B or C
A= ref($parser) =~ /Fixed|Paragraph/B= $parser->{"keep_first_line"}C= $parser->{"col_names"}
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | && !$parser->{keep_first_line} | ||||||||||||||||||||||||||||||||||||||||||
| 120 | && !$parser->{col_names} | ||||||||||||||||||||||||||||||||||||||||||
| 121 | ) { | ||||||||||||||||||||||||||||||||||||||||||
| 122 | 2 | $col_names = shift @$table_ary; | |||||||||||||||||||||||||||||||||||||||||
| 123 | } | ||||||||||||||||||||||||||||||||||||||||||
| 124 | #use Data::Dumper; die Dumper $table_ary; | ||||||||||||||||||||||||||||||||||||||||||
| 125 | } | ||||||||||||||||||||||||||||||||||||||||||
| 126 | } | ||||||||||||||||||||||||||||||||||||||||||
| 127 | # if ($file and !(ref $file eq 'ARRAY') and $file !~ m'^http://|ftp://' and !(scalar @$table_ary) ) { | ||||||||||||||||||||||||||||||||||||||||||
| 128 | 9 | ▶ | if ((ref $parser) !~ /XML/ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 129 | 9 | ▶ | my $size = scalar @$table_ary if defined $table_ary; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 9 | ▶ | if ($file and !(ref $file eq 'ARRAY') and !$size ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition66%4/6
$file and not ref $file eq "ARRAY" and not $size
$file and not ref $file eq "ARRAY"
MC/DC33%1/3
$file and not ref $file eq "ARRAY" and not $size
$file
not ref $file eq "ARRAY"
not $size
Truth table50%2/4
A and not(B) and not(C)
A= $fileB= not ref $file eq "ARRAY"C= not $size
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | 1 | ▶ | if ($file =~ m'^http://|ftp://') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 132 | # ($table_ary,$col_names) = | ||||||||||||||||||||||||||||||||||||||||||
| 133 | # $self->get_remote_data($file,$parser); | ||||||||||||||||||||||||||||||||||||||||||
| 134 | } | ||||||||||||||||||||||||||||||||||||||||||
| 135 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 136 | 1 | ($table_ary,$col_names) = | |||||||||||||||||||||||||||||||||||||||||
| 137 | $self->get_local_data($file,$parser,$read_mode); | ||||||||||||||||||||||||||||||||||||||||||
| 138 | } | ||||||||||||||||||||||||||||||||||||||||||
| 139 | } | ||||||||||||||||||||||||||||||||||||||||||
| 140 | } | ||||||||||||||||||||||||||||||||||||||||||
| 141 | 9 | ▶ | my @array = @$col_names if ref $col_names eq 'ARRAY'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 142 | #print "@array" if @array; | ||||||||||||||||||||||||||||||||||||||||||
| 143 | 9 | ▶ | if ($col_names && scalar @array == 0 ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$col_names and scalar @array == 0
MC/DC0%0/2
$col_names and scalar @array == 0
$col_names
scalar @array == 0
Truth table33%1/3
A and B
A= $col_namesB= scalar @array == 0
| |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | ▶ | @array = (ref $parser =~ /Fixed/) | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 145 | ? split ',', $col_names | ||||||||||||||||||||||||||||||||||||||||||
| 146 | : $parser->read_fields($col_names); | ||||||||||||||||||||||||||||||||||||||||||
| 147 | } | ||||||||||||||||||||||||||||||||||||||||||
| 148 | 9 | my $col_nums; | |||||||||||||||||||||||||||||||||||||||||
| 149 | 9 | ▶ | $col_nums = $self->set_col_nums() if $col_names; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | 9 | my %table = ( | |||||||||||||||||||||||||||||||||||||||||
| 151 | index => 0, | ||||||||||||||||||||||||||||||||||||||||||
| 152 | file => $file, | ||||||||||||||||||||||||||||||||||||||||||
| 153 | records => $table_ary, | ||||||||||||||||||||||||||||||||||||||||||
| 154 | col_nums => $col_nums, | ||||||||||||||||||||||||||||||||||||||||||
| 155 | col_names => \@array, | ||||||||||||||||||||||||||||||||||||||||||
| 156 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 157 | 9 | for my $key(keys %table) { | |||||||||||||||||||||||||||||||||||||||||
| 158 | 45 | $self->{$key}=$table{$key}; | |||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | #use Data::Dumper; print Dumper $self; exit; | ||||||||||||||||||||||||||||||||||||||||||
| 161 | #use Data::Dumper; print Dumper $table_ary; | ||||||||||||||||||||||||||||||||||||||||||
| 162 | #use Data::Dumper; print Dumper $self->{records} if (ref $parser) =~ /Weblog/; | ||||||||||||||||||||||||||||||||||||||||||
| 163 | } | ||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | ▶ | sub close { my $s = shift; undef $s } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | sub get_remote_data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_remote_data: not called CC=8 SCAR=42.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 168 | 0 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||
| 169 | 0 | my $parser = shift; | |||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | ▶ | $ENV = {} unless defined $ENV; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 171 | 0 | $^W = 0; | |||||||||||||||||||||||||||||||||||||||||
| 172 | 0 | undef $@; | |||||||||||||||||||||||||||||||||||||||||
| 173 | 0 | ▶ | my $user = $self->{user} || $self->{username}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'user'} || $self->{'username'}
MC/DC0%0/2
$self->{'user'} || $self->{'username'}
$self->{'user'}
$self->{'username'}
Truth table0%0/3
A || B
A= $self->{'user'}B= $self->{'username'}
| |||||||||||||||||||||||||||||||||||||||||||
| 174 | 0 | ▶ | my $pass = $self->{pass} || $self->{password}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'pass'} || $self->{'password'}
MC/DC0%0/2
$self->{'pass'} || $self->{'password'}
$self->{'pass'}
$self->{'password'}
Truth table0%0/3
A || B
A= $self->{'pass'}B= $self->{'password'}
| |||||||||||||||||||||||||||||||||||||||||||
| 175 | 0 | eval{ require 'LWP/UserAgent.pm'; }; | |||||||||||||||||||||||||||||||||||||||||
| 176 | # eval{ require 'File/DosGlob.pm'; }; | ||||||||||||||||||||||||||||||||||||||||||
| 177 | 0 | ▶ | die "LWP module not found! $@" if $@; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 178 | 0 | my $ua = LWP::UserAgent->new; | |||||||||||||||||||||||||||||||||||||||||
| 179 | 0 | my $req = HTTP::Request->new(GET => $file); | |||||||||||||||||||||||||||||||||||||||||
| 180 | 0 | ▶ | $req->authorization_basic($user, $pass) if $user and $pass; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$user and $pass
MC/DC0%0/2
$user and $pass
$user
$pass
Truth table0%0/3
A and B
A= $userB= $pass
| |||||||||||||||||||||||||||||||||||||||||||
| 181 | 0 | my $res = $ua->request($req); | |||||||||||||||||||||||||||||||||||||||||
| 182 | 0 | ▶ | die "[$file] : " . $res->message if !$res->is_success; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 183 | 0 | $^W = 1; | |||||||||||||||||||||||||||||||||||||||||
| 184 | 0 | return $res->content; | |||||||||||||||||||||||||||||||||||||||||
| 185 | # return $parser->get_data($res->content,$self->{col_names}); | ||||||||||||||||||||||||||||||||||||||||||
| 186 | } | ||||||||||||||||||||||||||||||||||||||||||
| 187 | 0 | ▶ | sub export { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
export: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 189 | 0 | my $parser = shift; | |||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | print "##"; | |||||||||||||||||||||||||||||||||||||||||
| 191 | 0 | ▶ | return unless $parser->{export_on_close} && $self->{open_mode} ne 'r'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$parser->{"export_on_close"} and $self->{"open_mode"} ne "r"
MC/DC0%0/2
$parser->{"export_on_close"} and $self->{"open_mode"} ne "r"
$parser->{"export_on_close"}
$self->{"open_mode"} ne "r"
Truth table0%0/3
A and B
A= $parser->{"export_on_close"}B= $self->{"open_mode"} ne "r"
| |||||||||||||||||||||||||||||||||||||||||||
| 192 | # return $parser->export( $self->{records}, $self->{col_names}, $self->{deleted} ); | ||||||||||||||||||||||||||||||||||||||||||
| 193 | #$self->{file_manager}->str2file($str); | ||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: not called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 197 | #shift->export; | ||||||||||||||||||||||||||||||||||||||||||
| 198 | #print "DESTROY"; | ||||||||||||||||||||||||||||||||||||||||||
| 199 | } | ||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 1 | ▶ | sub get_local_data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_local_data: called CC=4 SCAR=16.5
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | 1 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 203 | 1 | my $file = shift; | |||||||||||||||||||||||||||||||||||||||||
| 204 | 1 | my $parser = shift; | |||||||||||||||||||||||||||||||||||||||||
| 205 | 1 | ▶ | my $open_mode = shift || 'r'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition50%1/2
shift() || 'r'
MC/DC0%0/1
shift() || 'r'
shift()
Truth table50%1/2
A
A= shift()
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 1 | my $adf = AnyData::Storage::File->new; | |||||||||||||||||||||||||||||||||||||||||
| 207 | # $adf->open_table($parser,$file,'r'); | ||||||||||||||||||||||||||||||||||||||||||
| 208 | 1 | my $fh = $adf->open_local_file($file,$open_mode); | |||||||||||||||||||||||||||||||||||||||||
| 209 | #print Dumper $file,$adf; exit; | ||||||||||||||||||||||||||||||||||||||||||
| 210 | 1 | $self->{file_manager} = $adf; | |||||||||||||||||||||||||||||||||||||||||
| 211 | 1 | $self->{fh} = $fh; | |||||||||||||||||||||||||||||||||||||||||
| 212 | #use Data::Dumper; print Dumper $self; | ||||||||||||||||||||||||||||||||||||||||||
| 213 | # my $fh = $adf->{fh}; | ||||||||||||||||||||||||||||||||||||||||||
| 214 | 1 | ▶ | return([],$self->{col_names}) if 'co' =~ /$open_mode/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | # if ((ref $parser) =~ /HTML/) { | ||||||||||||||||||||||||||||||||||||||||||
| 216 | # print "[[$file]]"; | ||||||||||||||||||||||||||||||||||||||||||
| 217 | # for (<$fh>) { print; } | ||||||||||||||||||||||||||||||||||||||||||
| 218 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | local $/ = undef; | |||||||||||||||||||||||||||||||||||||||||
| 220 | 0 | my $str = <$fh>; | |||||||||||||||||||||||||||||||||||||||||
| 221 | # $fh->close; | ||||||||||||||||||||||||||||||||||||||||||
| 222 | #print $str if (ref $parser) =~ /HTML/; | ||||||||||||||||||||||||||||||||||||||||||
| 223 | 0 | ▶ | return $self->{col_names} unless $str; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 224 | 0 | return $parser->get_data($str,$self->{col_names}); | |||||||||||||||||||||||||||||||||||||||||
| 225 | } | ||||||||||||||||||||||||||||||||||||||||||
| 226 | 0 | ▶ | sub dump { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dump: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | "\nTotal Rows = ", scalar @{ $self->{records} }, | |||||||||||||||||||||||||||||||||||||||||
| 230 | "\nCurrent Row = ", $self->{index}, | ||||||||||||||||||||||||||||||||||||||||||
| 231 | "\nData = ", Dumper $self->{records}, | ||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ; | |||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | ▶ | sub col_names { shift->{col_names} } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
col_names: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 236 | 0 | ▶ | sub get_col_names { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_col_names: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 237 | 0 | my $self=shift; | |||||||||||||||||||||||||||||||||||||||||
| 238 | 0 | my $parser=shift; | |||||||||||||||||||||||||||||||||||||||||
| 239 | 0 | ▶ | my $c = $self->{col_names} || $parser->{col_names}; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$self->{'col_names'} || $parser->{'col_names'}
MC/DC0%0/2
$self->{'col_names'} || $parser->{'col_names'}
$self->{'col_names'}
$parser->{'col_names'}
Truth table0%0/3
A || B
A= $self->{'col_names'}B= $parser->{'col_names'}
| |||||||||||||||||||||||||||||||||||||||||||
| 240 | #print "###@$c"; | ||||||||||||||||||||||||||||||||||||||||||
| 241 | #return $c; | ||||||||||||||||||||||||||||||||||||||||||
| 242 | # if (!scalar @$c and $self->{data}) { | ||||||||||||||||||||||||||||||||||||||||||
| 243 | # $c = shift @{$self->{data}}; | ||||||||||||||||||||||||||||||||||||||||||
| 244 | # } | ||||||||||||||||||||||||||||||||||||||||||
| 245 | # return $c; | ||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | 0 | ▶ | sub get_file_handle {''} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_file_handle: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | ▶ | sub get_file_name {''} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_file_name: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | 46 | ▶ | sub seek_first_record { shift->{index}=0 } | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
seek_first_record: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | 222 | ▶ | sub get_pos { my $s=shift; $s->{CUR}= $s->{index}} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_pos: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | sub go_pos {my $s=shift;$s->{index}=$s->{CUR}} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
go_pos: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | 222 | ▶ | sub is_deleted { my $s=shift; return $s->{deleted}->{$s->{index}-1} }; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
is_deleted: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 12 | ▶ | sub delete_record { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
delete_record: called CC=1 SCAR=0.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 259 | # $self->{records}->[ $self->{index}-1 ]->[-1] = $self->{del_marker}; | ||||||||||||||||||||||||||||||||||||||||||
| 260 | 12 | $self->{deleted}->{ $self->{index}-1 }++; | |||||||||||||||||||||||||||||||||||||||||
| 261 | } | ||||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | ################################## | ||||||||||||||||||||||||||||||||||||||||||
| 264 | # fetch_row() | ||||||||||||||||||||||||||||||||||||||||||
| 265 | ################################## | ||||||||||||||||||||||||||||||||||||||||||
| 266 | 256 | ▶ | sub get_record { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
get_record: called CC=3 SCAR=11.0
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | 256 | my($self,$parser) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 268 | 256 | my $currentRow = $self->{index}; | |||||||||||||||||||||||||||||||||||||||||
| 269 | 256 | ▶ | return undef unless $self->{records} ; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 270 | 256 | ▶ | return undef if $currentRow >= @{ $self->{records} }; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | 222 | $self->{index} = $currentRow+1; | |||||||||||||||||||||||||||||||||||||||||
| 272 | 222 | $self->get_pos($self->{index}); | |||||||||||||||||||||||||||||||||||||||||
| 273 | #print @{ $self->{records}->[ $currentRow ] }; | ||||||||||||||||||||||||||||||||||||||||||
| 274 | 222 | return $self->{records}->[ $currentRow ]; | |||||||||||||||||||||||||||||||||||||||||
| 275 | } | ||||||||||||||||||||||||||||||||||||||||||
| 276 | 3 | *file2str = \&get_record; | |||||||||||||||||||||||||||||||||||||||||
| 277 | |||||||||||||||||||||||||||||||||||||||||||
| 278 | |||||||||||||||||||||||||||||||||||||||||||
| 279 | 3 | *write_fields = \&push_row; | |||||||||||||||||||||||||||||||||||||||||
| 280 | #################################### | ||||||||||||||||||||||||||||||||||||||||||
| 281 | # push_row() | ||||||||||||||||||||||||||||||||||||||||||
| 282 | #################################### | ||||||||||||||||||||||||||||||||||||||||||
| 283 | 42 | ▶ | sub push_row { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
push_row: called CC=2 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 284 | 42 | my($self, $fields, $parser) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 285 | 42 | ▶ | if (! ref $fields) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 36 | $fields =~ s/\012$//; | |||||||||||||||||||||||||||||||||||||||||
| 287 | #chomp $fields; | ||||||||||||||||||||||||||||||||||||||||||
| 288 | 36 | my @rec = $parser->read_fields($fields); | |||||||||||||||||||||||||||||||||||||||||
| 289 | 36 | $fields = \@rec; | |||||||||||||||||||||||||||||||||||||||||
| 290 | } | ||||||||||||||||||||||||||||||||||||||||||
| 291 | |||||||||||||||||||||||||||||||||||||||||||
| 292 | #use Data::Dumper; print Dumper $fields; | ||||||||||||||||||||||||||||||||||||||||||
| 293 | 42 | my $currentRow = $self->{index}; | |||||||||||||||||||||||||||||||||||||||||
| 294 | 42 | $self->{index} = $currentRow+1; | |||||||||||||||||||||||||||||||||||||||||
| 295 | 42 | $self->{records}->[$currentRow] = $fields; | |||||||||||||||||||||||||||||||||||||||||
| 296 | 42 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 297 | } | ||||||||||||||||||||||||||||||||||||||||||
| 298 | |||||||||||||||||||||||||||||||||||||||||||
| 299 | ################################## | ||||||||||||||||||||||||||||||||||||||||||
| 300 | # truncate() | ||||||||||||||||||||||||||||||||||||||||||
| 301 | ################################## | ||||||||||||||||||||||||||||||||||||||||||
| 302 | 0 | ▶ | sub truncate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
truncate: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 303 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 304 | 0 | return splice @{$self->{records}}, $self->{index},1; | |||||||||||||||||||||||||||||||||||||||||
| 305 | } | ||||||||||||||||||||||||||||||||||||||||||
| 306 | |||||||||||||||||||||||||||||||||||||||||||
| 307 | ##################################### | ||||||||||||||||||||||||||||||||||||||||||
| 308 | # push_names() | ||||||||||||||||||||||||||||||||||||||||||
| 309 | ##################################### | ||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | sub print_col_names { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
print_col_names: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | 0 | my($self, $parser, $names) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | $self->{col_names} = $names; | |||||||||||||||||||||||||||||||||||||||||
| 313 | 0 | $self->{parser}->{col_names} = $names; | |||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | my($col_nums) = {}; | |||||||||||||||||||||||||||||||||||||||||
| 315 | 0 | ▶ | for (my $i = 0; $i < @$names; $i++) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | $col_nums->{$names->[$i]} = $i; | |||||||||||||||||||||||||||||||||||||||||
| 317 | } | ||||||||||||||||||||||||||||||||||||||||||
| 318 | 0 | $self->{col_nums} = $col_nums; | |||||||||||||||||||||||||||||||||||||||||
| 319 | } | ||||||||||||||||||||||||||||||||||||||||||
| 320 | |||||||||||||||||||||||||||||||||||||||||||
| 321 | 0 | ▶ | sub drop {1;} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
drop: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 322 | 0 | ▶ | sub close_table {1;} | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
close_table: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 36 | ▶ | sub seek { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
seek: called CC=6 SCAR=21.4
Pod
undocumented
| |||||||||||||||||||||||||||||||||||||||||||
| 325 | 36 | my($self, $pos, $whence) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 326 | 36 | ▶ | return unless defined $self->{records}; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | 36 | my($currentRow) = $self->{index}; | |||||||||||||||||||||||||||||||||||||||||
| 328 | 36 | ▶ | if ($whence == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | $currentRow = $pos; | |||||||||||||||||||||||||||||||||||||||||
| 330 | } elsif ($whence == 1) { | ||||||||||||||||||||||||||||||||||||||||||
| 331 | 0 | $currentRow += $pos; | |||||||||||||||||||||||||||||||||||||||||
| 332 | } elsif ($whence == 2) { | ||||||||||||||||||||||||||||||||||||||||||
| 333 | 36 | $currentRow = @{$self->{records}} + $pos; | |||||||||||||||||||||||||||||||||||||||||
| 334 | } else { | ||||||||||||||||||||||||||||||||||||||||||
| 335 | 0 | die $self . "->seek: Illegal whence argument ($whence)"; | |||||||||||||||||||||||||||||||||||||||||
| 336 | } | ||||||||||||||||||||||||||||||||||||||||||
| 337 | 36 | ▶ | if ($currentRow < 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | die "Illegal row number: $currentRow"; | |||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | 36 | $self->{index} = $currentRow; | |||||||||||||||||||||||||||||||||||||||||
| 341 | } | ||||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | |||||||||||||||||||||||||||||||||||||||||||
| 344 | ############################################################################ | ||||||||||||||||||||||||||||||||||||||||||
| 345 | 3 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 346 | __END__ | ||||||||||||||||||||||||||||||||||||||||||