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.
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.