prevent when sub from modifying when conditions arrayref

Major problem with the "when" logic.

The splice loop in the generated when() subroutine was removing all elements from the @when array. It worked on the first call, but on subsequent calls, @when was empty.

That fact was not being exposed by test t/04_when.t due to the $has arrayref being modified by the tests themselves. I changed it to make a copy of the $hash array ref for each test and was able to reproduce (and fix) the bug.