App-Standby

 view release on metacpan or  search on metacpan

lib/App/Standby/Service.pm  view on Meta::CPAN


    return $self->SUPER::_config_values($key, $self->group_id());
}

sub _config_value {
    my $self = shift;
    my $key = shift;

    my $vals = $self->_config_values($key);
    if(ref($vals) eq 'ARRAY') {
        return $vals->[0];
    } else {
        return;
    }
}

no Moose;
__PACKAGE__->meta->make_immutable;

1;

__END__

=pod

=encoding utf-8

=head1 NAME

App::Standby::Service - Service Plugin baseclass

=head1 ATTRIBUTES

=head2 name

The name of this plugin. SHOULD be lowercase. SHOULD also used as a key prefix in the
config table.

=head2 description

A human readable description of this service plugin. Used for display and logging.
MAY be empty.

=head2 group_id

The numeric group id of the group this service plugins instance is associated with.
MUST be numeric and MUST NOT be empty.

=head1 METHODS

=head2 update

This method is called with a array_ref containing the new ordering on any changed.

=head1 NAME

App::Standby::Service - Service Plugin baseclass

=head1 ADDING A NEW SERVICE

First of all there are two kinds of services: Simple HTTP endpoints and complex plugins.

The simple HTTP plugins just receive the whole queue in as JSON encoded array.
Those only need to subclass App::Standby::Service::HTTP and provide an implementation
for _init_endpoints. Have a look at the simple example.

All other services will need to subclass App::Standby::Service and implement an
update() method. Have a look at App::Standby::Service::Pingom for an example.

The method _config_values helps with getting values to known keys from
the config table. A service plugin MUST always prepend its name to
the key to allow for multiple instances of one plugin registered at
the same time.

=head1 AUTHOR

Dominik Schulz <dominik.schulz@gauner.org>

=head1 COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Dominik Schulz.

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

=cut



( run in 0.776 second using v1.01-cache-2.11-cpan-0bb4e1dffa6 )