I've just replaced (in git) the old rendition with the one that BrowserUk linked to (written by ikegami).
Nothing really wrong with the older version - works fine, and is quite comprehensible once you understand what newSVrv() does.
But this amended version is more readily digestible ... and so it "gets the guernsey".
Here's hoping that the "if it aint broke don't fix it" principle doesn't jump up and bite me ;-)