forked from metacpan/metacpan-api
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Beginnings of URL handling for source files. We'll want to unzip them…
… on the fly if they haven't already been unzipped.
- Loading branch information
Showing
2 changed files
with
32 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; |
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,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; | ||
}; | ||
|