NAME
Inline::Parrot::parrot - a Parrot process
SYNOPSIS
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";
DESCRIPTION
This module provides an object-oriented, low-level interface to a Parrot process.
The API is very unstable.
METHODS
* 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
.
* 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 )
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_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
.
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.
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
.
This is a class method.
SEE ALSO
AUTHOR
Flavio S. Glock, <fglock@cpan.org>
COPYRIGHT AND LICENSE
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.