Also bear in mind this script can only be made worked on the environment where client and the server are on the same system.
This is not quite true. As long as an OS authenticated user can connect to your database he can connect via perl DBI. In fact, this his how I run a lot of anonymous web-server sessions.