Oct 28, 2011
jason

How to resolve “Can’t locate DBD/Pg.pm” error

I was having the following perl module missing error.

root@SUNNYVALE-133:/# ./myscript.pl
Can’t locate DBD/Pg.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.10.1 /usr/local/share/perl/5.10.1 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.10 /usr/share/perl/5.10 /usr/local/lib/site_perl .) at ./myscript.pl line 5.
BEGIN failed–compilation aborted at ./myscript.pl line 5.

After googling for a while, most websites directed me to do the following.

$cpan
cpan>install DBI
cpan>install DBD::Pg

Even after I’ve done that, I’m still having the same error message. Eventually I’ve found out that since I’m using Debian, I should rather just install the perl pg library. The following command is the one that solve my problem.

root@SUNNYVALE-133:/#apt-get install libdbd-pg-perl

I hope this would be helpful to you as well if you’re getting the same error message.

Source : Perl DBI Support

Leave a comment