diff --git a/lib/RevBank/Cart.pm b/lib/RevBank/Cart.pm index e1f5ab5..49be311 100644 --- a/lib/RevBank/Cart.pm +++ b/lib/RevBank/Cart.pm @@ -15,6 +15,10 @@ sub new { sub add { my ($self, $user, $amount, $description, $data) = @_; + + # Note: 'repeat' plugin is currently dependent on this specific + # implementation! + $data ||= {}; my $item = { %$data, # Internal stuff, not logged or printed. diff --git a/plugins/repeat b/plugins/repeat index 3359f07..eb4fa66 100755 --- a/plugins/repeat +++ b/plugins/repeat @@ -12,10 +12,11 @@ my $err_limit = "Repetition is limited at $limit items."; sub _do_repeat { my ($cart, $item, $num) = @_; - my $data = $item->{data}; - $data->{_repeated} = 1; + $item->{_repeated} = 1; - $cart->add( @{ $item }{qw/user amount description/}, $data ) for 2..$num; + # Strongly dependent on the implementation of RevBank::Cart and the 'add' + # method. Bad idea, but meh. + $cart->add( @{ $item }{qw/user amount description/}, $item ) for 2..$num; } sub command {