Permalink
Browse files

add skeleton of commands add models

  • Loading branch information...
1 parent 7df2db8 commit 38b5c2d7326b625891299a4ee24698703ae17294 @shelling committed Jan 14, 2013
@@ -5,7 +5,9 @@ with qw(HTTP::Balancer::Role::Command);
sub run {
my ($self, ) = @_;
-
+ $self->model("Backend")
+ ->new(address => $self->extra_argv->[2])
+ ->save;
}
1;
@@ -5,7 +5,9 @@ with qw(HTTP::Balancer::Role::Command);
sub run {
my ($self, ) = @_;
-
+ $self->model("Host")
+ ->new(name => $self->extra_argv->[2])
+ ->save;
}
1;
@@ -32,6 +32,19 @@ sub prepare {
return $self;
}
+=head2 model()
+
+given the last name of a model, returns the whole name of the model, and requires this model.
+
+=cut
+
+sub model {
+ my ($self, $name) = @_;
+ my $model = "HTTP::Balancer::Model::$name";
+ eval qq{use $model};
+ return $model;
+}
+
no Moose::Role;
1;

0 comments on commit 38b5c2d

Please sign in to comment.