HTTP-Balancer

 view release on metacpan or  search on metacpan

.carton/02packages.details.txt  view on Meta::CPAN

Getopt::Long::Descriptive             0.093  R/RJ/RJBS/Getopt-Long-Descriptive-0.093.tar.gz
Getopt::Long::Descriptive::Opts       0.093  R/RJ/RJBS/Getopt-Long-Descriptive-0.093.tar.gz
Getopt::Long::Descriptive::Usage      0.093  R/RJ/RJBS/Getopt-Long-Descriptive-0.093.tar.gz
JSON::PP                            2.27200  M/MA/MAKAMAKA/JSON-PP-2.27200.tar.gz
JSON::PP::Boolean                     undef  M/MA/MAKAMAKA/JSON-PP-2.27200.tar.gz
JSON::PP::IncrParser                   1.01  M/MA/MAKAMAKA/JSON-PP-2.27200.tar.gz
List::MoreUtils                        0.33  A/AD/ADAMK/List-MoreUtils-0.33.tar.gz
MM                                    undef  M/MS/MSCHWERN/ExtUtils-MakeMaker-6.64.tar.gz
MRO::Compat                            0.12  B/BO/BOBTFISH/MRO-Compat-0.12.tar.gz
MY                                    undef  M/MS/MSCHWERN/ExtUtils-MakeMaker-6.64.tar.gz
Modern::Perl                     1.20121103  C/CH/CHROMATIC/Modern-Perl-1.20121103.tar.gz
Module::Implementation                 0.06  D/DR/DROLSKY/Module-Implementation-0.06.tar.gz
Module::Runtime                       0.013  Z/ZE/ZEFRAM/Module-Runtime-0.013.tar.gz
Moose                                2.0604  D/DO/DOY/Moose-2.0604.tar.gz
Moose::Cookbook::Legacy::Debugging_BaseClassReplacement     2.0604  D/DO/DOY/Moose-2.0604.tar.gz
Moose::Cookbook::Meta::Labeled_AttributeMetaclass     2.0604  D/DO/DOY/Moose-2.0604.tar.gz
Moose::Deprecated                    2.0604  D/DO/DOY/Moose-2.0604.tar.gz
Moose::Error::Confess                2.0604  D/DO/DOY/Moose-2.0604.tar.gz
Moose::Error::Croak                  2.0604  D/DO/DOY/Moose-2.0604.tar.gz
Moose::Error::Default                2.0604  D/DO/DOY/Moose-2.0604.tar.gz
Moose::Exporter                      2.0604  D/DO/DOY/Moose-2.0604.tar.gz

META.yml  view on Meta::CPAN

meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: 1.4
name: HTTP-Balancer
no_index:
  directory:
    - inc
    - t
    - xt
requires:
  Modern::Perl: 0
  Moose: 0
  MooseX::Getopt: 0
  MooseX::Singleton: 0
  MooseX::Storage: 0
  Namespace::Dispatch: 0.07
  Path::Tiny: 0
  Text::Table: 0
  Text::Xslate: 0
  YAML::Any: 0
  perl: 5.10.0

Makefile.PL  view on Meta::CPAN

use inc::Module::Install;

name            'HTTP-Balancer';
all_from        'lib/HTTP/Balancer.pm';
author          'shelling <navyblueshellingford@gmail.com>';
license         'MIT';
perl_version    '5.010';

install_script  'bin/http-balancer';

requires        'Modern::Perl';
requires        'Moose';
requires        'MooseX::Getopt';
requires        'MooseX::Singleton';
requires        'MooseX::Storage';
requires        'Namespace::Dispatch'   => '0.07';
requires        'YAML::Any';
requires        'Path::Tiny';
requires        'Text::Xslate';
requires        'Text::Table';

bin/http-balancer  view on Meta::CPAN

#!/usr/bin/env perl
use local::lib './local';
use lib 'lib';
use Modern::Perl;
use HTTP::Balancer;
HTTP::Balancer->new->run;

carton.lock  view on Meta::CPAN

         "pathname" : "B/BO/BOBTFISH/MRO-Compat-0.12.tar.gz",
         "provides" : {
            "MRO::Compat" : {
               "file" : "MRO/Compat.pm",
               "version" : "0.12"
            }
         },
         "target" : "MRO::Compat",
         "version" : "0.12"
      },
      "Modern::Perl" : {
         "dist" : "Modern-Perl-1.20121103",
         "mymeta" : {
            "abstract" : "enable all of the features of Modern Perl with one import",
            "author" : [
               "chromatic"
            ],
            "dynamic_config" : 0,
            "generated_by" : "Module::Build version 0.4003, CPAN::Meta::Converter version 2.120921",
            "license" : [
               "perl_5"

carton.lock  view on Meta::CPAN

            },
            "release_status" : "stable",
            "resources" : {
               "homepage" : "https://github.com/chromatic/Modern-Perl",
               "repository" : {
                  "url" : "https://github.com/chromatic/Modern-Perl.git"
               }
            },
            "version" : "1.20121103"
         },
         "name" : "Modern::Perl",
         "pathname" : "C/CH/CHROMATIC/Modern-Perl-1.20121103.tar.gz",
         "provides" : {
            "Modern::Perl" : {
               "file" : "Modern/Perl.pm",
               "version" : "1.20121103"
            }
         },
         "target" : "Modern::Perl",
         "version" : "1.20121103"
      },
      "Module::Implementation" : {
         "dist" : "Module-Implementation-0.06",
         "mymeta" : {
            "abstract" : "Loads one of several alternate underlying implementations for a module",
            "author" : [
               "Dave Rolsky <autarch@urth.org>"
            ],
            "dynamic_config" : 0,

carton.lock  view on Meta::CPAN

               "directory" : [
                  "inc",
                  "t",
                  "xt"
               ]
            },
            "prereqs" : {
               "build" : {
                  "requires" : {
                     "ExtUtils::MakeMaker" : "6.59",
                     "Modern::Perl" : "0",
                     "Test::More" : "0",
                     "Try::Tiny" : "0"
                  }
               },
               "configure" : {
                  "requires" : {
                     "ExtUtils::MakeMaker" : "6.59"
                  }
               },
               "runtime" : {

lib/HTTP/Balancer.pm  view on Meta::CPAN

package HTTP::Balancer;

our $VERSION = '0.0.2';

use Modern::Perl;

use Moose;
use MooseX::Singleton;

use HTTP::Balancer::Command;

sub run {
    my ($self, ) = @_;

    HTTP::Balancer::Command

lib/HTTP/Balancer/Actor.pm  view on Meta::CPAN

package HTTP::Balancer::Actor;
use Modern::Perl;
use Moose;
use Path::Tiny;

with qw(HTTP::Balancer::Role);

use Text::Xslate;

our @PATH = qw(
    /usr/local/bin
    /usr/local/sbin

lib/HTTP/Balancer/Actor.pm  view on Meta::CPAN

1;
__END__

=head1 NAME

HTTP::Balancer::Actor - the base class of actors of HTTP::Balancer

=head1 SYNOPSIS

    package HTTP::Balancer::Actor::Foo;
    use Modern::Perl;
    use Moose;
    extends qw(HTTP::Balancer::Actor);

    sub start { ... }
    sub stop  { ... }

    1;
    __DATA__
    here goes the template of configuration

lib/HTTP/Balancer/Actor/Nginx.pm  view on Meta::CPAN

package HTTP::Balancer::Actor::Nginx;
use Modern::Perl;
use Moose;
extends qw(HTTP::Balancer::Actor);

use Path::Tiny;

our $NAME = "nginx";

sub start {
    my ($self, %params) = @_;
    my $tempfile = Path::Tiny->tempfile(TEMPLATE => "http-balancer-XXXX");

lib/HTTP/Balancer/Command.pm  view on Meta::CPAN

package HTTP::Balancer::Command;

use Modern::Perl;

use Moose;

with qw( HTTP::Balancer::Role::Command );

sub run {
    my ($self, ) = @_;
    $self->dispatch("help")->new_with_options->prepare->run;
}

lib/HTTP/Balancer/Command/Add.pm  view on Meta::CPAN

package HTTP::Balancer::Command::Add;
use Modern::Perl;
use Moose;
with qw( HTTP::Balancer::Role::Stem );

sub run {
    my ($self, ) = @_;

}

1;

lib/HTTP/Balancer/Command/Add/Backend.pm  view on Meta::CPAN

package HTTP::Balancer::Command::Add::Backend;
use Modern::Perl;
use Moose;
with qw(HTTP::Balancer::Role::Command);

has name => (
    is      => "rw",
    traits  => [ 'NoGetopt' ],
    default => sub { shift->argv(2) },
);

has host => (

lib/HTTP/Balancer/Command/Add/Host.pm  view on Meta::CPAN

package HTTP::Balancer::Command::Add::Host;
use Modern::Perl;
use Moose;
with qw(HTTP::Balancer::Role::Command);

has name => (
    is      => "rw",
    traits  => [ 'NoGetopt' ],
    default => sub { shift->argv(2) },
);

has fullname => (

lib/HTTP/Balancer/Command/Del.pm  view on Meta::CPAN

package HTTP::Balancer::Command::Del;
use Modern::Perl;
use Moose;
with qw( HTTP::Balancer::Role::Stem );

sub run {
    my ($self, ) = @_;

}

1;

lib/HTTP/Balancer/Command/Del/Backend.pm  view on Meta::CPAN

package HTTP::Balancer::Command::Del::Backend;
use Modern::Perl;
use Moose;
with qw(HTTP::Balancer::Role::Command);

has name => (
    is      => "rw",
    traits  => [ 'NoGetopt' ],
    default => sub { shift->argv(2) },
);

sub ordinary_args {

lib/HTTP/Balancer/Command/Del/Host.pm  view on Meta::CPAN

package HTTP::Balancer::Command::Del::Host;
use Modern::Perl;
use Moose;
with qw(HTTP::Balancer::Role::Command);

has name => (
    is      => "rw",
    traits  => [ 'NoGetopt' ],
    default => sub { shift->argv(2) },
);

sub ordinary_args {

lib/HTTP/Balancer/Command/Help.pm  view on Meta::CPAN

package HTTP::Balancer::Command::Help;

use Modern::Perl;

use Moose;

with qw( HTTP::Balancer::Role::Command );

sub run {
    my ($self, ) = @_;

    say "usage: http-balancer [subcommands]";
    say "Available subcommands:";

lib/HTTP/Balancer/Command/Init.pm  view on Meta::CPAN

package HTTP::Balancer::Command::Init;

use Modern::Perl;

use Moose;

with qw( HTTP::Balancer::Role::Command );

use Path::Tiny;

sub run {
    my ($self, ) = @_;

lib/HTTP/Balancer/Command/List.pm  view on Meta::CPAN

package HTTP::Balancer::Command::List;
use Modern::Perl;
use Moose;
with qw( HTTP::Balancer::Role::Stem );

use Text::Table;

sub run {
    my ($self, ) = @_;
}

1;

lib/HTTP/Balancer/Command/List/Backend.pm  view on Meta::CPAN

package HTTP::Balancer::Command::List::Backend;
use Modern::Perl;
use Moose;
with qw(HTTP::Balancer::Role::Command);

sub run {
    my ($self, ) = @_;

    my @columns = (
        "id",
        "name",
        grep {!/^(id|name)$/} $self->model("Backend")->columns

lib/HTTP/Balancer/Command/List/Host.pm  view on Meta::CPAN

package HTTP::Balancer::Command::List::Host;
use Modern::Perl;
use Moose;
with qw(HTTP::Balancer::Role::Command);

sub run {
    my ($self, ) = @_;

    my @columns = (
        "id",
        "name",
        grep {!/^(id|name)$/} $self->model("Host")->columns

lib/HTTP/Balancer/Command/Start.pm  view on Meta::CPAN

package HTTP::Balancer::Command::Start;

use Modern::Perl;

use Moose;

with qw( HTTP::Balancer::Role::Command );

sub run {
    my ($self, ) = @_;

    $self
    ->actor("Nginx")

lib/HTTP/Balancer/Command/Status.pm  view on Meta::CPAN

package HTTP::Balancer::Command::Status;
use Modern::Perl;
use Moose;

with qw(HTTP::Balancer::Role::Command);

use Path::Tiny;

sub run {
    my ($self, ) = @_;

    my $pidfile = path($self->config->pidfile);

lib/HTTP/Balancer/Command/Stop.pm  view on Meta::CPAN

package HTTP::Balancer::Command::Stop;

use Modern::Perl;

use Moose;

with qw( HTTP::Balancer::Role::Command );

sub run {
    my ($self, ) = @_;

    $self
    ->actor("Nginx")

lib/HTTP/Balancer/Config.pm  view on Meta::CPAN

package HTTP::Balancer::Config;
use Modern::Perl;
use Moose;
use MooseX::Singleton;

has dbpath => (
    is      => "rw",
    isa     => "Str",
    default => "/var/lib/http-balancer/",
);

has pidfile => (

lib/HTTP/Balancer/Model.pm  view on Meta::CPAN

package HTTP::Balancer::Model;
use Modern::Perl;
use Moose;
use File::Spec;
use Path::Tiny qw(!path);

with qw(HTTP::Balancer::Role);

=head1 NAME

HTTP::Balancer::Model - the base class of models of HTTP::Balancer

=head1 SYNOPSIS

    package HTTP::Balancer::Model::Foo;
    use Modern::Perl;

    use Moose;
    extends qw(HTTP::Balancer::Model);

    use MoooseX::Storage;
    with Storage(format => 'YAML', io => 'File');

=head1 FUNCTIONS AND METHODS

=head2 models

lib/HTTP/Balancer/Model/Backend.pm  view on Meta::CPAN

package HTTP::Balancer::Model::Backend;
use Modern::Perl;
use Moose;
use MooseX::Storage;
extends qw( HTTP::Balancer::Model );

with Storage(
    format  => 'YAML',
    io      => 'File',
);

has id => (

lib/HTTP/Balancer/Model/Host.pm  view on Meta::CPAN

package HTTP::Balancer::Model::Host;
use Modern::Perl;
use Moose;
use MooseX::Storage;
extends qw( HTTP::Balancer::Model );

with Storage(
    format  => 'YAML',
    io      => 'File',
);

has [qw(id port)] => (

lib/HTTP/Balancer/Role.pm  view on Meta::CPAN

package HTTP::Balancer::Role;

=head1 NAME

HTTP::Balancer::Role - base of all roles in HTTP::Balancer

=head1 SYNOPSIS

    package HTTP::Balancer::Role::Any;
    use Modern::Perl;
    use Moose::Role;
    with qw(HTTP::Balancer::Role);

    # your code goes here

    no Moose::Role;

=cut

use Modern::Perl;

use Moose::Role;

=head2 model($name)

given the last name of a model, returns the whole name of the model, and requires this model.

=cut

sub model {

lib/HTTP/Balancer/Role/Command.pm  view on Meta::CPAN

package HTTP::Balancer::Role::Command;

use Modern::Perl;

use Moose::Role;

use Namespace::Dispatch;

with qw( HTTP::Balancer::Role
         MooseX::Getopt::Dashes );

around _usage_format => sub {
    my $orig = shift;

lib/HTTP/Balancer/Role/Stem.pm  view on Meta::CPAN

package HTTP::Balancer::Role::Stem;
use Modern::Perl;
use Moose::Role;

with qw( HTTP::Balancer::Role::Command );

around _getopt_get_options => sub {
   my ($orig, $self, $params, $opt_spec) = @_;
   my $command_name = $self->command_name;
   my $subcommands  = join(" | ", @{$self->leaves});
   Getopt::Long::Descriptive::describe_options("usage: %c $command_name [ $subcommands ]");
};

lib/HTTP/Balancer/Role/Stem.pm  view on Meta::CPAN


HTTP::Balancer::Role::Stem - subcommand presenter for command handlers

=head1 SYNOPSIS

    package HTTP::Balancer::Command::Any::Foo;

    package HTTP::Balancer::Command::Any::Bar;

    package HTTP::Balancer::Command::Any;
    use Modern::Perl;
    use Moose;
    with qw( HTTP::Balancer::Role::Command
             HTTP::Balancer::Role::Stem );

    sub run {
    }

=head1 DESCRIPTION

    $ http-balancer any



( run in 0.669 second using v1.01-cache-2.11-cpan-a5abf4f5562 )