App-perldolicious
view release on metacpan or search on metacpan
bin/perldolicious view on Meta::CPAN
modules => $modules,
matches => scalar(@$modules),
);
}
else {
$self->render_exception("Could not find modules that match $pattern");
}
};
get '/doc/:module' => sub {
my $self = shift;
my $module = $self->param('module');
(my $distname = $module) =~ s{::}{-}g;
my $release_date = Module::CoreList->first_release($module);
my @known_temp_dirs = (qr{/var/folders}, qr{/tmp/}, qr{Local\\Temp});
my $location = Module::Path::module_path($module);
$location = undef if $location and grep { /$location/ } @known_temp_dirs;
$self->render(
template => "doc",
module => $module,
distname => $distname,
doc => $self->perldoc($module),
location => $location,
release_date => $release_date,
source_code_url => $self->url_for("/doc/$module/source"),
);
};
get '/doc/:module/source' => sub {
my $self = shift;
my $module = $self->param('module');
$self->render(
module => $module,
template => 'source',
source_code => $self->perldoc($module, {source => 1}),
);
};
app->mode('production');
app->initialize;
app->defaults(layout => 'index');
app->start;
__DATA__
@@ css/main.css
body {
font-family: calibri, sans-serif
}
@@ layouts/index.html.ep
<!doctype html>
<html>
<head>
<meta charset="utf-8" />
<title><%= title %> - <%= ucfirst(app->moniker) %></title>
<link rel="stylesheet" href="<%= url_for( '/css/main.css' ) %>" />
</head>
<body>
<%= content %>
</body>
</html>
@@ exception.production.html.ep
% title 'Error';
<blink style="color: red"><%= $exception->message %></blink>
@@ index.html.ep
% title "Search modules";
<p>Search modules (regexp)</p>
<form action="<%= $action_url %>" method="POST">
<input type="text" name="pattern" />
<input type="submit" value="Search" />
<p>Options</p>
Ignore case:
<input type="checkbox" name="ignoreCase" checked />
</form>
@@ results.html.ep
% title "Search results for $pattern";
<p>Found <%= $matches %> matches for <code><%= $pattern %></code></p>
<ul>
% for my $module (@$modules) {
<li>
<a href="<%= url_for ( '/doc/' . $module ) %>">
<%= $module %>
</a>
</li>
% }
</ul>
@@ doc.html.ep
% title "$module";
<p>See the
<a href="<%= $source_code_url %>">
source code
</a>
</p>
% if ($location) {
<p>
<code><%= $module %></code>
is installed in
<code><%= $location %></code>
</p>
% } else {
<!-- redundant? -->
<p><code><%= $module %></code> is not installed on your system.</p>
( run in 2.536 seconds using v1.01-cache-2.11-cpan-99c4e6809bf )