Inline::Parrot::parrot - a Parrot process
use Inline::Parrot; my $p = Inline::Parrot::parrot->new( parrot_file_name => 'parrot', parrot_interpreter_file_name => 'parrot-interp.pir', parrot_options => [], debug => 0, ); my ($output, $error) = $p->compile_and_run( <<'PARROT' ); .pcc_sub _x0 print "parrot ok\n" invoke P1 end .end PARROT print "output:\n" . $output . "\n"; print "error:\n" . $error . "\n";
This module provides an object-oriented, low-level interface to a Parrot process.
The API is very unstable.
* new
Creates an Inline::Parrot::parrot object.
Default parameters:
parrot_file_name => 'parrot', parrot_interpreter_file_name => 'parrot-interp.pir', parrot_options => [], debug => 0,
The default parrot_file_name is determined at installation time by Makefile.PL.
parrot_file_name
Makefile.PL
* compile( $string )
Compiles the code, and leave the result in the Parrot process memory.
Returns a status string (the string format definition is not stable).
my $status = $parrot->compile( $code );
* compile_and_run( $string )
my $status = $parrot->compile_and_run( $code );
The first subroutine in the code is called. Perl parameters are passed as specified in the Parrot Calling Conventions: http://www.parrotcode.org/docs/pdd/pdd03_calling_conventions.html
* open
Starts a Parrot process.
open is called automatically by new.
open
new
If a process is already open, the command is ignored.
If a process cannot be open, the program dies.
* close
Closes the Parrot process.
If there is no open process, the command is ignored.
* debug
Controls the emission of debugging messages.
debug(1) starts, debug(0) stops.
debug(1)
debug(0)
The contents of the messages is not stable.
* get_interpreter_code
Returns the location of the Parrot interpreter. This is a string like ~/lib/Inline/Parrot/parrot-interpreter.pir.
~/lib/Inline/Parrot/parrot-interpreter.pir
This is a class method.
Inline
Inline::Parrot
http://www.parrotcode.org
Flavio S. Glock, <fglock@cpan.org>
Copyright (C) 2004 by Flavio S. Glock
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.4 or, at your option, any later version of Perl 5 you may have available.
To install Inline::Parrot, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Inline::Parrot
CPAN shell
perl -MCPAN -e shell install Inline::Parrot
For more information on module installation, please visit the detailed CPAN module installation guide.