Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

FYI - How to add CPAN as a search plugin for Firefox

45 views
Skip to first unread message

David Filmer

unread,
Apr 2, 2008, 1:42:37 PM4/2/08
to

FWIW, Firefox comes with a several search plugins (Google, Yahoo, etc).
These plugins are just XML files, and you can write your own. I wrote
one to make it just a little bit easier to search CPAN - I figured I'd
put it out here for anyone that's interested.

Name the file CPAN.xml and put it in your Firefox searchplugins
directory. On my OpenSUSE Linux box that is
/usr/lib/firefox/searchplugins
On Windows it should be something like
C:\Program Files\Mozilla Firefox\searchplugins
I dunno about Mac, though there should be a searchplugins directory
wherever Firefox itself is installed.

The encoded stuff is the little camel favicon. It should be all on one
line.

Here is the CPAN search plugin:

<OpenSearchDescription xmlns="http://a9.com/-/spec/opensearch/1.1/"
xmlns:moz="http://www.mozilla.org/2006/browser/search/">
<ShortName>CPAN</ShortName>
<Description>Comprehensive Perl Archive Network</Description>
<InputEncoding>UTF-8</InputEncoding>
<Image width="16"
height="16">data:image/x-icon,%00%00%01%00%01%00%10%10%00%00%00%00%00%00(%01%00%00%16%00%00%00(%00%00%00%10%00%00%00%20%00%00%00%01%00%04%00%00%00%00%00%C0%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%00%FF%FF%FF%00%7B%00%00%00%00%7B%00%00%7B%7B%00%00%00%00%7B%00%7B%00%7B%00%00%7B%7B%00%BD%BD%BD%00%7B%7B%7B%00%FF%00%00%00%00%FF%00%00%FF%FF%00%00%00%00%FF%00%FF%00%FF%00%00%FF%FF%00%00%00%00%00%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%F0%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF%FF3l%FC%BF%EF%18%E6%D7%EB%F0%F6%DB%00%00%FA%E9%00%02%F8%C3al%FC%03te%F8%02Co%F0%02r%20%E0%01%5C%D0%E0%03%11%00%E6%0F%BF%E6'%1F%00%02%07%FF%00%06%87%FF2%80%E3%FF1%E0</Image>
<Url type="text/html"
method="GET"
template="http://search.cpan.org/search?mode=all&amp;query={searchTerms}"/>
<moz:SearchForm>searchFormURL</moz:SearchForm>
</OpenSearchDescription>

Cheers!

smallpond

unread,
Apr 2, 2008, 5:34:16 PM4/2/08
to
> template="http://search.cpan.org/search?mode=all&query={searchTerms}"/>

> <moz:SearchForm>searchFormURL</moz:SearchForm>
> </OpenSearchDescription>
>
> Cheers!


Works great. Thanks!

Two things:

Make sure that the '&' in the template line includes the 'amp;'
escape. That
seems to have gotten lost either in your post or my reader. Check the
XML by
loading the file in your browser.

It can be placed either in the global searchplugins directory or in
your home
directory which on linux is ~/.mozilla/firefox/32rwhuev.default/
searchplugins/


A. Sinan Unur

unread,
Apr 2, 2008, 5:55:02 PM4/2/08
to
David Filmer <use...@davidfilmer.com> wrote in
news:ys6dnXyLoLb...@giganews.com:

> FWIW, Firefox comes with a several search plugins (Google, Yahoo,
> etc). These plugins are just XML files, and you can write your
> own. I wrote one to make it just a little bit easier to search
> CPAN - I figured I'd put it out here for anyone that's interested.

As an alternative, I have always preferred search keywords for this
kind of stuff. Not as sexy, but works.

Go to http://search.cpan.org/ right click in the textfield and
select add a keyword for this search. I set the search domain to
Modules and used 'cpan' for the keyword so that I can type

cpan CGI

in the address box and have Firefox search CPAN modules for CGI.

Sinan
--
A. Sinan Unur <1u...@llenroc.ude.invalid>
(remove .invalid and reverse each component for email address)

comp.lang.perl.misc guidelines on the WWW:
http://www.rehabitation.com/clpmisc/

John Bokma

unread,
Apr 2, 2008, 6:28:37 PM4/2/08
to
David Filmer <use...@davidfilmer.com> wrote:

>
> FWIW, Firefox comes with a several search plugins (Google, Yahoo,
> etc). These plugins are just XML files, and you can write your own. I
> wrote one to make it just a little bit easier to search CPAN - I
> figured I'd put it out here for anyone that's interested.

I am somewhat adicted to smart keywords for this:
http://johnbokma.com/firefox/keymarks-explained.html

(look, it even mentiones cpan :-D

and I've also a perldoc one: http://search.cpan.org/perldoc?%s

).

--
John

http://johnbokma.com/firefox/

szr

unread,
Apr 2, 2008, 8:06:19 PM4/2/08
to

It's your reader. I see the & amp ; in my reader (as well as when
looking at the raw message source), so you may want ot check your
setting. It's likely doing some sort of HTML translation somewhere.

--
szr


jason...@gmail.com

unread,
Apr 6, 2008, 11:17:06 PM4/6/08
to
On Apr 2, 1:42 pm, David Filmer <use...@davidfilmer.com> wrote:

> I dunno about Mac, though there should be a searchplugins directory
> wherever Firefox itself is installed.

On a Mac you can either add it to the Firefox.app directory itself,
normally /Applications/Firefox.app/Contents/MacOS/searchplugins, or
add it to your library directory in ~/Library/Application Support/
Firefox/Profiles/(some random characters).default/searchplugins.

--
Jason Kohles
http://www.jasonkohles.com/

Paul Miller

unread,
Apr 9, 2008, 5:55:16 PM4/9/08
to
On Apr 2, 1:42 pm, David Filmer <use...@davidfilmer.com> wrote:
> FWIW, Firefox comes with a several search plugins (Google, Yahoo, etc).
> These plugins are just XML files, and you can write your own. I wrote
> one to make it just a little bit easier to search CPAN - I figured I'd
> put it out here for anyone that's interested.

Not to be a negative nelly, but I think other's may have beaten you to
it. There are also a few other choices:

http://mycroft.mozdev.org/download.html?name=cpan

Though, honestly, I usually use this one:

http://mycroft.mozdev.org/download.html?name=perl%monks

Then I can search for mod://LWP::UserAgent, doc://perlxs or cpan://RSS
and get usefull answers.

-Paul

mintywalker

unread,
Apr 14, 2008, 6:15:04 AM4/14/08
to
On Apr 2, 9:55 pm, "A. Sinan Unur" <1...@llenroc.ude.invalid> wrote:
> As an alternative, I have always preferred search keywords for this
> kind of stuff. Not as sexy, but works.

There is (imho) one key benefit to the search plugins, over the
location bar search keywords. But it's not standard in most of them
except Google.

The Google search plugin has "keyword suggest". Type in "perl" and it
suggests "perl split", "perlico", "perl hash", etc. Perl is perhaps
not the best example, but I find it's a feature I like a lot.

Most of the other official plugins I've seen don't have this feature
(at least when I last looked). However there is an easy hack to add
them:

Find your local copy of the plugin and add:

<Url type="application/x-suggestions+json" method="get"
template="http://suggestqueries.google.com/complete/search?
output=firefox&amp;qu={searchTerms}"/>

Now you can have a Wikipedia plugin that suggests queries as you type
into the search box. You can do the same for your Perl plugin. Or
Amazon.

I almost switched to location bar search keywords, but having earlier
added the suggest feature to all my other plugins I found I missed it
too much. If anyone knows a way to get the suggestions via the
location bar, do please let me know.

One big downside is that I've not been able to find a way to make the
generic Google Suggest feature site specific. It would be most neat
if I could hack the url above to include "site:cpan.org" and have the
suggestions only come from that site.

That might not be trivial for Google to implement for all sites, but
you'll note that with (not a small) bit of work cpan (or Amazon, BBC,
YouTube etc) could implement their own site-specific version of this
suggest service to contextualize the suggestions in their plugin. I
still find the service useful, even when it's not site specific.

With the caveat that this page was put together entirely for me, so
your mileage may vary, I have hacked the following plugins to include
the Google Suggest feature. It would be much better if the standard
plugins did this themselves I think.

http://minty.org/search/

The reason I have my own Google plugin is because of the cruft that
the official Google Plugin introduces into the url. It doesn't make
for copy&paste friendly. My version generates the shortest url that
delivers the results. One down side is that Mozilla probably don't
get the ad revenue because I've removed the magic url bits that say
"This was a search from a Mozilla product".

ps. Perhaps the cpan people could add a line like this to all their
markup, allowing people to add the plugin direct from the site:

<link rel="search" type="application/opensearchdescription+xml"
title="Search cpan!" href="http://.../cpan.osd" />

0 new messages