NAME
App::derived::Plugin - base class of App::derived::Plugin
SYNOPSIS
package App::derived::Plugin::Dumper;
use strict;
use warnings;
use parent qw/App::derived::Plugin/;
use Data::Dumper;
use Class::Accessor::Lite (
ro => [qw/interval/]
);
sub int {
my $self = shift;
$self->interval(10) unless $self->interval;
$self->add_worker(
'dumper',
sub {
while (1) {
sleep $self->interval;
my @keys = $self->service_keys();
for my $key ( @keys ) {
my $ref = $self->service_stats->{$key}
print Dumper([$key,$ref]);
}
}
}
);
}
DESCRIPTION
This module is base class to make App::derived Plugin.
METHODS
- new
- json(): Object
-
Utility method. returns JSON.pm object
- service_stats($key): HashRef
-
Retrieve service status
- exists_service($key): Bool
-
Checking existence of service named $key
- service_keys(): Array
-
get all registered service keys
- add_worker($tag:String, $code:SubRef)
-
Registering a worker
- init
-
Required to implementing this method in your Plugin
SEE ALSO
<App::derived::Plugin::Memcached>
AUTHOR
Masahiro Nagano <kazeburo@gmail.com>
LICENSE
Copyright (C) Masahiro Nagano
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.