Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Remove defunct /search/ handler

  • Loading branch information...
commit 14c8d2106a2ee9d558992b2fd7b46c3c4a71af26 1 parent b067fa8
@abh abh authored
View
4 apache/conf/sites/www.pl
@@ -1,4 +0,0 @@
-use strict;
-use PerlOrg::Control::Search;
-
-1;
View
5 apache/conf/sites/www.tmpl
@@ -15,11 +15,6 @@
PerlHandler +PerlOrg::Control::Books->super
</Location>
- <Location /search>
- SetHandler perl-script
- PerlHandler PerlOrg::Control::Search->super
- </Location>
-
<Location /server-status>
SetHandler server-status
</Location>
View
4 dist.ini
@@ -23,7 +23,3 @@ Date::Calc = 0
File::Slurp = 0
-; to be removed
-Yahoo::Search = 0
-
-
View
87 docs/www/search/results.html
@@ -1,87 +0,0 @@
-[% page.css_more.push('/css/search.css') %]
-[% USE search_url = url('/search', q => query, p => page, c => count_per_page) %]
-
-<p>
-<form action="/search" method="get">
-Perl.org Search: <input type="text" name="q" value="[% query | html %]" size="50">
-<input type="submit" name="btn" value="Search">
-</form>
-</p>
-
-[% IF spell AND spell.Count %]
-<p>Did you mean [% FOR suggestion = spell.Terms %]
-<a href="/search?q=[% suggestion | uri %]">[% suggestion | html %]</a>
-[% END %]
-</p>
-[% END %]
-
-[% IF cpan AND cpan.matches %]
-<div id="cpansearchbox">
-<p><b><a href="http://search.cpan.org/">CPAN Search</a></b></p>
-<p>
-
-[% FOR result = cpan.results %]
-<a href="[% result.link | uri %]">[% result.name %]</a><br />
-[% IF result.description %]
-[% result.description | html %] -
-[% END %]
-[% IF result.released %]
-<span class="cpansearchbox_meta">version [% result.version %], released [% result.released %]</span>
-<br />
-[% END %]
-<br />
-[% END %]
-
-</p>
-
-<a href="http://search.cpan.org/search?mode=all&query=[% query | html %]">[% cpan.matches%] results on search.cpan.org</a>
-</div>
-[% END %]
-
-[% IF search %]
-
-[% UNLESS search.Count %]
-No results ...
-[% END %]
-
-
-[% page_navigation = BLOCK %]
-[% IF search.FirstOrdinal > 0 %]
-<a href="[% search_url('p' => 1) %]">&lt;&lt;</a>
-| <a href="[% p = page_number - 1; search_url('p' => p); %]">&lt;</a>
-[% END %]
-
-[% IF search.CountAvail > search.FirstOrdinal + search.Count %]
-| <a href="[% p = page_number + 1; search_url('p' => p); %]">&gt;</a>
-[% END %]
-
-</p>
-[% END %]
-
-[% page_navigation %]
-
-[% WHILE (result = search.NextResult) %]
-
-[% result.I(',') %]: <a href="[% result.ClickUrl %]">[% result.Title | html %]</a>
-<br />
-[% result.SummaryAsHtml %]
-
-<br />
-<span class="searchMeta">
-[% result.Type != 'text/html' ? result.Type : '' %]
-size: [% result.CacheSize %]
-</span>
-
-</p>
-
-[% END %]
-
-<p>
-[% page_navigation %]
-
-[% END %]
-
-
-
-
-
View
64 lib/PerlOrg/Control/Search.pm
@@ -1,64 +0,0 @@
-package PerlOrg::Control::Search;
-use strict;
-use base qw(Combust::Control);
-use Yahoo::Search;
-use Combust::Constant qw(OK);
-use LWP::Simple qw(get);
-use XML::Simple qw(XMLin);
-
-my $yahoo = Yahoo::Search->new(AppId => 'perl.org-search');
-
-sub handler {
- my $self = shift;
-
- my $query = $self->req_param('q');
- my $page = $self->req_param('p') || 1;
- my $count = $self->req_param('n') || 15;
- my $maxcount = $yahoo->MaxCount('Doc');
- $count = $maxcount if $count > $maxcount;
-
- $self->tpl_param('count_per_page' => $count);
- $self->tpl_param('page_number' => $page);
-
- my $start = ($page * $count) - $count;
-
- if ($query) {
- my $site = 'site:perl.org -site:use.perl.org';
- my $search = $yahoo->Query(Doc => $query . " $site",
- Start => $start,
- Count => $count,
- );
-
- if ($search->CountAvail < 10) {
- my $spell = $yahoo->Query(Spell => $query);
- $self->tpl_param(spell => $spell);
- #warn Data::Dumper->Dump([\$spell], [qw(spell)]);
- }
-
- #my $related= $yahoo->Query(Related => $query);
- #$self->tpl_param(related => $related);
- #warn Data::Dumper->Dump([\$related], [qw(related)]);
-
- $self->tpl_param(search => $search);
- $self->tpl_param(query => $query);
- #warn Data::Dumper->Dump([\$search], [qw(search)]);
-
- if ($page == 1) {
- my $xml = get("http://search.cpan.org/search?mode=all&format=xml&n=5&query=". $query);
- my $cpan = XMLin($xml, KeepRoot => 0, KeyAttr => [], ForceArray => [qw(author dist module)]);
- for my $type (qw(module dist author)) {
- push @{$cpan->{results}}, @{$cpan->{$type}}
- if $cpan->{$type};
- }
- warn Data::Dumper->Dump([\$cpan], [qw(cpan)]);
-
- $self->tpl_param('cpan', $cpan);
- }
- }
-
- $self->send_output(scalar $self->evaluate_template('search/results.html'));
- return OK;
-
-}
-
-1;
Please sign in to comment.
Something went wrong with that request. Please try again.