Could you not just put the return value through $longfn() (or whatever you use internally) so it's always long?