# New Ticket Created by "Sean O'Rourke" # Please include the string: [netlabs #801] # in the subject line of all future correspondence about this issue. # <URL: http://bugs6.perl.org/rt2/Ticket/Display.html?id=801 >
This patch makes the following behave as it does in Perl 5: @a = 1..3; @b = 1..3; $x = @a + @b; # x is 6 in Perl 5, undef in Parrot The problem was that the math vtable methods were giving up if the other side of the operator wasn't an int or a num. So the current version of PerlArray would make $x undef. I'm not sure getting the other thing's int value (as opposed to its num value) is the right thing, but it seems like a reasonable guess. /s -- attachment 1 ------------------------------------------------------ url: http://bugs6.perl.org/rt2/attach/3747/3492/67a294/perlarray-711.patch
Index: perlarray.pmc =================================================================== RCS file: /cvs/public/parrot/classes/perlarray.pmc,v retrieving revision 1.32 diff -p -u -r1.32 perlarray.pmc --- perlarray.pmc 21 Jun 2002 17:22:34 -0000 1.32 +++ perlarray.pmc 12 Jul 2002 05:36:29 -0000 @@ -384,6 +384,11 @@ pmclass PerlArray { ); } else { + dest->vtable = &Parrot_base_vtables[enum_class_PerlInt]; + dest->vtable->set_integer_native(INTERP, dest, + SELF->vtable->get_integer(INTERP, SELF) + + value->vtable->get_integer(INTERP, value) + ); } } @@ -429,6 +434,11 @@ pmclass PerlArray { ); } else { + dest->vtable = &Parrot_base_vtables[enum_class_PerlInt]; + dest->vtable->set_integer_native(INTERP, dest, + SELF->vtable->get_integer(INTERP, SELF) - + value->vtable->get_integer(INTERP, value) + ); } } @@ -474,6 +484,11 @@ pmclass PerlArray { ); } else { + dest->vtable = &Parrot_base_vtables[enum_class_PerlInt]; + dest->vtable->set_integer_native(INTERP, dest, + SELF->vtable->get_integer(INTERP, SELF) * + value->vtable->get_integer(INTERP, value) + ); } } @@ -519,6 +534,11 @@ pmclass PerlArray { ); } else { + dest->vtable = &Parrot_base_vtables[enum_class_PerlInt]; + dest->vtable->set_integer_native(INTERP, dest, + SELF->vtable->get_integer(INTERP, SELF) / + value->vtable->get_integer(INTERP, value) + ); } } @@ -557,6 +577,11 @@ pmclass PerlArray { ); } else { + dest->vtable = &Parrot_base_vtables[enum_class_PerlInt]; + dest->vtable->set_integer_native(INTERP, dest, + SELF->vtable->get_integer(INTERP, SELF) % + value->vtable->get_integer(INTERP, value) + ); } }