File Coverage

blib/lib/DBD/PO/Table.pm
Criterion Covered Total %
statement 18 41 43.9
branch 0 4 0.0
condition 0 3 0.0
subroutine 6 9 66.6
pod 3 3 100.0
total 27 60 45.0


line stmt bran cond sub pod time code
1             package DBD::PO::Table;
2            
3 1     1   4827 use strict;
  1         3  
  1         48  
4 1     1   7 use warnings;
  1         2  
  1         56  
5            
6             our $VERSION = '2.00';
7            
8 1     1   6 use DBD::File;
  1         3  
  1         34  
9 1     1   7 use parent qw(-norequire DBD::File::Table);
  1         3  
  1         8  
10            
11 1     1   59 use Carp qw(croak);
  1         2  
  1         136  
12 1     1   7 use English qw(-no_match_vars $INPUT_RECORD_SEPARATOR);
  1         2  
  1         9  
13            
14             sub fetch_row {
15 0     0 1   my ($self, $data) = @_;
16            
17 0           my $file_handle = $self->{fh};
18 0           my $file_name = $self->{file};
19 0           my $fields;
20 0 0         if (exists $self->{cached_row}) {
21 0           $fields = delete $self->{cached_row};
22             }
23             else {
24 0           my $po = $self->{po_po};
25 0           local $INPUT_RECORD_SEPARATOR = $po->{eol};
26 0           $fields = $po->read_entry($file_name, $file_handle);
27             }
28            
29 0 0         return $self->{row} = @{$fields} ? $fields : ();
  0            
30             }
31            
32             sub push_row {
33 0     0 1   my ($self, $data, $fields) = @_;
34            
35 0           my $po = $self->{po_po};
36 0           my $file_handle = $self->{fh};
37 0           my $file_name = $self->{file};
38            
39             # Remove undef from the right end of the fields, so that at least
40             # in these cases undef is returned from FetchRow
41 0   0       while (@{$fields} && ! defined $fields->[-1]) {
  0            
42 0           pop @{$fields};
  0            
43             }
44 0           $po->write_entry($file_name, $file_handle, $fields);
45            
46 0           return 1;
47             }
48            
49             sub push_names {
50 0     0 1   my ($self, $data, $fields) = @_;
51            
52 0           return 1;
53             }
54            
55             1;
56            
57             __END__