From 32e84f3725ff015080131d6aaa40c7a832e115b2 Mon Sep 17 00:00:00 2001 From: Juerd Waalboer Date: Wed, 6 Nov 2019 17:43:31 +0100 Subject: [PATCH] Fix that 'changed' would return true just because the attribute existed :) Another option would have been to implement 'delete_attribute'. --- lib/RevBank/Cart/Entry.pm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/lib/RevBank/Cart/Entry.pm b/lib/RevBank/Cart/Entry.pm index ef8950c..5ed1fe7 100644 --- a/lib/RevBank/Cart/Entry.pm +++ b/lib/RevBank/Cart/Entry.pm @@ -41,7 +41,10 @@ sub add_contra { sub has_attribute { my ($self, $key) = @_; - return exists $self->{attributes}->{$key}; + return ( + exists $self->{attributes}->{$key} + and defined $self->{attributes}->{$key} + ); } sub attribute {