http://www.perlmonks.org?node_id=145055


in reply to Executing a program as another user

You could use Expect.pm to have your program communicate with su through a tty.