perl.cvs.mod_parrot
[Top] [All Lists]

[svn:mod_parrot] r352 - in mod_parrot/trunk: eg/perl6 patches

Subject: [svn:mod_parrot] r352 - in mod_parrot/trunk: eg/perl6 patches
From: jhorwitz@xxxxxxxxxxxx
Date: Tue, 17 Jun 2008 06:42:15 -0700 (PDT)
Newsgroups: perl.cvs.mod_parrot

Author: jhorwitz
Date: Tue Jun 17 06:42:13 2008
New Revision: 352

Added:
   mod_parrot/trunk/patches/
   mod_parrot/trunk/patches/parrot-r28322-modperl6.patch
Modified:
   mod_parrot/trunk/eg/perl6/README

Log:
add patch for pure perl mod_perl6


Modified: mod_parrot/trunk/eg/perl6/README
==============================================================================
--- mod_parrot/trunk/eg/perl6/README    (original)
+++ mod_parrot/trunk/eg/perl6/README    Tue Jun 17 06:42:13 2008
@@ -2,10 +2,12 @@
 
 How to use mod_perl6:
 
-1) In the Apache's envvars script:
+1) Apply the modperl6 patch in the patches directory to the parrot source tree.
+2) Rebuild perl6.
+3) In the Apache's envvars script:
    a) set PERL6LIB to the absolute path to languages/perl6/lib, or add it to
       the path (colon-separated) if PERL6LIB is already set.
    b) Add any local Perl 6 include paths where your handler modules will live.
    c) Add set PARROT_RUNTIME to your parrot source directory.
-2) Configure your handlers in httpd.conf (the examples contain instructions)
-3) Restart Apache (do a full stop and start if you updated envvars).
+4) Configure your handlers in httpd.conf (the examples contain instructions)
+5) Restart Apache (do a full stop and start if you updated envvars).

Added: mod_parrot/trunk/patches/parrot-r28322-modperl6.patch
==============================================================================
--- (empty file)
+++ mod_parrot/trunk/patches/parrot-r28322-modperl6.patch       Tue Jun 17 
06:42:13 2008
@@ -0,0 +1,121 @@
+Index: languages/perl6/src/builtins/io.pir
+===================================================================
+--- languages/perl6/src/builtins/io.pir        (revision 28322)
++++ languages/perl6/src/builtins/io.pir        (working copy)
+@@ -70,7 +70,30 @@
+ 
+ .sub 'require'
+     .param pmc filename
++    .local string path
+ 
++    $S0 = substr filename, 0, 1
++    if $S0 == '/' goto eval_file
++
++    .local pmc env
++    .local pmc perl6lib
++    env = new 'Env'
++    $S0 = env['PERL6LIB']
++    unless $S0 goto eval_file
++    perl6lib = split ':', $S0
++    .local pmc iter
++    iter = new 'Iterator', perl6lib
++  iter_start:
++    unless iter goto eval_file
++    $S0 = shift iter
++    $S1 = concat $S0, '/'
++    $S0 = filename
++    path = concat $S1, $S0
++    $I2 = stat path, 0
++    unless $I2 goto iter_start
++    filename = path
++
++  eval_file:
+     .local pmc p6compiler
+     p6compiler = compreg 'Perl6'
+     p6compiler.'evalfiles'(filename)
+Index: languages/perl6/src/builtins/misc.pir
+===================================================================
+--- languages/perl6/src/builtins/misc.pir      (revision 28322)
++++ languages/perl6/src/builtins/misc.pir      (working copy)
+@@ -12,6 +12,19 @@
+     .return($P0)
+ .end
+ 
++.sub 'resolve_sym'
++    .param string ns
++    .param string name
++    .param pmc args :slurpy
++    .local pmc sym
++    .local pmc nskey
++
++    nskey = split '::', ns
++    sym = get_hll_global nskey, name
++
++    .return(sym)
++.end
++
+ # Local Variables:
+ #   mode: pir
+ #   fill-column: 100
+Index: languages/perl6/src/parser/actions.pm
+===================================================================
+--- languages/perl6/src/parser/actions.pm      (revision 28322)
++++ languages/perl6/src/parser/actions.pm      (working copy)
+@@ -1921,10 +1921,22 @@
+ 
+ method subcall($/, $key) {
+     my $past;
+-    if $key eq 'subcall' {
++
++    # temporary for namespace interpolation
++    if ($key eq 'interp') {
++        my $resolve_past := PAST::Op.new(
++            :name('resolve_sym'),
++            :pasttype('call'),
++            :node($/)
++        );
++        $resolve_past.unshift(PAST::Val.new( :value( ~$<ident> ) ));
++        $resolve_past.unshift($( $<EXPR> ));
+         $past := build_call( $( $<semilist> ) );
+-        $past.name( ~$<ident> );
+-        $past.node( $/ );
++        $past.unshift($resolve_past);
++
++        # build_call will set 'name' for us.  we reset that to undef so the
++        # sub call invokes the first PAST argument ($resolve_past) instead
++        $past.name(undef);
+     }
+     elsif $key eq 'VAR' {
+         $past := PAST::Op.new(
+@@ -1934,6 +1946,13 @@
+             $( $<variable> )
+         );
+     }
++    # normal subroutine call
++    else {
++        $past := build_call( $( $<semilist> ) );
++        $past.name( ~$<ident> );
++        $past.node( $/ );
++    }
++
+     make $past;
+ }
+ 
+Index: languages/perl6/src/parser/grammar.pg
+===================================================================
+--- languages/perl6/src/parser/grammar.pg      (revision 28322)
++++ languages/perl6/src/parser/grammar.pg      (working copy)
+@@ -663,9 +663,12 @@
+     {*}
+ }
+ 
++# call a subroutine.  the second form interpolates the first part of the
++# namespace, which should probably be done elsewhere
+ token subcall {
++    | <ident> '.'? '(' <semilist> ')' {*} #= normal
++    | '::' '(' <EXPR> ')' '::' <ident> '.'? '(' <semilist> ')' {*} #= interp
+     | 'VAR(' <variable> ')' {*}             #= VAR
+-    | <ident> '.'? '(' <semilist> ')' {*}   #= subcall
+ }
+ 
+ # These regex rules are some way off STD.pm at the moment, but we'll work them

<Prev in Thread] Current Thread [Next in Thread>
  • [svn:mod_parrot] r352 - in mod_parrot/trunk: eg/perl6 patches, jhorwitz <=