|There's more than one way to do things|
You should use $exp->log_file to log the debug output to a file instead of to STDOUT while running the script in apache. Look for differences in the log to what you see in the log when you execute it on the command line/terminal
Getting eof probably means that the mod_perl version of the script doesn't get any output from the units script. Do you see the output maybe in your browser page (highly unlikely)?
Very important: Check apache log files for any hints of what is happening
Expect FAQ says this:
If your apache uses threads instead of forks, this might be a problem. I'm not sure about apache, on linux it should probably use fork (if you do "ps -ef" on the command line, you should see multiple lines with "httpd" or "apache"). On windows it probably uses threads
As a test you could change the execution of "units" to a simple "echo you have" and look at the log output. If that changes anything your apache seems to have problems executing units. But then you should have found out about this in the log files, so this test is just to make double sure it is not the units program that is the problem
You could ask the mailing list mentioned in the documentation (expectperl-discuss) if they know whether expect is generally working or not working in mod_perl