On Wed, 09 Jun 2010 16:00:42 +0200, Gerd Pokorra <g...@zimt.uni-siegen.de> wrote:

Here is a simple example that works.

#!/usr/bin/perl6

Q:PIR {
    load_bytecode 'Digest/MD5.pbc'
    .local pmc md5sum, md5print
    md5sum = get_root_global ['parrot'; 'Digest'], '_md5sum'
    $P0 = md5sum('foo')
    md5print = get_root_global ['parrot'; 'Digest'], '_md5_print'
    md5print($P0)
}

Cool! Works for me too!
And also inside a subroutine.
However, how do I return the md5sum back to perl6?

I blindly tried:

  sub mysub (Str $text) {
    my $md5_sum = Q:PIR {
        load_bytecode 'Digest/MD5.pbc'
        .local pmc md5sum, md5print
        md5sum = get_root_global ['parrot'; 'Digest'], '_md5sum'
        $P0 = find_lex '$text'
        %r = md5sum($P0)
    };
    return $md5_sum;
  }

  say mysub('foo');

It doesn't panic, but it doesn't print anything either.

--
Cosimo

Reply via email to