{"id":23552615,"url":"https://github.com/kiwiroy/perlbrewr","last_synced_at":"2026-05-02T02:34:30.158Z","repository":{"id":147207312,"uuid":"171650256","full_name":"kiwiroy/perlbrewr","owner":"kiwiroy","description":"run perl scripts in Rmarkdown with perlbrew environment","archived":false,"fork":false,"pushed_at":"2020-04-27T23:09:53.000Z","size":190,"stargazers_count":0,"open_issues_count":2,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-05-15T17:14:48.137Z","etag":null,"topics":["knitr","perl","perl5","perlbrew","r","reproducibility","rmarkdown"],"latest_commit_sha":null,"homepage":"https://kiwiroy.github.io/perlbrewr/","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kiwiroy.png","metadata":{"files":{"readme":"README.Rmd","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-20T10:16:44.000Z","updated_at":"2020-04-27T23:09:56.000Z","dependencies_parsed_at":"2023-04-19T03:16:48.999Z","dependency_job_id":null,"html_url":"https://github.com/kiwiroy/perlbrewr","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/kiwiroy/perlbrewr","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwiroy%2Fperlbrewr","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwiroy%2Fperlbrewr/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwiroy%2Fperlbrewr/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwiroy%2Fperlbrewr/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kiwiroy","download_url":"https://codeload.github.com/kiwiroy/perlbrewr/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kiwiroy%2Fperlbrewr/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32521088,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-02T01:12:54.858Z","status":"online","status_checked_at":"2026-05-02T02:00:05.923Z","response_time":132,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["knitr","perl","perl5","perlbrew","r","reproducibility","rmarkdown"],"created_at":"2024-12-26T11:12:28.818Z","updated_at":"2026-05-02T02:34:30.131Z","avatar_url":"https://github.com/kiwiroy.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\noutput: github_document\nparams:\n  root: !r Sys.getenv(\"PERLBREW_ROOT\")\n  perl_version: 5.24.3\n---\n[![Travis build status](https://travis-ci.org/kiwiroy/perlbrewr.svg?branch=master)](https://travis-ci.org/kiwiroy/perlbrewr)\n[![Coverage status](https://coveralls.io/repos/github/kiwiroy/perlbrewr/badge.svg)](https://coveralls.io/r/kiwiroy/perlbrewr?branch=master)\n[![lifecycle](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://www.tidyverse.org/lifecycle/#experimental)\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\u003c!--   home: !r Sys.getenv(\"PERLBREW_HOME\") --\u003e\n\n```{r setup, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\nSys.setenv(\"PERLBREW_ROOT\"=params$root)\ntmp \u003c- file.path(tempdir(), \".perlbrew\")\nif(!dir.exists(tmp)) {\n  dir.create(tmp)\n}\nSys.setenv(\"PERLBREW_HOME\"=tmp)\nSys.setenv(\"perlbrew_command\"=file.path(params$root, \"bin\", \"perlbrew\"))\n```\n# perlbrewr\n\nThe goal of perlbrewr is to assist the loading of a [perlbrew](https://perlbrew.pl)\nperl and optionally a library with the aim of improving reproducibility. The\ncentral task that perlbrewr performs is management of the environment variables\nin the same manner as perlbrew itself, by calling perlbrew commands and\ntranslating the changes there into R function calls that achieve the same\noutcome. Primarily, these are `Sys.setenv` and `Sys.unsetenv`.\n\n## Dependencies\n\n### R\n\n* R (\u003e= 3.3.0)\n* magrittr\n* stringr\n\n### Non R\n\n* [perlbrew](https://perlbrew.pl)\n\n## Installation\n\nYou can install the released version of perlbrewr from [GitHub](https://github.com/kiwiroy/perlbrewr) with:\n\n``` r\ndevtools::install_github(\"kiwiroy/perlbrewr\")\n```\n\n## Example\n\nThis is a basic example of usage to load a perlbrew environment:\n\n`params$perl_version` = ``r params$perl_version``\n\n```{r example}\nlibrary(perlbrewr)\nresult \u003c- perlbrew(root = Sys.getenv(\"PERLBREW_ROOT\"), version = params$perl_version)\n```\n\nThe brewed version of perl is now the default.\n```{r perlversion}\nSys.which(\"perl\")\n```\n\nThis is also the case in `bash` shell blocks.\n```{r perlversion-in-bash, engine = \"bash\"}\nwhich perl\n```\n\nBy configuring `knitr` - this happens automatically by default.\n```{r knitr-config}\nknitr::opts_chunk$set(engine.path = list(perl = Sys.which(\"perl\")[[\"perl\"]]))\n```\n\nPerl code in `perl` blocks run the same interpreter.\n```{r perl-code, engine = \"perl\"}\nprint \"$^X\\n\";\n```\n\n### local::lib library access\n\nPerlbrew supports [`local::lib`](https://metacpan.org/pod/local::lib) libraries for further controlling which modules are installed. `perlbrewr` supports loading these also.\n\n```{r create-lib, include=FALSE}\nperlbrew_lib_create(version = params$perl_version, lib = \"example\")\n```\n\n```{r use-lib}\nperlbrew(version = params$perl_version, lib = \"example\")\nSys.getenv(\"PERL5LIB\")\n```\n\nWithin this `local::lib` modules may be installed with [`cpanm`](https://metacpan.org/pod/App::cpanminus).\n```{r install-something, engine = \"bash\"}\ncd inst\ncpanm -n -q --installdeps .\n```\n\n\nSince `perlbrewr::perlbrew` sets the `PERL5LIB` environment variable perl code\nrelying on the dependencies is now sucessful.\n```{r perl-code-2, engine = \"perl\"}\nuse Mojo::Base -strict;\nuse Mojo::File;\nsay Mojo::File-\u003enew('inst/cpanfile')-\u003eslurp;\n```\n\n### listing and creating libraries\n\n```{r re-root, include = FALSE}\nbrew_list \u003c- perlbrew_list()\nif(length(brew_list) \u003e 12) {\n  ## This shortens the lists in the next two\n  root \u003c- file.path(getwd(),\"tests\",\"testthat\",\"mock\")\n  pbcmd \u003c- file.path(root, \"bin\", \"perlbrew\")\n  Sys.setenv(\"PERLBREW_ROOT\"=root, \"perlbrew_command\"=pbcmd)\n}\n```\n\n`perlbrew_list` returns a listing of the available versions of perl and any `local::lib` libraries. If a version or library is in use, the `active` object attribute is also set.\n\n```{r perlbrew-list}\nperlbrew_list()\n```\n\nA new library is created with `perlbrew_lib_create`.\n\n```{r perlbrew-lib-create-show}\nperlbrew_list()\n```\n\n### knitr\n\nThe knitr chunk options `engine.path` and `engine.opts` are set automatically so that each `engine=\"perl\"` chunk will use the correct `perl` interpreter and `PERL5LIB`. Any `engine.opts` for perl that have already been set should remain in the list. For this to work correctly the `list()` version of the `engine.opts` should be used. i.e.\n\n```r\nknitr::opts_chunk$set(engine.opts = list(perl = \"-CS\", bash = \"--norc\"))\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiwiroy%2Fperlbrewr","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkiwiroy%2Fperlbrewr","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkiwiroy%2Fperlbrewr/lists"}