I also am looking for a simple way to base64 a file. I have a small mail module that sends formatted e-mails via sendmail and I want to add the ability of sending attachmnets.
The code you posted looks like the answer; question:- is the old_encode_base64 sub expecting a file to be read in line by line or should the whole file be slurped up into one scalar variable and the sub called with that variable?