6.7. Using Perl

If MASTER_SITES is set to MASTER_SITE_PERL_CPAN, then the preferred value of MASTER_SITE_SUBDIR is the top-level hierarchy name. For example, the recommended value for p5-Module-Name is Module. The top-level hierarchy can be examined at cpan.org. This keeps the port working when the author of the module changes.

The exception to this rule is when the relevant directory does not exist or the distfile does not exist in that directory. In such case, using author's id as MASTER_SITE_SUBDIR is allowed.

All of the tunable knobs below accept either YES or a version string like 5.8.0+. YES means that the port can be used with any of the supported Perl versions. If a port only works with specific versions of Perl, it can be indicated with a version string, specifying a minimum version (e.g., 5.7.3+), a maximum version (e.g., 5.8.0-) or an exact version (e.g., 5.8.3).

Table 6.5. Variables for Ports That Use Perl
VariableMeaning
USE_PERL5The port uses Perl 5 to build and run.
USE_PERL5_BUILDThe port uses Perl 5 to build.
USE_PERL5_RUNThe port uses Perl 5 to run.
PERLThe full path of the Perl 5 interpreter, either in the system or installed from a port, but without the version number. Use this if you need to replace #!lines in scripts.
PERL_CONFIGUREConfigure using Perl's MakeMaker. It implies USE_PERL5.
PERL_MODBUILDConfigure, build and install using Module::Build. It implies PERL_CONFIGURE.
Read only variablesMeans
PERL_VERSIONThe full version of Perl installed (e.g., 5.8.9).
PERL_LEVELThe installed Perl version as an integer of the form MNNNPP (e.g., 500809).
PERL_ARCHWhere Perl stores architecture dependent libraries. Defaults to ${ARCH}-freebsd.
PERL_PORTName of the Perl port that is installed (e.g., perl5).
SITE_PERLDirectory name where site specific Perl packages go. This value is added to PLIST_SUB.

Note:

Ports of Perl modules which do not have an official website should link to cpan.org in the WWW line of pkg-descr. The preferred URL form is http://search.cpan.org/dist/Module-Name/ (including the trailing slash).

Note:

Do not use ${SITE_PERL} in dependency declarations. Doing so assumes that bsd.perl.mk has been included, which is not always true. Ports depending on this port will have incorrect dependencies if this port's files move later in an upgrade. The right way to declare Perl module dependencies is shown in the example below.

Example 6.2. Perl Dependency Example
p5-IO-Tee>=0.64:${PORTSDIR}/devel/p5-IO-Tee

For Perl ports that install manual pages, the macro PERL5_MANx (where x ranges from 1 to 9) can be used inside pkg-plist. For example

lib/perl5/5.14/man/man3/AnyEvent::I3.3.gz

can be replaced with

%%PERL5_MAN3%%/AnyEvent::I3.3.gz

All FreeBSD documents are available for download at http://ftp.FreeBSD.org/pub/FreeBSD/doc/

Questions that are not answered by the documentation may be sent to <freebsd-questions@FreeBSD.org>.

Send questions about this document to <freebsd-doc@FreeBSD.org>.