in reply to Text::Autoformat... doesn't.
I haven't used Text::AutoFormat, but given that your code only gives it one line at a time, I'm not sure what you expect it to do. Try slurping the whole file into a scalar and then autoformat that.