Added deleterecord method and test for it.

Note: I am not sure about return value. Currently I return "did I delete
sth flag", alternatively one could return deleted record, or even croak
if record was not there.
This commit is contained in:
Marcin Kasperski
2012-11-18 01:34:38 +01:00
parent 3bbb724b08
commit cda77bea88
2 changed files with 45 additions and 0 deletions

View File

@@ -470,6 +470,26 @@ sub modifyrecord {
$this->markmodified();
}
sub deleterecord {
#
# delete a record identified by the given uuid, if present
#
# returns 1 if record was actually removed, 0 if it was not present
my($this, $uuid) = @_;
if (! exists $this->{record}->{$uuid}) {
return 0;
}
delete $this->{record}->{$uuid};
# mark vault as modified
$this->markmodified();
return 1;
}
sub markmodified {
#
# mark the vault as modified by setting the appropriate header fields