#!/usr/bin/perl use warnings; use strict; use lib 'module/'; use BSD::BSDoogle; use CGI; use POSIX qw(ceil); my $cgi = new CGI; # Read the input passed to the script. my ( $pkg, $keyword, $page,$OS) = ( $cgi->param('pkgname'), $cgi->param('desc'), $cgi->param('page'),$cgi->param('OS') ); # Open the BSD INDEX file. if($OS eq 'FreeBSD') { openindex(INDEX_FILE => 'database/freebsd.txt') or die("$!"); } # open the FreeBSD INDEX file. elsif($OS eq 'NetBSD') { openindex(INDEX_FILE => 'database/netbsd.txt') or die("$!"); } # open the NetBSD INDEX file. # Search the BSD pkgsrc tree with the search() function, included in BSD::BSDoogle. my($packages,$descriptions,$locations) = search(TITLE => $pkg, KEYWORD => $keyword, CASE_SENSITIVE => 'no'); # Deference the results from search(). my (@packages) = @{$packages}; my (@descriptions) = @{$descriptions}; my (@locations) = @{$locations}; # print our header. print $cgi->header(); # print the
.. start_html(-title => "BSDoogle :: Search results for ".$OS, -style => { -src => '../../../includes/bsdoogle/bsdoogle_results.css' }, -meta => { 'keywords' => 'Search BSD ports,BSD ports,BSD,search pkgsrc,pkgsrc,search the ports,search BSD ports,search BSD pkgsrc,search BSD ports online,search BSD pkgsrc online', 'description' => 'BSDoogle is an online tool you can use to search the Free,Net, and OpenBSD pkgsrc tree' }, -dtd => 'HTML' ); # print if @packages is undefined, or there were no search results. if(not defined(@packages) ) { # place the bsdoogle logo at the top of the page print '