The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Parrot::PMC - access a Parrot PMC from Perl 5

VERSION

Version 0.02

SYNOPSIS

        # find a subroutine to invoke
        my $sub_pmc       = $interp->find_global( 'some_parrot_sub' );
        my $other_sub_pmc = $interp->find_global( 'another_sub', 'NameSpace' );

        # invoke the subroutine
        my $result_pmc    = $sub_pmc->invoke( $signature, @args );

        # get the values out of it
        my $string_val    = $result_pmc->get_string( $interp );

METHODS

This object provides several methods:

  • invoke( $signature, $argument )

    Given a Sub PMC or derivative, calls the appropriate Parrot function, parsing the $signature and passing a single string $argument. The first character of the $signature string denotes the return value. The remaining characters are the argument values, per the list:

    v void (return only)
    I integer
    N float
    S string
    P PMC

    In the future, this method may handle this translation for you automatically, though it may not deduce the return type correctly.

  • get_string()

    Retrieves the string value of the PMC. Not all PMCs support this.

AUTHOR

chromatic, <chromatic at wgz.org>

BUGS

There are three known deficiencies. First, there should be separate classes for separate Parrot PMC types. Second, there should be overloadings to handle various types of getting and setting values on PMCs. Third, the invoke() methods do not handle enough signatures.

Patches welcome.

Please report any bugs or feature requests to the Parrot Porters mailing list. Someday there may be a CPAN version of this code. Who knows?

COPYRIGHT & LICENSE

Copyright (C) 2006-2007 The Perl Foundation / chromatic.

This program is free software; you can redistribute it and/or modify it under the same terms as Parrot itself.