So, it seems like there is a lot of checks to wantarray here. An alternative would be to have a giant if (wantarray) dividing the sub into two implementations.
Sounds like a good plan to me.
My criteria for good software:
Does it work?
Can someone else come in, make a change, and be reasonably certain no bugs were introduced?