While I'm not certain I understand your question (and I'm definitely *not* a MySQL expert), maybe you're looking for something like SQL::Preproc ? Tho it would use DBD::mysql, not Perl::MySQL
(whatever that is?).
Comment on Re: Code conversion from embedded sql to Perl::MySQL