This isn't directly possible. You'll need to write a shared lib that embeds Perl; you can go from there. It's likely going to be a lot of work though - probably much more than you will want to invest, judging from the fact that you'd prefer to write your PAM module in Perl.