Test-Pod-LinkCheck-Lite
view release on metacpan or search on metacpan
eg/manpath.PL view on Meta::CPAN
use Getopt::Long 2.33 qw{ :config auto_version };
use File::Glob qw{ bsd_glob };
use File::Spec;
use List::Util qw{ uniq };
use Pod::Usage;
our $VERSION = '0.014';
use constant PATH_SEP => qr/ $Config{path_sep} /smx;
use constant MANPATH_APPEND => qr/ (?<= $Config{path_sep} \z ) /smx;
use constant MANPATH_EMBED =>
qr/ (?<= $Config{path_sep} ) (?= $Config{path_sep} ) /smx;
use constant MANPATH_PREPEND => qr/ \A (?= $Config{path_sep} ) /smx;
use constant MAN_CONF => {
darwin => [ '/private/etc/man.conf' ],
freebsd => [ '/etc/man.conf', '/usr/local/etc/man.d/*.conf' ],
haiku => [ '/packages/man-*/.settings/man.conf' ],
linux => [ '/etc/manpath.config' ],
openbsd => [ '/etc/man.conf' ],
}->{$^O} || [];
eg/manpath.PL view on Meta::CPAN
}
return;
}
sub man_path {
my $manpath = $ENV{MANPATH};
if ( defined $manpath ) {
$manpath =~ MANPATH_PREPEND
or $manpath =~ MANPATH_EMBED
or $manpath =~ MANPATH_APPEND
or return split PATH_SEP, $ENV{MANPATH};
}
my $auto_path = ! {
openbsd => 1,
}->{$^O};
my @man_path;
my %man_path_map = map { $_ => undef } File::Spec->path();
my @mandatory;
eg/manpath.PL view on Meta::CPAN
-d $man
or next;
push @auto, $man;
}
}
}
splice @man_path, 0, 0, @auto;
if ( defined $manpath ) {
my $dflt = join $Config{path_sep}, @man_path;
foreach my $re ( MANPATH_PREPEND, MANPATH_EMBED,
MANPATH_APPEND ) {
$manpath =~ s/ $re /$dflt/smx
and last;
}
@man_path = split PATH_SEP, $manpath;
}
}
return uniq( @man_path );
}
( run in 0.362 second using v1.01-cache-2.11-cpan-71847e10f99 )