-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
103 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
package Angelos::PSGI::Engine; | ||
use Mouse; | ||
use Angelos::Types qw( Interface ); | ||
|
||
has 'interface' => ( | ||
is => 'ro', | ||
isa => Interface, | ||
handles => [qw(run)], | ||
coerce => 1, | ||
); | ||
|
||
__PACKAGE__->meta->make_immutable( inline_destructor => 1 ); | ||
1; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package Angelos::PSGI::ServerGatewayBuilder; | ||
use strict; | ||
use warnings; | ||
|
||
sub build { | ||
my ( $class, $module, $args ) = @_; | ||
if ( $module !~ s{^\+}{} ) { $module = join( '::', "Plack", "Impl", $module ); | ||
} | ||
Mouse::load_class($module); | ||
|
||
# FIXME need to develop standalone Plack::Impl wrapper | ||
# looks ugly... | ||
# we need to wrap Plack::Impl or | ||
if ( $module eq 'Plack::Impl::ServerSimple' ) { | ||
my $server = $module->new( $args->{port} ); | ||
$server->host( $args->{host} ); | ||
$server->psgi_app( $args->{psgi_handler} ); | ||
return $server; | ||
} | ||
|
||
if ( $module eq 'Plack::Impl::AnyEvent' ) { | ||
$module->new( port => $args->{port}, host => $args->{host} ); | ||
return $module; | ||
} | ||
} | ||
|
||
1; | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
package Angelos::Request; | ||
use base qw/Plack::Request/; | ||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
package Angelos::Response; | ||
use base qw(Plack::Response); | ||
|
||
1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package Angelos::Types; | ||
use Mouse; | ||
use Angelos::PSGI::ServerGatewayBuilder; | ||
use MouseX::Types - declare => [ | ||
qw( | ||
Interface | ||
) | ||
]; | ||
use MouseX::Types::Mouse qw(HashRef); | ||
|
||
subtype Interface; | ||
|
||
coerce Interface, from HashRef, via { | ||
my $module = $_->{module}; | ||
my $args = $_->{args}; | ||
$args->{psgi_handler} = $_->{psgi_handler}; | ||
|
||
use Data::Dumper; | ||
warn $module; | ||
warn Dumper $args; | ||
my $server = Angelos::PSGI::ServerGatewayBuilder->build( $module, $args ); | ||
return $server; | ||
}; | ||
|
||
1; |