$OS_ERROR does not contain what you think. Read the DBI connect documentation for how to properly report errors.
Also note that PostgreSQL, by default, refuses most connect / login attempts. See Client Authentication in the PostgreSQL documentation. psql will probably use a different communication path (Unix domain socket) than your perl script (TCP/IP socket via localhost IPv4/IPv6), and the server probably consideres the first one trustworthy, but not the second one.
Alexander
In reply to Re: Trouble Connecting to PostgreSQL with DBD::Pg
by afoken
in thread Trouble Connecting to PostgreSQL with DBD::Pg
by vendion
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |