Cleanup: use subroutine signatures, remove deprecated methods.

The signatures feature has been "experimental" since Perl 5.20 (May 2014), but
expected to stay. After 8 years I'm ready to take the risk :)

Have added Perl v5.28 (June 2018) as the minimum requirement, even though the
current revbank should work with 5.20, to see if this bothers any users. Perl
v5.28 is in Debian "buster", which is now oldstable.
This commit is contained in:
Juerd Waalboer 2021-12-03 18:00:34 +01:00
parent 1661661ffd
commit eed0db7897
45 changed files with 233 additions and 444 deletions

View file

@ -10,9 +10,7 @@ my $err_postfix = "Addition/substraction is only supported the other way around.
my $limit = 200;
my $err_limit = "Repetition is limited at $limit items.";
sub command {
my ($self, $cart, $command) = @_;
sub command($self, $cart, $command, @) {
return ABORT, $err_pfand if $cart->entries('is_pfand');
my ($lhs, $op, $rhs) = $command =~ /^(\d+)?([x*+-])(\d+)?$/
@ -86,9 +84,7 @@ sub command {
return "Multiply previous product by", \&repeat;
}
sub repeat {
my ($self, $cart, $arg) = @_;
sub repeat($self, $cart, $arg, @) {
$arg =~ /^\d+$/ and $arg > 0
or return REJECT, "Invalid value.";
@ -98,9 +94,7 @@ sub repeat {
return ACCEPT;
}
sub plusminus {
my ($self, $cart, $arg) = @_;
sub plusminus($self, $cart, $arg, @) {
$arg =~ /^\d+$/ and $arg > 0
or return REJECT, "Invalid value.";
@ -119,8 +113,7 @@ sub plusminus {
return ACCEPT;
}
sub hook_added_entry {
my ($self, $cart, $entry) = @_;
sub hook_added_entry($class, $cart, $entry, @) {
$cart->size >= 2 or return;
my @entries = $cart->entries;