使用从文件加载的定义启动 REPL
Start REPL with definitions loaded from file
有没有办法使用从文件加载的定义来启动 Perl 6 REPL?
即假设我在 test.p6
:
中有这个
sub abc() { say 123; }
我希望能够启动 perl6 REPL 并加载该文件,以便我可以交互式地使用 abc
。
我想最简单的方法是将代码放在 .pm6 文件中,例如./Foo.pm6
,用 is export
标记有问题的子程序,然后像这样启动 Rakudo Perl 6:
$ perl6 -I. -MFoo
To exit type 'exit' or '^D'
> abc
123
有没有办法使用从文件加载的定义来启动 Perl 6 REPL?
即假设我在 test.p6
:
sub abc() { say 123; }
我希望能够启动 perl6 REPL 并加载该文件,以便我可以交互式地使用 abc
。
我想最简单的方法是将代码放在 .pm6 文件中,例如./Foo.pm6
,用 is export
标记有问题的子程序,然后像这样启动 Rakudo Perl 6:
$ perl6 -I. -MFoo
To exit type 'exit' or '^D'
> abc
123