Remove requirement for dummy command method in hook-only plugins
This commit is contained in:
parent
cf8ce7dc52
commit
6850ed22be
15 changed files with 8 additions and 27 deletions
|
@ -38,6 +38,8 @@ sub import {
|
|||
|
||||
}
|
||||
|
||||
__PACKAGE__->import;
|
||||
|
||||
1;
|
||||
__END__
|
||||
|
||||
|
|
|
@ -1,10 +1,14 @@
|
|||
package RevBank::Plugin;
|
||||
use strict;
|
||||
require RevBank::Global;
|
||||
|
||||
sub new {
|
||||
my ($class) = @_;
|
||||
return bless { }, $class;
|
||||
}
|
||||
sub command {
|
||||
return RevBank::Global::NEXT();
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
|
|
@ -52,9 +52,8 @@ There is no protection against infinite loops. Be careful!
|
|||
$a = parse_amount($a) or return REJECT, "$a: Invalid amount.";
|
||||
$cart->add($u, $a, 'Good, except that $a is special in Perl :)');
|
||||
|
||||
There are two kinds of plugin methods: input methods and hooks. A plugin MUST
|
||||
define one C<command> input method (but it MAY be a no-op), and can have any
|
||||
number of hooks.
|
||||
There are two kinds of plugin methods: input methods and hooks. A plugin may
|
||||
define one C<command> input method, and can have any number of hooks.
|
||||
|
||||
=head2 Input methods
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!perl
|
||||
|
||||
sub command { NEXT }
|
||||
|
||||
*hook_plugin_fail = *hook_retry = *hook_reject = *hook_invalid_input = sub {
|
||||
call_hooks('beep');
|
||||
undef;
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!perl
|
||||
|
||||
sub command { NEXT }
|
||||
|
||||
# So you want a different beep mechanism...
|
||||
#
|
||||
# Don't just edit this plugin. Instead, COPY this file and add yours to
|
||||
|
|
|
@ -23,8 +23,6 @@ use List::Util qw(sum);
|
|||
my $iban = "NL99ABCD1234567890";
|
||||
my $beneficiary = "Account Name";
|
||||
|
||||
sub command { NEXT }
|
||||
|
||||
sub hook_checkout {
|
||||
my ($class, $cart, $user, $transaction_id) = @_;
|
||||
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!perl
|
||||
|
||||
sub command { NEXT }
|
||||
|
||||
sub hook_deposit_methods {
|
||||
my ($class, $message, $hash) = @_;
|
||||
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
my $timeout = 10;
|
||||
|
||||
sub command { NEXT }
|
||||
|
||||
sub hook_prompt_idle {
|
||||
my ($class, $cart, $plugin, $seconds, $readline) = @_;
|
||||
if ($seconds >= $timeout and $cart->size and not $plugin) {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!perl
|
||||
|
||||
sub command { NEXT }
|
||||
|
||||
my $filename = ".revbank.log";
|
||||
|
||||
sub _log {
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!perl
|
||||
|
||||
sub command { NEXT }
|
||||
|
||||
sub hook_user_balance {
|
||||
my ($class, $username, $old, $delta, $new, $transaction_id) = @_;
|
||||
my $msg = "$transaction_id ($username)";
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
use Net::MQTT::Simple "mosquitto.space.revspace.nl";
|
||||
|
||||
sub command { NEXT }
|
||||
|
||||
sub hook_checkout {
|
||||
my ($class, $cart, $user, $transaction_id) = @_;
|
||||
my $filename = "revbank.sales";
|
||||
|
|
|
@ -2,8 +2,6 @@
|
|||
|
||||
use POSIX qw(strftime);
|
||||
|
||||
sub command { NEXT }
|
||||
|
||||
sub _box {
|
||||
print(
|
||||
"#" x 79, "\n",
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
sub command { NEXT }
|
||||
|
||||
# Terminal hacks
|
||||
|
||||
# Reset terminal on startup
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
#!perl
|
||||
|
||||
sub command { NEXT }
|
||||
|
||||
$SIG{INT} = sub {
|
||||
$::ABORT_HACK = "^C";
|
||||
|
||||
|
|
|
@ -29,8 +29,6 @@ sub _read_warnings {
|
|||
} grep /\S/, grep !/^\s*#/, readline $fh;
|
||||
}
|
||||
|
||||
sub command { NEXT }
|
||||
|
||||
sub hook_add_entry {
|
||||
my ($class, $cart, $entry) = @_;
|
||||
return if not $entry->has_attribute('product_id'); # skip unlisted, deposit, give, take
|
||||
|
|
Loading…
Add table
Reference in a new issue