CPAN

Category: perl

WARNING: If you install perl modules using CPAN as root, there is a risk that upgrading to a new OpenBSD release will cause library version mismatches and break existing perl scripts.

Instead, if you need to install packages system-wide, use openbsd's prepared packages. You can search for them in the ports tree then install them with pkg_add.

For example, to instal the local::lib module:

$ doas pkg_add p5-local-lib

If a package is not available, consider using the local::lib module that comes with CPAN. The command is:

$ cpan -I $MODULE

Replace $MODULE with the module name.

Then, include this line in your perl script before using the module:

use local::lib;

Note: This page should probably have more details and be on a bugs/troubleshooting page for openbsd.

Custom umask will cause an incorrect permissions for some perl dirs, created during cpan usage. As result only you will have access to the required perl libraries. It is importan if you wanna to share those libraries with other users. You need set umask to default value before execute cpan.

The default mask value is S_IWGRP|S_IWOTH (022, write access for the owner only). (man umask) y

NOTE: If you have perl related issues after upgrading that prevent running pkg_add, you can resolve the conflicts by moving /usr/local/libdata/perl5 directory out of the way and running pkg_add again.

If perl libraries have the wrong dependency versions, you can have CPAN recompile all modules:

$ perl -MCPAN -e 'recompile()'