Some of these functions could declare what parameter lists they take.  I've forgotten exactly how that's done in perl, but ISTR it's something like <code>
sub promise_loop ($$$)
</code> to say it takes three scalars.