First you should use DBD::Pg;
after use DBI;
Secondly add DBI->errstr
for more proper error
my $dbh = DBI->connect("DBI:Pg:dbname=".$dbname.";host=".$host, $username, $pass, {'RaiseError' => 1}) or die DBI->errstr;
Third you should be able to connect to psql from commandline before triyng from DBI
psql -h 10.0.0.3 -U username -d dbname -p 5432
(Please check syntax)