initial broken implementation of the runner

This commit is contained in:
Oliver Gorwits
2017-09-03 22:30:28 +01:00
parent 49b5274c33
commit a8c58a7b05
4 changed files with 57 additions and 7 deletions

View File

@@ -67,15 +67,16 @@ register 'register_worker' => sub {
my $primary = ($workerconf->{primary} ? '_primary' : '');
my $hook = 'nd2worker_'. $action .'_'. $phase . $primary;
my $store = Dancer::Factory::Hook->instance();
if (not Dancer::Factory::Hook->instance->hook_is_registered($hook)) {
Dancer::Factory::Hook->instance->install_hooks($hook);
if (not $store->hook_is_registered($hook)) {
$store->install_hooks($hook);
# track just the basic phase names which are used
push @{ setting('_nd2worker_hooks') }, $hook
if $phase ne '00init' and 0 == length($primary);
}
Dancer::Factory::Hook->instance->register_hook($hook, $worker);
$store->register_hook($hook, $worker);
};
register_plugin;

View File

@@ -25,6 +25,16 @@ has 'log' => (
=head1 METHODS
=head2 done, error, defer
Shorthand for new() with setting param, accepts log as arg.
=cut
sub done { return (shift)->new({done => 1, log => shift}) }
sub error { return (shift)->new({error => 1, log => shift}) }
sub defer { return (shift)->new({defer => 1, log => shift}) }
=head2 ok
Returns true if C<done> is true and C<error> and C<defer> have not been set.