#!/usr/bin/perl
# This can be made stackless, as long as it's ok for anyone to remove
# someone else's item..
#use Mooix::Thing;
run sub {
	my $this=shift;
	%_=@_;
	my $id=$_{item} or $this->usage("item required");
	
	# Sanity check to prevent removal of parent link and that kind of
	# thing.
	if ($id !~ /^item\d+/) {
		$this->usage("invalid item, $id");
	}
	
	unlink($id);
	unlink("$id.params");
	unlink("$id.info");
	unlink("$id.stack");

	if (! $_{noupdate}) {
		# Inform the heartbeat process that its queue has changed.
		$this->heartbeat if $this->background;
	}
}
