Skip to content

c9s/Hulk

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

About

Hulk, An Action dispatcher.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages