Skip to content

Commit

Permalink
small optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Sep 17, 2013
1 parent e4bc37f commit 9185d2b
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/Mojolicious/Plugin/PODRenderer.pm
Expand Up @@ -44,10 +44,9 @@ sub _perldoc {
my $path = Pod::Simple::Search->new->find($module, @PATHS);
return $self->redirect_to("http://metacpan.org/module/$module")
unless $path && -r $path;
my $html = _pod_to_html(slurp $path);

# Rewrite links
my $dom = Mojo::DOM->new("$html");
my $dom = Mojo::DOM->new(_pod_to_html(slurp $path));
my $perldoc = $self->url_for('/perldoc/');
$dom->find('a[href]')->each(
sub {
Expand Down Expand Up @@ -108,7 +107,7 @@ sub _perldoc {
}

sub _pod_to_html {
return undef unless defined(my $pod = shift);
return '' unless defined(my $pod = shift);

# Block
$pod = $pod->() if ref $pod eq 'CODE';
Expand Down

0 comments on commit 9185d2b

Please sign in to comment.