Created
March 16, 2010 21:17
-
-
Save frodwith/334533 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Drop into ~/Library/Application Support/Colloquy/PlugIns | |
import re | |
from Foundation import * | |
get_module = re.compile(r'(?:cpan:)?(?P<module>\w+(?:::\w+)*)$') | |
def open_perldoc(module): | |
url = NSURL.URLWithString_('http://search.cpan.org/perldoc/' + module) | |
NSWorkspace.sharedWorkspace().openURL_(url) | |
def handleClickedLink(url, view): | |
matches = get_module.match(url.absoluteString()) | |
if (matches): | |
open_perldoc(matches.group('module')) | |
return True | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment