You should probably be using
PERL_MM_OPT= PERL_MB_OPT= sudo cpan DBD::Pg
First of all, you shouldn't be installing in vendor_perl.
Perl has three levels of install directories: One for modules part of Perl ("core"), one for the modules provided by the organization providing perl ("vendor"), and one for module installed by end users ("site"). Site modules override vendor modules, and vendor modules override core modules.
You should be installing into the site directory. That directory can be obtained as follows:
perl -V:installsitelib
For the perl from Ubuntu 20.04.3 LTS, that's
installsitelib='/usr/local/share/perl/5.30.0';
On to the question.
Installing a distribution installs more than just the module.
All of the following are installed into different directories:
- Modules without build-specific components
- Modules with build-specific components
- Executables without build-specific components
- Executables with build-specific components
- Documentation for modules
- Documentation for executables
INSTALL_BASE="$base" is a convenient way of providing all those locations at once. It's equivalent to
eval "$( perl -V:archname )"
INSTALLPRIVLIB="$base/lib/perl5" \
INSTALLARCHLIB="$base/lib/perl5/$archname" \
INSTALLSCRIPT="$base/bin" \
INSTALLBIN="$base/bin" \
INSTALLMAN3DIR="$base/man/man3" \
INSTALLMAN1DIR="$base/man/man1"
As you wish to use some other pattern, you will need to specify them individually.
(INSTALLARCHLIB is maybe built from INSTALLPRIVLIB if not provided?)
That said, it looks like you want to install the modules for the system-provided Perl. In that case, you should provide nothing at all.
PERL_MM_OPT= PERL_MB_OPT= ( perl Makefile.PL && make test && sudo make install )
I'd use the following, which also installs any required dependency:
PERL_MM_OPT= PERL_MB_OPT= sudo cpan DBD::Pg
The following shows to what paths files will be installed:
for n in \
installsitelib \
installsitearch \
installsitescript \
installsitebin \
installsiteman3dir \
installsiteman1dir
do
perl -V:"$n"
done
For the perl from Ubuntu 20.04.3 LTS, that's
installsitelib='/usr/local/share/perl/5.30.0';
installsitearch='/usr/local/lib/x86_64-linux-gnu/perl/5.30.0';
installsitescript='/usr/local/bin';
iinstallsitebin='/usr/local/bin';
installsiteman3dir='/usr/local/man/man3';
installsiteman1dir='/usr/local/man/man1';