in reply to Mail::Sender giving me an error

That is strange. I tested your exact code on my machine and it did not complain about anything.