Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 979
GeneQ Avatar asked Feb 12 '12 07:02

GeneQ


1 Answers

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.

like image 129
Mat Avatar answered Sep 20 '22 00:09

Mat