in reply to Calling a setuid script in a perl script
in thread Perl Setuid - Oracle Password Hardcoding

In testDBConn.pl:

# assuming getPwd.pl is in @INC require 'getPwd.pl'; $password = getOraPwd();
For this to work getPwd.pl will need to return a true value. That's as simple as putting 1; as the last line in the script.

You might also consider creating a module and use'ing that. This might be helpful in such a venture: José's Guide for creating Perl modules

Replies are listed 'Best First'.
Re^2: Calling a setuid script in a perl script
by mbethke (Hermit) on Nov 18, 2011 at 17:00 UTC

    I assume the OP wants it as an extra suid script because it must read a file the main script has no permissions for, and it makes complete sense to keep the suid portions of a script as small as possible. Making the whole thing a module would defeat this purpose.

    If I understood this correctly, the solution is very easy:

    $password = `getPwd.pl`; chomp $password;