Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Start REPL with definitions loaded from file

Tags:

raku

Is there a way to start the Perl 6 REPL with definitions loaded from a file?

I.e. let's say I have this in test.p6:

sub abc() { say 123; }

I'd like to be able to start the perl6 REPL and load that file so that I can use abc interactively.

like image 568
dharmatech Avatar asked Jul 24 '17 21:07

dharmatech


1 Answers

I guess the easiest way would be to put your code in a .pm6 file, e.g. ./Foo.pm6, mark the subroutines in question with is export and then start Rakudo Perl 6 like this:

$ perl6 -I. -MFoo
To exit type 'exit' or '^D'
> abc
123
like image 96
Elizabeth Mattijsen Avatar answered Nov 12 '22 03:11

Elizabeth Mattijsen