I want to write some tutorials on Perl 6. For this I believe Rmarkdown would be of great help.
So I am trying to execute Perl 6
code within Rmarkdown document.
My Perl 6 executable is in C:\rakudo\bin
.
So my .Rmd
file with example code to accomplish this is as follow:
---
title: "Example"
output: html_document
---
```{r, engine='perl6', engine.path='C:\\rakudo\\bin'}
my $s= "knitr is really good";
say $s;
```
However knitting the above document in Rstudio shows the following without Perl 6 output.
Any help where I am missing?
From the command prompt on windows, this works:
but this fails:
You have to use double quotes to quote arguments in the command prompt.
Not my area of expertise, but with a help of a blog I managed to get it to produce output.
First, look in RStudio's
R Markdown
tab. It shows you a warning that explains why your version isn't rendering anything:So with that in mind, we can look up how to register an engine and do so:
The engine is registered with a function that first saves the code to run to a temporary file and then executes the Rakudo compiler, asking it to compile that file.
After collecting the needed output, the function deletes the temporary file and gives us the output for rendering.
You had two problems in your example. First, I think you can still use the existing
perl
engine (perl6
is not a valid engine name). Second, theengine.path
option should point to the path of the executable instead of the directory name, e.g.You can also set the engine path globally for the
perl
engine: