pod2usage fails running setuid on Solaris

D

Dan

We have (too many :) setuid perl scripts running in our Solaris 8
environment. In attempting to add documentation to them with
pod2usage, we get CONSISTENT failures.

Because the "real" file handle is set to /dev/fd/3 when the script is
running setuid, pod2usage can't find the pod doc :-(

Short of hard-coding the path in every script with something like:

$0 = "/usr/local/bin/my_script";

is there any way to get the "real" value of $0 so that pod2usage can
run correctly in this environment?

Example:
============================ Cut here ================
#!/usr/bin/env perl -w
use Getopt::Std;
use Pod::Usage;
use Env;

delete $ENV{qw(CDPATH IFS BASH_ENV ENV)};
$ENV{'PATH'} = "/usr/bin:/usr/sbin:/usr/local/bin";

getopts('hm', \%opt);
pod2usage(1) if $opt{h};
pod2usage( -verbose => 2 ) if $opt{m};

pod2usage("$0: No files given.") if ((@ARGV == 0) && (-t STDIN));
__END__

=head1 NAME

sample - Using GetOpt::Long and Pod::Usage

=head1 SYNOPSIS
============================ Cut here ================
.........

which produces:

No documentation found for "/dev/fd/3".

when run with the -m switch.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,023
Latest member
websitedesig25

Latest Threads

Top