What is the purpose of appending the :from<perl5> suffix to the module name in a 'use' statement in Perl 6?

StackOverflow https://stackoverflow.com/questions/9247359

  •  28-04-2021
  •  | 
  •  

문제

What's the purpose of use statement below which I stumbled across in some Perl 6 module?

use CGI:from<perl5>;
...
...

The rest of the code is just mundane usage of the Perl 5 CGI module, as far as I can tell.

Is the ":from" suffix used to invoke some kind of a Perl 5 compatibility layer. Can't seem to find any documentation about it.

도움이 되었습니까?

해결책

Look at the perl6 Synopsis 11: Modules:

The use statement allows an external language to be specified in addition to (or instead of) an authority, so that you can use modules from other languages. The from adverb also parses any additional parts as short-form arguments. For instance:

use Whiteness:from<perl5>:name<Acme::Bleach>:auth<cpan:DCONWAY>:ver<1.12>;
use Whiteness:from<perl5 Acme::Bleach cpan:DCONWAY 1.12>;  # same thing

So indeed, it's a scheme to support "other languages", perl5 in this instance.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top