-- XPerl_SlashHandler
local function XPerl_SlashHandler(msg)
	local args = {}

	for value in string.gmatch(msg, "[^ ]+") do
		tinsert(args, string.lower(value))
	end
	if (args[1]=="") then
		XPerl_OptionsMenu_Frame:Show()
		return
	end

	if (args[1] == nil or args[1] == "menu" or args[1] == "options") then
		XPerl_UnlockFrames()

	elseif (args[1]=="lock") then
		XPerlLocked = 1
		if (XPerl_RaidTitles) then
			XPerl_RaidTitles()
			if (XPerl_RaidPets_Titles) then
				XPerl_RaidPets_Titles()
			end
		end

	elseif (args[1]=="unlock") then
		XPerlLocked = 0
		if (XPerl_RaidTitles) then
			XPerl_RaidTitles()
			if (XPerl_RaidPets_Titles) then
				XPerl_RaidPets_Titles()
			end
		end
	else
		DEFAULT_CHAT_FRAME:AddMessage("|c00009000Usage: |c00FF0000/xperl menu | lock | unlock|r")
	end
end

SlashCmdList["XPERL"] = XPerl_SlashHandler
SLASH_XPERL1 = "/xperl"
