#!/usr/bin/perl
use strict;
use warnings;
use CGI ":standard";
use POSIX qw/uname/;
use HTML::Perlinfo::Modules;
print
header(),
start_html(-title => "Perl Module Search on @{[ (uname)[0..2] ]}",
-head => style({type => 'text/css'},
join('',<DATA>)
),
),
h1("Search Perl modules on @{[ (uname)[0..2] ]}");
print
div({-style => "float:left; width: 20%;"},
h3("Separate names with commas"),
start_form(-method => "get",
-enctype => "application/x-www-form-urlencoded",
-onsubmit => "return this._x ? false : ( this._x =
+true )"),
textfield("query"),
br(),
h3("Search from:"),
textfield("from"),
br(),
h3("Sort modules by:"),
radio_group(-name=>'sort',
-values=>['Name','Version'],
-default=>'Name'),
p(),
submit(),
end_form(),
);
if ( my $query = param("query") ) {
my $module = HTML::Perlinfo::Modules
->new
->print_modules( show_only => [split(/, */, $query)],
from => param("from") ? param("from") : \@INC,
sort_by => param("sort") eq 'Version' ?
+ 'version' : 'name',
full_page => 0 );
print
div({-style => "float:left; width: 75%; margin-left: 2%"},
$module || h2("No modules found"),
);
}
print end_html();
__DATA__
body {
font: 11px/13px helvetica-neue, helvetica, sans-serif;
color: #001;
}
a:link {color: #000099; text-decoration: none;}
a:hover {text-decoration: underline;}
table {border-collapse: collapse; width: 100%;}
.center {text-align: center;}
.center table { margin-left: auto; margin-right: auto; text-align: lef
+t;}
.center th { text-align: center !important; }
td, th { border: 1px solid #001; }
.modules table {border: 0;}
.modules td { border:0;}
.modules th { border:0;}
.p {text-align: left;}
.e {background-color: #ccf; font-weight: bold; }
.h {background-color: #99c; font-weight: bold; }
.v {background-color: #ccc; }
i {color: #666666; background-color: #ccc;}
__END__
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.