diff --git a/plugins/beep b/plugins/beep new file mode 100644 index 0000000..ce3da5c --- /dev/null +++ b/plugins/beep @@ -0,0 +1,17 @@ +#!perl + +sub command { NEXT } + +*hook_plugin_fail = *hook_retry = *hook_reject = *hook_invalid_input = sub { + call_hooks('beep'); + undef; +}; + +sub hook_abort { + my ($self, $cart, $reason) = @_; + return if not $reason or not @$reason; + return if "@$reason" eq '^C'; + + call_hooks('beep'); + undef; +} diff --git a/revbank b/revbank index c47b4f1..2def6d3 100755 --- a/revbank +++ b/revbank @@ -139,7 +139,7 @@ OUTER: for (;;) { print @_, " " if @_; @words = (); @retry = (); - call_hooks "abort", $cart; + call_hooks "abort", $cart, \@_; $cart->empty; { no warnings; redo OUTER; } } diff --git a/revbank.plugins b/revbank.plugins index f0a5c1d..84e83d7 100644 --- a/revbank.plugins +++ b/revbank.plugins @@ -3,6 +3,7 @@ # First, plugins with no commands, or very specific commands log # first, so that the registrations of other plugins are logged +beep sigint restart help