Parrot::PMC - access a Parrot PMC from Perl 5
Version 0.02
# 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 );
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:
$signature
$argument
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.
chromatic, <chromatic at wgz.org>
<chromatic at wgz.org>
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.
invoke()
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 (c) 2006 - 2007 The Perl Foundation / chromatic, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Parrot itself.
To install SmartLink, copy and paste the appropriate command in to your terminal.
cpanm
cpanm SmartLink
CPAN shell
perl -MCPAN -e shell install SmartLink
For more information on module installation, please visit the detailed CPAN module installation guide.