in reply to Net::SFTP hangs in apache environment

Are you running your scripts from the shell and from Apache as the same user? Net::SSH::Perl reads its configuration from ~/.ssh/config.

Have you installed modules in some custom path that has not been configured on mod_perl? Try running your programs with strace (or similar) and check that both versions use the same modules.

Besides that, Net::SFTP has not been maintained since a long time ago and have lots of unsolved bugs. Try using Net::SFTP::Foreign (or Net::SFTP::Foreign::Compat) instead.