Hulk, An Action dispatcher.
Perl
Switch branches/tags
Nothing to show
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
lib
t
Changes
MANIFEST
Makefile.PL
README.mkd
README.mkd.old
README.old
ignore.txt

README.mkd

Hulk

Hulk, An action dispatcher.

To write your own action:

package Hulk::Do::StopService;
use warnings;
use strict;
use Any::Moose;
extends qw(Hulk::Do);

# optional (this uses gfx's Data::Validator)
sub schema {
    uri        => { isa => 'Str', xor => [qw(schema host path_query)] },
    schema     => { isa => 'Str', default => 'http' },
    host       => { isa => 'Str', default => '127.0.0.1' },
    path_query => { isa => 'Str', default => '/' },
    method     => { isa => 'Str', default => 'GET' },
}

sub run {
    my $self = shift;
    my $args = $self->args;

    my $id = $args->{id};

    return $self->error( "Serivce id required." ) unless $id;

    # ... do something

    ...

    # ... do other stuff
    my $ret = $self->also_do( 'StopOtherService' , { arg1 => ... , arg2 => ... } );

    return $self->success( "Service stopped." );
}

1;

Declarative way:

use Hulk::Declare;

mount 'TwitterAPI' under '/__api/';

when '/..../' => sub {

};

when '/.....' => sub {

};

1;

Todo

  • use Data::Validator.
  • Integrate with Path::Dispatcher.