/usr/share/doc/libpod-index-perl/examples/perldoc-k.cgi is in libpod-index-perl 0.14-2.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | #!/home/ivan/bin/perl
use strict;
use warnings;
no warnings qw(uninitialized);
use CGI ();
use Template;
use lib qw(pod-indexing-snapshot/lib pod-indexing-snapshot/);
use Pod::Perldoc;
my $cgi = CGI->new;
print $cgi->header;
my $keyword = $cgi->param('keyword');
my $nocase = $cgi->param('nocase');
my $pod;
my $err;
my $out;
if (defined $keyword) {
open my $fh_out, ">", \$out or die;
open my $fh_err, ">", \$err or die;
my $old_stdout = *STDOUT;
*STDOUT = $fh_out;
*STDERR = $fh_err;
push @ARGV, qw(-MPod::Perldoc::ToHTML -T -k), $keyword;
push @ARGV, '-i' if $nocase;
eval { Pod::Perldoc->run() };
$err .= $@;
($pod) = $out =~ /<body.*?>(.*)<\/body>/s;
*STDOUT = $old_stdout;
}
my $tt = Template->new;
$tt->process(\*DATA, {
pod => $pod,
err => $err,
keyword => $keyword,
nocase => $nocase,
script_name => $0,
}) or die;
__DATA__
<html>
<head>
<title>perldoc -k demo</title>
<link rel="stylesheet" type="text/css" href="http://search.cpan.org/s/style.css">
<style type="text/css">
.err { color: red }
.pod { width: 640px; margin-left: 30px }
.pod h1 { font-size: 130% }
.pod h2 { font-size: 120% }
.pod h3 { font-size: 110% }
.pod h4 { font-size: 100% }
.k { color: green; font-family: monospace }
a.u { color:black; text-decoration: none; }
</style>
</head>
<body>
<div id="header"><a href="/">POD Indexing Project</a></div>
<h1><i>perldoc -k</i> demo</h1>
<form action="/[% script_name %]">
Keyword to search: <input name="keyword" value="[% keyword | html %]">
<input type="submit">
<br><input type="checkbox" id="nocase" name="nocase" value="1" [% 'checked="checked"' IF nocase %]> <label for="nocase">Case-insensitive</label>
</form>
<hr>
[% IF keyword %]
<p>Searched for `<span class="k">[% keyword | html %]</span>'</p>
[% END %]
[% IF err %]
<div class="err">
[% err %]
</div>
[% END %]
[% IF pod %]
<div class="pod">[% pod %]</div>
[% END %]
</body>
</html>
|