library(perlbrewr) knitr::opts_chunk$set( echo = TRUE, comment = "#>" ) perlbrew(root = params$perlbrew_root, version = params$perl_version)
perlbrew_list(root = params$perlbrew_root, include.libs = FALSE)
Perl code can now be written that uses the specific interpreter with version
r params$perl_version
as part of the perlbrew installation in
r params$perlbrew_root
.
use strict; use warnings; use feature 'say'; say "Hello World"; say "perl is: $^X";
A local::lib
is easily created to
allow for user level installation and enhance reproducibility of a workflow
by using a cpanfile
to install
dependencies with cpanm
.
success <- perlbrew_lib_create(root = params$perlbrew_root, version = params$perl_version, lib = "template", perlbrew.use = TRUE) available <- perlbrew_list(root = params$perlbrew_root) attr(available, "active")
Knitr has already been updated to use the PERL5LIB
by setting engine.opts
.
r knitr::opts_chunk$get("engine.opts")$perl
Chunks interpreted with Bash will also have the correct environment to do what I mean (DWIM).
which perl
which cpanm
echo $PERL5LIB
In this way any perl scripts that have dependencies, may have these
dependencies met by using cpanm
to install the modules from
CPAN using the cpanfile
that was included with the
script :tada:.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.