     return unless robot.brain.data.eval?[msg.message.user.name]?.recording
     code = robot.brain.data.eval[msg.message.user.name].code?.join("\n")
     lang = robot.brain.data.eval[msg.message.user.name].lang
-    
+
     is_valid = (valid) ->
       if not valid
         msg.send "Unknown language #{lang} - use eval list command for languages"
         return
 
-      msg
-        .http("http://api.dan.co.jp/lleval.cgi")
-        .query(s: "#!/usr/bin/#{lang}\n#{code}")
-        .get() (err, res, body) ->
-          out = JSON.parse(body)
-          ret = out.stdout or out.stderr
-          msg.send ret.split("\n")
+      run_eval(lang, code, msg)
       delete robot.brain.data.eval[msg.message.user.name]
 
     lang_valid(robot, lang, is_valid)

  robot.respond /eval[,:]? +on +([a-z]+) *$/i, (msg) ->
    robot.brain.data.eval or= {}
    lang = msg.match[1]
    
    is_valid = (valid) ->
      if not valid 
        msg.send "Unknown language #{lang} - use eval list command for languages"
        return


          return
      callback(false)

  run_eval = (lang, code, msg) ->
    command = robot.brain.data.eval_langs[lang]
    msg
      .http("http://api.dan.co.jp/lleval.cgi")
      .query(s: "#!/usr/bin/#{command}\n#{code}")
      .get() (err, res, body) ->
        out = JSON.parse(body)
        ret = out.stdout or out.stderr
        msg.send ret.split("\n")

  robot.brain.on 'loaded', ->
    ready = true
    get_languages robot
