Using Perl 5 Embedding: Revision 1
Currently, Perl 5 embedding is enabled by default in Pugs. This allows to you use some Perl 5 modules from Perl 6. Here's a basic example:
use perl5:CGI; my $q = CGI.new('a=Hello'); say $q.param('a');
Notice that add the prefix perl5 when "using" the module, but otherwise use normal Perl 6 object notation. In that example were just passing the string 'a=Hello' to Perl 5. Sometimes additional effort is needed to successfully pass a more complex data structure from Perl 6 to Perl 5.
However, if you want to pass anything more than strings between Perl 6 and Perl 5, you may soon run into trouble. For example, Perl 6 does not allow named arguments to start with a dash but Perl 5 does. The general tool here will be to find a way to to apply `eval('some code',:lang<perl5>), so that it returns some Perl 5 code at the appropriate spot.
Here's an example of using it to pass a named argument starting with a dash:
use perl5:CGI; my $cookie = eval(q" my $q = CGI->new; $q->cookie( -name => 'Hello', value => 'World') ",:lang<perl5>); print $cookie;