in reply to doesn't have "getpwuid" function

Instead of Net::SFTP that's mostly unmaintained nowadays, use Net::SFTP::Foreign, on Windows, with the Net::SSH2 backend Net::SFTP::Foreign::Backend::Net_SSH2.

If you are brave enough, you can try the development version of Net::SSH::Any which provides a better backend for Net::SFTP::Foreign. It requires the development versions of libssh2 and Net::SSH2 also.