You can try Safe for restricting string eval but remember that there is no warranty of 100% safety. A bug in Perl or in this module can lead to a security hole.
Sorry if my advice was wrong.
Comment on Re^3: Is this reliable way to cast from BOOL to NUMBER?