Permalink
Browse files

added Plack::Adapter for plackup

  • Loading branch information...
1 parent bfb10fe commit 258370764dde181dccb3a217713574097f220bb8 @dann committed Sep 8, 2009
Showing with 29 additions and 1 deletion.
  1. +5 −1 angelos-core/lib/Angelos.pm
  2. +24 −0 angelos-core/lib/Angelos/PSGI/Adapter.pm
@@ -187,7 +187,7 @@ sub create_logger {
}
sub setup_cache {
- my $self = shift;
+ my $self = shift;
my $cache = $self->create_cache;
$self->cache($cache) if $cache;
$cache;
@@ -289,6 +289,10 @@ sub res {
shift->response;
}
+sub psgi_adapter {
+ 'Angelos::PSGI::Adapter';
+}
+
__END_OF_CLASS__
__END__
@@ -0,0 +1,24 @@
+package Angelos::PSGI::Adapter;
+use strict;
+use warnings;
+use UNIVERSAL::require;
+
+sub new {
+ my ( $class, $app ) = @_;
+ bless { app => $app }, $class;
+}
+
+sub handler {
+ my $self = shift;
+ my $app = $self->_new_app;
+ return sub { $app->run };
+}
+
+sub _new_app {
+ my $self = shift;
+ my $app = $self->{app};
+ $app->require;
+ $app->new;
+}
+
+1;

0 comments on commit 2583707

Please sign in to comment.