# New Ticket Created by  Gabor Szabo 
# Please include the string:  [perl #64124]
# in the subject line of all future correspondence about this issue. 
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=64124 >


I am not sure if this is a Parrot or Rakudo bug
or just a plain invalid usage on my side.

The following code runs, prints the prompt but when I
enter a response I get a Segmentation fault.

Gabor


#!/usr/bin/perl
use strict;
use warnings;


# Needs two environment variables:
# PARROT_DIR needs to point to the directory where parrot was checked out
# export LD_LIBRARY_PATH=$PARROT_DIR/blib/lib/

# cwd still needs to be PARROT_DIR or I get the following error:
#"load_bytecode" couldn't find file 'PCT.pbc'
#current instr.: '' pc 743 (src/classes/Object.pir:20)
#called from Sub 'myperl6' pc 3 (EVAL_1:3)

# Before running I had to build Parrot::Embed:
# cd $ENV{PARROT_DIR}/ext/Parrot-Embed/
# perl Build.PL
# perl Build
# perl Build test


die "need PARROT_DIR" if not $ENV{PARROT_DIR};
unshift @INC, (
                "$ENV{PARROT_DIR}/ext/Parrot-Embed/blib/lib",
                "$ENV{PARROT_DIR}/ext/Parrot-Embed/blib/arch",
                );
                
require Parrot::Embed;
my $interp = Parrot::Interpreter->new;

my $perl6 =<<"END_PIR";
.sub myperl6
        .param string    in_string
        load_bytecode '$ENV{RAKUDO_DIR}/perl6.pbc'

        \$P0 = get_hll_global 'prompt'
        .tailcall \$P0('Enter your name: ')
.end
END_PIR

my $eval = $interp->compile( $perl6 );
my $foo = $interp->find_global('myperl6');
my $pmc = $foo->invoke( 'PS', 'say "hello"' );
print $pmc->get_string(), "\n";

Reply via email to