Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
show how to run multiple web servers concurrently
  • Loading branch information
kraih committed Nov 1, 2015
1 parent ce570fa commit 7278488
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

6.28 2015-10-30
6.28 2015-11-01
- Improved build_app method in Mojo::Server to work more like the load_app
method.
- Fixed multi-line attribute bug in Mojo::DOM::HTML. (jamadam)
Expand Down
4 changes: 2 additions & 2 deletions lib/Mojo/DOM.pm
Expand Up @@ -282,8 +282,8 @@ sub _parent { $_[0]->tree->[$_[0]->type eq 'tag' ? 3 : 2] }
sub _parse { Mojo::DOM::HTML->new(xml => shift->xml)->parse(shift)->tree }

sub _replace {
my ($self, $parent, $tree, @nodes) = @_;
splice @$parent, _offset($parent, $tree), 1, _link($parent, @nodes);
my ($self, $parent, $child, @nodes) = @_;
splice @$parent, _offset($parent, $child), 1, _link($parent, @nodes);
return $self->parent;
}

Expand Down
5 changes: 5 additions & 0 deletions lib/Mojo/Server/Daemon.pm
Expand Up @@ -466,6 +466,11 @@ Start accepting connections through L</"ioloop">.
my $id = $daemon->listen(['http://127.0.0.1'])->start->acceptors->[0];
my $port = $daemon->ioloop->acceptor($id)->port;
# Run multiple web servers concurrently
my $daemon1 = Mojo::Server::Daemon->new(listen => ['http://*:3000'])->start;
my $daemon2 = Mojo::Server::Daemon->new(listen => ['http://*:4000'])->start;
Mojo::IOLoop->start unless Mojo::IOLoop->is_running;
=head2 stop
$daemon = $daemon->stop;
Expand Down

0 comments on commit 7278488

Please sign in to comment.