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


parrot documentation Contained in the parrot distribution.

Index


Code Index:

NAME

Top

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

VERSION

Top

Version 20081006

SYNOPSIS

Top

        # 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

Top

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

Top

chromatic, <chromatic at wgz.org>

BUGS

Top

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

Top


parrot documentation Contained in the parrot distribution.

package Parrot::PMC;

# $Id: PMC.pm 37377 2009-03-13 08:48:14Z allison $

use strict;
use warnings;
our $VERSION = '20081006';

use Parrot::Embed;

1;

__END__

# Local Variables:
#   mode: cperl
#   cperl-indent-level: 4
#   fill-column: 100
# End:
# vim: expandtab shiftwidth=4: