File-SharedVar
view release on metacpan - search on metacpan
view release on metacpan or search on metacpan
lib/File/SharedVar.pm view on Meta::CPAN
=item *
C<$increment>: If true (non-zero), increments the existing value by C<$value>; otherwise, sets the key to C<$value>.
=back
Returns the previous value associated with the key, from before the update.
=cut
sub update {
my($self, $key, $val, $inc) = @_;
my($data)= _load_from_file($self,1);
my $ret = $data->{$key};
# Update the value for the key
if($inc) {
$data->{$key} = ($data->{$key} // 0) + $val;
} else {
$data->{$key} = $val;
}
view all matches for this distributionview release on metacpan - search on metacpan
( run in 0.473 second using v1.00-cache-2.02-grep-82fe00e-cpan-4673cadbf75 )