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:
parent
1661661ffd
commit
eed0db7897
45 changed files with 233 additions and 444 deletions
27
plugins/log
27
plugins/log
|
@ -9,48 +9,41 @@ sub _log {
|
|||
}
|
||||
|
||||
my %buffer;
|
||||
sub hook_abort {
|
||||
sub hook_abort(@) {
|
||||
_log("ABORT");
|
||||
}
|
||||
sub hook_prompt {
|
||||
my ($class, $cart, $prompt) = @_;
|
||||
sub hook_prompt($class, $cart, $prompt, @) {
|
||||
$buffer{prompt} = $prompt;
|
||||
}
|
||||
sub hook_input {
|
||||
my ($class, $cart, $input, $split_input) = @_;
|
||||
|
||||
sub hook_input($class, $cart, $input, $split_input, @) {
|
||||
$input //= "(UNDEF)";
|
||||
_log("PROMPT $buffer{prompt} >> $input");
|
||||
}
|
||||
|
||||
sub hook_reject {
|
||||
my ($class, $plugin, $reason, $abort) = @_;
|
||||
sub hook_reject($class, $plugin, $reason, $abort, @) {
|
||||
_log("REJECT [$plugin] $reason");
|
||||
}
|
||||
|
||||
sub hook_retry {
|
||||
my ($class, $plugin, $reason, $abort) = @_;
|
||||
sub hook_retry($class, $plugin, $reason, $abort, @) {
|
||||
_log("RETRY [$plugin] $reason");
|
||||
}
|
||||
|
||||
sub hook_user_created {
|
||||
my ($class, $username) = @_;
|
||||
sub hook_user_created($class, $username, @) {
|
||||
_log("NEWUSER $username");
|
||||
}
|
||||
|
||||
sub hook_user_balance {
|
||||
my ($class, $user, $old, $delta, $new, $transaction_id) = @_;
|
||||
sub hook_user_balance($class, $user, $old, $delta, $new, $transaction_id, @) {
|
||||
my $lost = $delta < 0 ? "lost" : "got";
|
||||
$delta = $delta->abs;
|
||||
$_ = $_->string("+") for $old, $new;
|
||||
_log("BALANCE $transaction_id $user had $old, $lost $delta, now has $new");
|
||||
}
|
||||
|
||||
sub hook_checkout {
|
||||
my ($class, $cart, $username, $transaction_id) = @_;
|
||||
sub hook_checkout($class, $cart, $username, $transaction_id, @) {
|
||||
_log("CHECKOUT $transaction_id $_") for map $_->as_loggable, $cart->entries;
|
||||
}
|
||||
|
||||
sub hook_register {
|
||||
my ($class, $plugin) = @_;
|
||||
sub hook_register($class, $plugin, @) {
|
||||
_log("REGISTER $plugin");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue