Skip to content


Perl Ubiquity commands

Inspired by IrishWonder’s excellent set of SEO commands for Ubiquity for the awesome Firefox plugin Ubiquity, I’ve knocked up a couple of Ubiquity commands for Perl users – a useful direct CPAN search function and a search of the Perldoc.org website.

Simply bring up Ubiquity with CTRL-Space and enter ‘help’. Then past the commands below into the text box in the “Command Editor” tab and close the window to use them (commands in the text box will be saved automatically).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
CmdUtils.CreateCommand({
name: "cpan",
icon: "http://search.cpan.org/favicon.ico",
description: "Search the CPAN Perl repository",
homepage: "http://www.robbiehammond.com/",
author: { name: "Rob Hammond", email: "rob@robbiehammond.com"},
license: "GPL",
takes: {URL: noun_arb_text},
preview: function(pblock, directObject) {
searchText = jQuery.trim(directObject.text);
if(searchText.length < 1) {
pblock.innerHTML = "Searches CPAN for modules";
return;
}
var previewTemplate = "Perform a CPAN lookup for <b>${query}</b>";
var previewData = {query: searchText};
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData);
},
execute: function(directObject) {
var url = "http://search.cpan.org/search?query={QUERY}&amp;amp;amp;amp;mode=all";
var query = directObject.text;
var urlString = url.replace("{QUERY}", query);
Utils.openUrlInBrowser(urlString);
}
});

CmdUtils.CreateCommand({
name: "perldoc",
icon: "http://perldoc.perl.org/favicon.ico",
description: "Search Perldoc.org",
homepage: "http://www.robbiehammond.com/",
author: { name: "Rob Hammond", email: "rob@robbiehammond.com"},
license: "GPL",
takes: {URL: noun_arb_text},
preview: function(pblock, directObject) {
searchText = jQuery.trim(directObject.text);
if(searchText.length < 1) {
pblock.innerHTML = "Searches Perldoc";
return;
}
var previewTemplate = "Perform a Perldoc lookup for <b>${query}</b>";
var previewData = {query: searchText};
pblock.innerHTML = CmdUtils.renderTemplate(previewTemplate, previewData);
},
execute: function(directObject) {
var url = "http://perldoc.perl.org/search.html?q={QUERY}";
var query = directObject.text;
var urlString = url.replace("{QUERY}", query);
Utils.openUrlInBrowser(urlString);
}
});

If I write any more useful Ubiquity commands or update these I’ll set up a proper subscribe page ;)

  • Digg
  • del.icio.us
  • Sphinn
  • Google Bookmarks
  • Facebook
  • TwitThis
  • E-mail this story to a friend!

Posted in firefox, ubiquity. Tagged with , , .

0 Responses

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.