You could use open()-for-IPC to accomplish what you say you need to do, but
you already have the code that uses Mail::SpamAssassin's "check_message_text" to perform that function - why would you want to call external code ?
Profanity is the one language all programmers know best.