Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Perl module search engine

by Your Mother (Bishop)
on Jun 14, 2008 at 21:52 UTC ( #692109=note: print w/replies, xml ) Need Help??

in reply to Perl module search engine

Here is a mildly improved version. HTML::Perlinfo::Modules is something I wouldn't recommend though. In addition to outputting broken non-version specific HTML, it could be replaced with just a bit of custom of code. Mixing display and system info trawling feels dirty, but in a bad way.

use strict; use warnings; use CGI ":standard"; use HTML::Perlinfo::Modules; print header(), start_html(-title => "Perl Module Search", -head => style({type => 'text/css'}, join('',<DATA>) ), ), h1("Search your Perl modules"); print div({-style => "float:left; width: 20%;"}, h3("Search..."), start_form(-method => "get", -enctype => "application/x-www-form-urlencoded", -onsubmit => "return this._x ? false : ( this._x = +true )"), textfield("query"), br(), checkbox("regex"), submit(), end_form(), ); if ( my $query = param("query") ) { my $module = HTML::Perlinfo::Modules ->new ->print_modules( show_only => param("regex") ? qr/$query/i : qr/\Q$query\ +E/, 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;}

Replies are listed 'Best First'.
Re^2: Perl module search engine
by jacques (Priest) on Jun 14, 2008 at 22:46 UTC
    In addition to outputting broken non-version specific HTML, it could be replaced with just a bit of custom of code.

    The HTML doesn't validate, but that's something on my to-do list. Nevertheless, HTML::Perlinfo::Modules is not intended to make your website prettier. Its intent is to show you information about your Perl modules. I've tested the appearance of the HTML on a few browsers and have never encountered an issue.

    Via the full_page option, HTML::Perlinfo::Modules does allow you to insert your own HTML, which you do in your example. You could also set CSS attributes, along with the title of the page, in the constructor. For example:

    $modules = HTML::Perlinfo::Modules->new( bg_image => ' +perlinfo/camel.gif', bg_repeat => 'yes-repeat' );
    If you wanted to offer some code to improve the module, it would be more than welcomed.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://692109]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (10)
As of 2019-12-06 18:12 GMT
Find Nodes?
    Voting Booth?
    Strict and warnings: which comes first?

    Results (157 votes). Check out past polls.