Your idea looks nice, but you should take a look at the Filter Module ,it is available from CPAN, with this you can write encripted Perl Code, so you would not have problems with the passwords in your scripts.
In the Wolf Book ( Mastering Algorithms with Perl ), you can find more about it in Chapter 13:Cryptography.
Shadox
Comment on Re: Protect your passwords for perl scripts
I am willing to bet that encrypted perl code is much slower to start that a setuid C wrapper... I envision this used for
cgis and system scripts... cgis certainly need the speed,
system scripts could go either way.