no point putting eval in there, your going to need to use that when you pull it back out. assuming thats what your trying to do. eval is one of those functions you've gotta be real carefull with, generally, if you need to use eval, your probably doing something the wrong way.
anyway, your $eval_code varable would need to look like this.
$eval_code = "$test = gettemplate(\"test\");";
ps: you might want to ditch that sig, its very confusing.