Data-SeaBASS

 view release on metacpan or  search on metacpan

lib/Data/SeaBASS.pm  view on Meta::CPAN

        # or
        $sb_file->update([@row{'lat','lon','depth','chl'}]);
    }

C<update> replaces the last row read (using C<next()>) with the input.

Caching must be enabled to use C<update>, C<set>, or C<insert>.

=cut

sub update {
	my $self = shift;
	if ( !$self->{'options'}{'cache'} ) {
		croak("Caching must be enabled to write.");
	} elsif ( $self->{'dataidx'} == -1 ) {
		croak("No rows read yet.");
	}
	my $new_row = $self->ingest_row(@_);
	unless ( defined($new_row) ) {
		croak("Error parsing inputs");
	}
	$self->{'data'}[ $self->{'dataidx'} ] = $new_row;
} ## end sub update

=head2 set($index, \%data_row | \@data_row | $data_row | %data_row)

    my %row = (lat => 1, lon => 2, chl => 1);
    $sb_file->set(0, \%row);
    
    print join(',',@{$sb_file->actual_fields()}); #lat,lon,chl
    $sb_file->set(0, [1, 2, 1]);
    

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 0.472 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )