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

1

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.

Rollerskate answered 12/2, 2012 at 7:53 Comment(0)
S
10

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.

Southeastward answered 12/2, 2012 at 8:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.