NAME

Zapp::Trigger - Trigger a plan from an event

VERSION

version 0.005

SYNOPSIS

    package My::Trigger;
    use Mojo::Base 'Zapp::Trigger', -signatures;

    sub install( $self, $app, $config={} ) {
        $self->SUPER::install( $app, $config );
        # Set up trigger to call $self->enqueue when needed
    }

    __DATA__
    @@ config.html.ep
    %# Form to configure trigger

DESCRIPTION

This is the base class for Zapp triggers. Triggers handle events and run configured plans. Triggers can accept configuration and plan input.

ATTRIBUTES

app

The application object.

moniker

The name of the trigger. Multiple configurations for a trigger class should have different names.

METHODS

install

Called automatically when adding the trigger. Should be overridden to set up any routes, timers, connections, or other kind of listeners to fire the configured triggers.

enqueue

Enqueue the plan for the given trigger ID. The plan input will be processed via "resolve" in Zapp::Formula, passing in the given context hash reference of data. Returns the run enqueued (from "enqueue_plan" in Zapp).

SEE ALSO

Zapp

AUTHOR

Doug Bell <preaction@cpan.org>

COPYRIGHT AND LICENSE

This software is copyright (c) 2021 by Doug Bell.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.