#! /usr/bin/env perl
eval 'exec /usr/bin/perl -S $0 ${1+"$@"}'
if 0; # not running under some shell
=for gpg
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
=head1 NAME
showPerlDirConfig - explore (pretty-print) the basis of directory locations
of the Perl installation configuration matching the perl interpreter currently
being run.
=head2 VERSION
This POD documents
---------------------------------------------------------------------
* version 2004.01.09 *
---------------------------------------------------------------------
=head1 SYNOPSIS
$ showPerlDirConfig
$ /opt/bin/myfunkyperl showPerlDirConfig
=cut
# ---------------------------------------------------------------------
# internal CVS - RCS version control information:
## somian ## 1.7 ##
## 2004/01/10 01:54:28 ##
# ---------------------------------------------------------------------
use strict;
use Config;
use File::Spec;
$^W = 1;
$\ = "\n";
my $Ll = 0;
my $Stogg = 0;
my $headr =
sub {
my($perlFQpath,$stringL) = @{&pselfIdentity};
my $margin = calc_midbuffs ($stringL => $Ll);
my($decoL,$decoR) = ('','');
if ($margin >= 6)
{
$decoL = '||:' ; $decoR = ':||';
}
my $visi = "$decoL $perlFQpath $decoR";
my $spadd = $margin - 3 - length $decoL;
$spadd += length $visi;
my $formtl = "%${spadd}s";
print "Installation directory target configuration for "
,"the Perl binary installed as";
printf $formtl => $visi;
print "\n\n" , ( '-' x $Ll);
};
## *** *** ##
print join "\n"
=>(
map {
my $keyarr=$_; # we get scoping confusion induced err if not.
$Stogg++ || &$headr;
my $ins=$Config::Config{$keyarr->[0]};
my $ndi=substr($keyarr->[0],0,7) eq 'install'? "\n".('-'x$Ll):'';
sprintf( "%-20s". " "x8 ."%s$ndi", $keyarr->[0], $ins )
}
sort { $a->[1] cmp $b->[1] }
map [ $_, kenzoku($_) ],
grep { /^(?!installusr|ta|mv|mu|d_)\w*
(?:bin(?!compat)|arch(?!name|obj)|man(?:1|3)(?!ext)|priv|
(?:vendor|site)(?!lib_|prefix))
[a-z]*
/x } keys %Config::Config
);
exit;
## *** *** ##
sub kenzoku {
my $mwa=shift;
my $ins=$Config::Config{$mwa};
$Ll = ($Ll <= length($ins)+28)? length($ins)+28 : $Ll;
my $rwa=$mwa;
$rwa =~s/^install// or $rwa =~s/exp$//;
return
$rwa .( substr($mwa,0,7) eq 'install'? 3 :
substr($mwa,-3) eq 'exp'? 2 : 1 );
}
sub pselfIdentity {
my $pintexe=$^X;
unless( $Config::Config{exe_ext}
and
substr($pintexe,-4) eq $Config::Config{exe_ext} )
{
$pintexe .= $Config::Config{exe_ext};
}
unless( File::Spec->file_name_is_absolute($pintexe) ) {
$pintexe = (grep -x, map File::Spec->catfile($_,$pintexe)
, split /\Q$Config::Config{path_sep}/, $ENV{PATH})[0];
}
return( [$pintexe , length $pintexe] );
}
sub calc_midbuffs
{
my( $textW, $availW ) = @_ ;
if ( $ENV{'COLUMNS'} and ($ENV{'COLUMNS'} > $availW)
and ($textW > int(.9 * $availW)) )
{
$availW = $ENV{'COLUMNS'};
}
my $leew = $availW - $textW;
return int( ($leew + 0.5) / 2 );
}
__END__
=head1 DESCRIPTION
This is a simple program written for the curious Perl newbie or the thorough
perl administrator (the system admin responsible for the installation and
operating efficiency, and improvement thereof, and upgrades to, Perl...) who
wants to know more about the internal layout of the important directories
where Perl parts are kept.
Specifically, the program will display the directories where core and
site-extension perl modules are installed, allowing the prediction of where
yet-to-be built modules are going to land when Perl's module installation
facilities are done with them.
=head2 NOTES
If the F file read by your Perl interpreter during operation is
hosed (incorrect, tampered with, or invalid due to a binary being compiled on
a different system), then the resulting data displayed by this program
cannot be trusted. Garbage in, garbage out.
=head1 SEE ALSO
L, L, L
=head1 AUTHOR & CREDITS
Soren Andersen ECE a.k.a
ECE is responsible for all badness.
However Perl Monks "castaway" and "Aristotle" helped to point him towards
solutions that led to an improved script.
This release is cryptographically signed. The author / maintainers' GnuPG/OpenPGP
key is identified by No. C<0x4E244EA6> and should be locateable for verification
on keyservers worldwide. "perlsign" (modified code) was used as the signing tool.
=head1 COPYRIGHT AND LICENSE
Copyright 2003,2004 by Soren Andersen, U.S.A.
This program is Free software; you may redistribute it and/or modify it under the
same terms as Perl itself (See the F file in your Perl source kit). Part
of that license stipulates that you, the user, agrees that this Free software is
accepted "AS-IS" and comes with absolutely NO WARRANTY, not even the implied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=head4 Any POD appearing below this line are merely entries for support of
L and its automata.
=begin text
-----------------------------------------------------------------
=end text
=begin html
=end html
=pod OSNAMES
any
=pod SCRIPT CATEGORIES
UNIX : System_administration
CPAN
=cut
=begin gpg
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE//1uOBXOj2U4kTqYRAn+7AJ4lIvhZR393IkxuptUBLjKaON6SSACfQ9tv
fOFres1Pkt0k1VjW7vh9ftc=
=4e80
-----END PGP SIGNATURE-----
=end gpg