Skip to content

Commit

Permalink
Beginnings of URL handling for source files. We'll want to unzip them…
Browse files Browse the repository at this point in the history
… on the fly if they haven't already been unzipped.
  • Loading branch information
oalders committed Nov 28, 2010
1 parent ad84ae0 commit befd8d7
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
20 changes: 20 additions & 0 deletions lib/Plack/Middleware/CPANSource.pm
@@ -0,0 +1,20 @@
package Plack::Middleware::CPANSource;

use parent qw( Plack::Middleware );

use Data::Dump qw( dump );
use Modern::Perl;

sub call {
my($self, $env) = @_;
# Do something with $env

say dump( $env );
# $self->app is the original app
my $res = $self->app->($env);

# Do something with $res
return $res;
}

1;
12 changes: 12 additions & 0 deletions source/app.psgi
@@ -0,0 +1,12 @@
use Plack::App::Directory;
use Plack::Builder;

# plackup -I../lib

my $app = Plack::App::Directory->new(root => "/home/cpan/CPAN")->to_app;

builder {
enable "Plack::Middleware::CPANSource";
$app;
};

0 comments on commit befd8d7

Please sign in to comment.