# New Ticket Created by Vasily Chekalkin
# Please include the string: [perl #56216]
# in the subject line of all future correspondence about this issue.
# <URL: http://rt.perl.org/rt3/Ticket/Display.html?id=56216 >
Hello.
Attached patch handles parrot's exception on substr invocations and
returns Failure instead.
--
Bacek
diff --git a/languages/perl6/src/classes/Str.pir b/languages/perl6/src/classes/Str.pir
index 6195989..eb454cb 100644
--- a/languages/perl6/src/classes/Str.pir
+++ b/languages/perl6/src/classes/Str.pir
@@ -258,10 +284,17 @@ Returns a Perl representation of the Str.
len = len - start
end:
+ push_eh cant_substr
$S0 = substr self, start, len
+ pop_eh
s = new 'Str'
s = $S0
.return (s)
+ cant_substr:
+ .get_results ($P0, $S0)
+ s = new 'Failure'
+ .return (s)
+
.end
=back