#! /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 loca
+tions
of the Perl installation configuration matching the perl interpreter c
+urrently
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);
};
## *** <main execution> *** ##
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;
## *** </main execution> *** ##
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 th
+orough
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 director
+ies
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 installat
+ion
facilities are done with them.
=head2 NOTES
If the F<Config.pm> file read by your Perl interpreter during operatio
+n is
hosed (incorrect, tampered with, or invalid due to a binary being comp
+iled on
a different system), then the resulting data displayed by this program
cannot be trusted. Garbage in, garbage out.
=head1 SEE ALSO
L<ExtUtils::MakeMaker>, L<Config>, L<perl>
=head1 AUTHOR & CREDITS
Soren Andersen E<lt>C<somian -AT- pobox *DOT* com>E<gt> a.k.a
E<lt>C<somian -AT- cpan *DOT* org>E<gt> is responsible for all badness
+.
However Perl Monks "castaway" and "Aristotle" helped to point him towa
+rds
solutions that led to an improved script.
This release is cryptographically signed. The author / maintainers' Gn
+uPG/OpenPGP
key is identified by No. C<0x4E244EA6> and should be locateable for ve
+rification
on keyservers worldwide. "perlsign" (modified code) was used as the si
+gning 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 i
+t under the
same terms as Perl itself (See the F<LICENSE> file in your Perl source
+ kit). Part
of that license stipulates that you, the user, agrees that this Free s
+oftware is
accepted "AS-IS" and comes with absolutely NO WARRANTY, not even the i
+mplied
warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
=head4 Any POD appearing below this line are merely entries for suppor
+t of
L<the CPAN Scripts Repository|http://www.cpan.org/scripts/index.html>
+and its automata.
=begin text
-----------------------------------------------------------------
=end text
=begin html
<hr>
=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
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.