NunoNunes.org

Loading
Entries by year
Entries by month
April
Sun Mon Tue Wed Thu Fri Sat
   
18
     
Powered by Blosxom
Creative Commons License

CPAN search on Firefox

Adding a new search engine plugin for CPAN to Firefox is actually pretty easy, so I’ll write it down here in order not to forget it.

You just have to edit a file by the name of CPAN.xml (or something similar that strikes your fancy) and stick it in firefoxe’s searchplugins directory. You might find it somewhere around /usr/lib/firefox-XX/searchplugins or, better yet, in you own homedir at .mozilla/firefox/XXXXXX.default/searchplugins).

Enter the following content into the file:

<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>

The long line there is the funny little camel picture, and it must not be broken up.

It is actually trivial to create plugins to almost any search engine you can think of, this is just a good example that is handy for me.
If you need to add any extra parameters or so to the search, you can find the documentation for the search plugins at the mozilla developer center.

Note: Credit where it is due, I found the original example here and pretty much copied it over to this post with the minor fix of substituting the & Url element for the encoded version (&amp;).

About this entry

Originally written on Apr 18, 2008 @ 11:46
Read article on it's own page (permalink)

The content of this site is licensed under a Creative Commons Attribution-Noncommercial-Share Alike 2.5 License.