New plugin: repeat (undocumented), new hook: "added"

This commit is contained in:
Juerd Waalboer 2017-02-19 00:41:20 +01:00
parent b0ee7e88bf
commit add3100401
7 changed files with 171 additions and 27 deletions

View file

@ -2,6 +2,7 @@ package RevBank::Plugins;
use strict;
use RevBank::Eval;
use RevBank::Plugin;
use RevBank::Global;
use Exporter;
our @EXPORT = qw(call_hooks load_plugins);
@ -16,7 +17,14 @@ sub call_hooks {
my $hook = shift;
my $method = "hook_$hook";
for my $class (@plugins) {
$class->$method(@_) if $class->can($method);
if ($class->can($method)) {
my ($rv, $message) = $class->$method(@_);
if (defined $rv and ref $rv) {
main::abort($message) if $rv == ABORT;
warn "$class->$method returned an unsupported value.\n";
}
}
}
};