-use Module::Build;
+use Module::Build 0.28; # for prepare_metadata
use strict;
use warnings FATAL => 'all';
my $self = shift->_get_self;
warn "CLEAR($self)\n" if DEBUG;
- unless ( $self->_engine->storage->is_writable ) {
+ my $engine = $self->_engine;
+ unless ( $engine->storage->is_writable ) {
$self->_throw_error( 'Cannot write to a readonly filehandle' );
}
$self->lock_exclusive;
- # Dispatch to the specific clearing functionality.
- $self->_clear;
+ $engine->clear;
$self->unlock;
sub load_sector { $_[0]->sector_type->load( @_ ) }
+=head2 clear
+
+=cut
+
+=head2 clear( $obj )
+
+This takes an object that provides _base_offset() and deletes all its
+elements, returning nothing.
+
+=cut
+
+sub clear {
+ my $self = shift;
+ my $obj = shift;
+
+ my $sector = $self->_load_sector( $obj->_base_offset )
+ or return;
+
+ return unless $sector->staleness == $obj->_staleness;
+
+ $sector->clear;
+
+ return;
+}
+
=head2 cache / clear_cache
This is the cache of loaded Reference sectors.