I think all you need is MIME::Lite and the commandline GPG app. I don't know how it works precisely, but I know the pgp message is a single attachment with your message and your other attachments stuffed inside it.
-Paul
Comment on Re: Send Signed/Encrypted email with attachments using SMTP