Permalink
Browse files

add static files: favicon taken from search.cpan.org and robots.txt t…

…hat disallows every user-agent
  • Loading branch information...
szabgab committed Oct 21, 2014
1 parent 7a623c1 commit 1adde75e60aab8c8f0cf0e8ba42731d09c2024ce
Showing with 16 additions and 1 deletion.
  1. +14 −1 lib/MetaCPAN/SCO.pm
  2. BIN static/favicon.ico
  3. +2 −0 static/robots.txt
View
@@ -4,6 +4,7 @@ use warnings;
use Cwd qw(abs_path);
use File::Basename qw(dirname);
use Plack::Builder;
use Plack::Request;
use Template;
@@ -16,6 +17,8 @@ SCO - search.cpan.org clone
=cut
sub run {
my $root = root();
my $app = sub {
my $env = shift;
@@ -26,12 +29,19 @@ sub run {
return [ '404', [ 'Content-Type' => 'text/html' ], ['404 Not Found'], ];
};
builder {
enable 'Plack::Middleware::Static',
path => qr{^/(favicon.ico|robots.txt)},
root => "$root/static/";
$app;
};
}
sub template {
my ( $file ) = @_;
my $root = dirname(dirname(dirname( abs_path(__FILE__) )));
my $root = root();
my $tt = Template->new(
INCLUDE_PATH => "$root/tt",
@@ -49,6 +59,9 @@ sub template {
return [ '200', [ 'Content-Type' => 'text/html' ], [$out], ];
}
sub root {
return dirname(dirname(dirname( abs_path(__FILE__) )));
}
1;
View
Binary file not shown.
View
@@ -0,0 +1,2 @@
User-agent: *
Disallow: /

0 comments on commit 1adde75

Please sign in to comment.