Skip to content

Commit

Permalink
Adds a cached endpoint to the API
Browse files Browse the repository at this point in the history
  • Loading branch information
oalders committed Apr 24, 2012
1 parent f81e6d3 commit 2e6a63b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
7 changes: 7 additions & 0 deletions lib/MetaCPAN/Pod.pm
Expand Up @@ -38,6 +38,13 @@ sub convert {

}

sub is_cached {
my $self = shift;
my $name = shift;

return $self->mech->is_cached( $self->metacpan_url( $name ) );
}

sub parse_pod {

my $self = shift;
Expand Down
12 changes: 12 additions & 0 deletions lib/Pod2HTML.pm
Expand Up @@ -28,6 +28,18 @@ get '/podpath/**' => sub {

};

get '/from_cache/**' => sub {

my @matches = splat;
my $path = join( "/", @{$matches[0]} );
my $pod = MetaCPAN::Pod->new;

return $pod->convert( $path ) if $pod->is_cached( $path );
status 'not_found';

};


true;

=pod
Expand Down

0 comments on commit 2e6a63b

Please sign in to comment.