in reply to Passing References to Subroutines

If $mime_entity is a instance of MIME::Entity then it already is a reference. You passed in a reference to a reference that is now unblessed.