DevonThink and perldoc

I’ve discovered the script for importing manpages into devonThink, which is great. Has anyone tinkered with it or made another script that can import perldoc pages? I would really like that.


This script should work:

-- Perldoc
-- DevonThink Pro
-- Created by Christian Grunenberg on Sat Sep 17 2005.
-- Copyright (c) 2005. All rights reserved.

tell application "DEVONthink Pro"
			display dialog "Enter the page, module, program or function:" default answer "" buttons {"Cancel", "OK"} default button 2
			set theCmd to the text returned of the result
			if theCmd is not "" then exit repeat
		end repeat
			set theOutput to do shell script "perldoc " & (quoted form of theCmd) & " | col -b"
			if length of theOutput is 0 then error
		on error
			set theOutput to do shell script "perldoc -f " & (quoted form of theCmd) & " | col -b"
		end try
		if length of theOutput is greater than 0 then
			create record with {name:theCmd, type:txt, plain text:theOutput}
			error "No documentation found for \"" & theCmd & "\"."
		end if
	on error error_message number error_number
		if the error_number is not -128 then
				display alert "DEVONthink Pro" message error_message as warning
			on error number error_number
				if error_number is -1708 then display dialog error_message buttons {"OK"} default button 1
			end try
		end if
	end try
end tell

Works perfectly!