This may be unique to my dev config; however, my config requires that I include db password during cpdb.  E.g.
system("sudo /usr/share/candlepin/cpdb --drop --create --password candlepin")