What if you try embedding your code snippets inside a subroutine and doing eval on that? This would not cause the code to execute and would give you various warning messages (by inspecting the $@ variable) that you may be looking for?
Update: Missed bbfu's reply, but essentially that's what I was trying to say here ;-)