---------- Forwarded message ---------- From: Ron Schmidt via RT <[EMAIL PROTECTED]> Date: Fri, Aug 29, 2008 at 10:14 PM Subject: [perl #58150] Doing split on the result of a slurped empty file results in a Null PMC Access in rakudo To: [EMAIL PROTECTED]
> $ < empty ./perl6 -e 'say split("\n", $*IN.slurp)' # but this fails Two proposed patches attached. The patch to src/pmc/parrotiio.pmc seems to fix the problem as originally stated. Then the patch to languages/perl6/src/classes/Str.pir seems to fix 'say $*IN.slurp.split("\n")'. If you have any questions please ask. Ron
Index: src/pmc/parrotio.pmc =================================================================== --- src/pmc/parrotio.pmc (revision 30637) +++ src/pmc/parrotio.pmc (working copy) @@ -307,7 +307,7 @@ Parrot_ex_throw_from_c_args(interp, NULL, EXCEPTION_PIO_ERROR, "Cannot slurp from empty filehandle"); - result = NULL; + result = string_make_empty(INTERP, enum_stringrep_one, 0); do { STRING * const part = PIO_reads(INTERP, SELF, 4096); Index: languages/perl6/src/classes/Str.pir =================================================================== --- languages/perl6/src/classes/Str.pir (revision 30637) +++ languages/perl6/src/classes/Str.pir (working copy) @@ -46,7 +46,7 @@ .return(retv) .end -.sub 'split' :method :multi('Perl6Str') +.sub 'split' :method .param string delim .local string objst .local pmc pieces