相关疑难解决方法(0)

从另一个Perl 6文件访问POD

Perl 6的POD文档对使用访问当前文件的POD文档一节$=pod.没有关于访问另一个文件的POD文档的信息.

如何在不改变当前文件的情况下访问另一个文件的POD结构$=pod

perl6 pod6

6
推荐指数
1
解决办法
159
查看次数

访问动态加载模块的资源

我找不到正确访问已安装发行版资源的方法.例如,动态加载模块时:

require ::($module);

获取它的一种方法%?RESOURCES是让模块有一个可以返回此哈希的sub:

sub resources { %?RESOURCES }

但这增加了样板代码.

另一种方法是深度扫描$*REPO和获取模块的分布元.

有没有更好的选择来完成这项任务?

module perl6

6
推荐指数
1
解决办法
134
查看次数

提取文档时找不到模块

假设我.pm6在目录中有以下两个文件Foo

  • Vehicle.pm6 -车辆的接口。
=TITLE C<Vehicle> interface

unit role Foo::Vehicle;

#| Get the vehicle to move
method run(--> Nil) { ... }

#| Get fuel into the vehicle
method get-fuel(--> Nil) { ... }
Run Code Online (Sandbox Code Playgroud)
  • Car.pm6-实现Vehicle接口的类。
=TITLE C<Car> class

use Foo::Vehicle;
unit class Foo::Car does Foo::Vehicle;

has $!speed = 2;

#| Get the car to move
method run(--> Str) { 
    "{::?CLASS.perl} is moving at {$!speed}km/h."
}

#| Get fuel into the car
method get-fuel(--> Str) …
Run Code Online (Sandbox Code Playgroud)

perl6 raku

6
推荐指数
1
解决办法
197
查看次数

标签 统计

perl6 ×3

module ×1

pod6 ×1

raku ×1