Hello everyone. Is it allowed to have a "use" statement inside an eval that is compiled separately to the enclosing program (i.e. eval EXPR, not eval BLOCK). The reason I want to do this is, I have modules of code that I don't want to be compiled every time my script is run as they will not be needed very often. One of them contains Digest::MD5 which is quite bulky. I tried running these modules as child processes with:

$pwd_hash = `perl password_md5.pl $field[1]`;

This worked on my test server, but not on my host server which doesn't seem to allow this kind of behaviour. I'm looking into that issue. I came up with the solution of loading the modules from a file at runtime and passing the code to an eval EXPR. This works with one of them and should be more efficient as it avoids the overhead incurred from starting a new process or thread. The other module includes:

use Digest::MD5;

and this seems to be causing a problem. Is it possible to use "use" inside an eval like this, or will I have to include the MD5 :: Digest code manually? Any advice appriciated.

Steven.

This article has been dead for over six months. Start a new discussion instead.