<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">package CPANPLUS::Internals::Constants;
use deprecate;

use strict;

use CPANPLUS::Error;

use Config;
use File::Spec;
use Locale::Maketext::Simple    Class =&gt; 'CPANPLUS', Style =&gt; 'gettext';

require Exporter;
use vars    qw[$VERSION @ISA @EXPORT];

use Package::Constants;

$VERSION = "0.9135";
@ISA        = qw[Exporter];
@EXPORT     = Package::Constants-&gt;list( __PACKAGE__ );

sub constants { @EXPORT };

use constant INSTALLER_BUILD
                            =&gt; 'CPANPLUS::Dist::Build';
use constant INSTALLER_MM   =&gt; 'CPANPLUS::Dist::MM';
use constant INSTALLER_SAMPLE
                            =&gt; 'CPANPLUS::Dist::Sample';
use constant INSTALLER_BASE =&gt; 'CPANPLUS::Dist::Base';
use constant INSTALLER_AUTOBUNDLE
                            =&gt; 'CPANPLUS::Dist::Autobundle';

use constant SHELL_DEFAULT  =&gt; 'CPANPLUS::Shell::Default';
use constant SHELL_CLASSIC  =&gt; 'CPANPLUS::Shell::Classic';

use constant CONFIG         =&gt; 'CPANPLUS::Config';
use constant CONFIG_USER    =&gt; 'CPANPLUS::Config::User';
use constant CONFIG_SYSTEM  =&gt; 'CPANPLUS::Config::System';
use constant CONFIG_BOXED   =&gt; 'CPANPLUS::Config::Boxed';

use constant DEFAULT_SOURCE_ENGINE
                            =&gt; 'CPANPLUS::Internals::Source::Memory';

use constant TARGET_INIT    =&gt; 'init';
use constant TARGET_CREATE  =&gt; 'create';
use constant TARGET_PREPARE =&gt; 'prepare';
use constant TARGET_INSTALL =&gt; 'install';
use constant TARGET_IGNORE  =&gt; 'ignore';

use constant ON_WIN32       =&gt; $^O eq 'MSWin32';
use constant ON_NETWARE     =&gt; $^O eq 'NetWare';
use constant ON_CYGWIN      =&gt; $^O eq 'cygwin';
use constant ON_VMS         =&gt; $^O eq 'VMS';

use constant DOT_CPANPLUS   =&gt; ON_VMS ? '_cpanplus' : '.cpanplus';

use constant OPT_AUTOFLUSH  =&gt; '-MCPANPLUS::Internals::Utils::Autoflush';

use constant UNKNOWN_DL_LOCATION
                            =&gt; 'UNKNOWN-ORIGIN';

use constant NMAKE          =&gt; 'nmake.exe';
use constant NMAKE_URL      =&gt;
                        'ftp://ftp.microsoft.com/Softlib/MSLFILES/nmake15.exe';

use constant INSTALL_VIA_PACKAGE_MANAGER
                            =&gt; sub { my $fmt = $_[0] or return;
                                     return 1 if $fmt ne INSTALLER_BUILD and
                                                 $fmt ne INSTALLER_MM;
                            };

use constant IS_CODEREF     =&gt; sub { ref $_[-1] eq 'CODE' };
use constant IS_MODOBJ      =&gt; sub { UNIVERSAL::isa($_[-1],
                                            'CPANPLUS::Module') };
use constant IS_FAKE_MODOBJ =&gt; sub { UNIVERSAL::isa($_[-1],
                                            'CPANPLUS::Module::Fake') };
use constant IS_AUTHOBJ     =&gt; sub { UNIVERSAL::isa($_[-1],
                                            'CPANPLUS::Module::Author') };
use constant IS_FAKE_AUTHOBJ
                            =&gt; sub { UNIVERSAL::isa($_[-1],
                                            'CPANPLUS::Module::Author::Fake') };

use constant IS_CONFOBJ     =&gt; sub { UNIVERSAL::isa($_[-1],
                                            'CPANPLUS::Configure') };

use constant IS_RVOBJ       =&gt; sub { UNIVERSAL::isa($_[-1],
                                            'CPANPLUS::Backend::RV') };

use constant IS_INTERNALS_OBJ
                            =&gt; sub { UNIVERSAL::isa($_[-1],
                                            'CPANPLUS::Internals') };

use constant IS_FILE        =&gt; sub { return 1 if -e $_[-1] };

use constant FILE_EXISTS    =&gt; sub {
                                    my $file = $_[-1];
                                    return 1 if IS_FILE-&gt;($file);
                                    local $Carp::CarpLevel =
                                            $Carp::CarpLevel+2;
                                    error(loc(  q[File '%1' does not exist],
                                                $file));
                                    return;
                            };

use constant FILE_READABLE  =&gt; sub {
                                    my $file = $_[-1];
                                    return 1 if -e $file &amp;&amp; -r _;
                                    local $Carp::CarpLevel =
                                            $Carp::CarpLevel+2;
                                    error( loc( q[File '%1' is not readable ].
                                                q[or does not exist], $file));
                                    return;
                            };
use constant IS_DIR         =&gt; sub { return 1 if -d $_[-1] };

use constant DIR_EXISTS     =&gt; sub {
                                    my $dir = $_[-1];
                                    return 1 if IS_DIR-&gt;($dir);
                                    local $Carp::CarpLevel =
                                            $Carp::CarpLevel+2;
                                    error(loc(q[Dir '%1' does not exist],
                                            $dir));
                                    return;
                            };

                            ### On VMS, if the $Config{make} is either MMK
                            ### or MMS, then the makefile is 'DESCRIP.MMS'.
use constant MAKEFILE       =&gt; sub { my $file =
                                        (ON_VMS and
                                         $Config::Config{make} =~ /MM[S|K]/i)
                                            ? 'DESCRIP.MMS'
                                            : 'Makefile';

                                    return @_
                                        ? File::Spec-&gt;catfile( @_, $file )
                                        : $file;
                            };
use constant MAKEFILE_PL    =&gt; sub { return @_
                                        ? File::Spec-&gt;catfile( @_,
                                                            'Makefile.PL' )
                                        : 'Makefile.PL';
                            };
use constant BUILD_PL       =&gt; sub { return @_
                                        ? File::Spec-&gt;catfile( @_,
                                                            'Build.PL' )
                                        : 'Build.PL';
                            };

use constant META_YML       =&gt; sub { return @_
                                        ? File::Spec-&gt;catfile( @_, 'META.yml' )
                                        : 'META.yml';
                            };

use constant MYMETA_YML     =&gt; sub { return @_
                                        ? File::Spec-&gt;catfile( @_, 'MYMETA.yml' )
                                        : 'MYMETA.yml';
                            };

use constant META_JSON       =&gt; sub { return @_
                                        ? File::Spec-&gt;catfile( @_, 'META.json' )
                                        : 'META.json';
                            };

use constant MYMETA_JSON     =&gt; sub { return @_
                                        ? File::Spec-&gt;catfile( @_, 'MYMETA.json' )
                                        : 'MYMETA.json';
                            };

use constant BLIB           =&gt; sub { return @_
                                        ? File::Spec-&gt;catfile(@_, 'blib')
                                        : 'blib';
                            };

use constant LIB            =&gt; 'lib';
use constant LIB_DIR        =&gt; sub { return @_
                                        ? File::Spec-&gt;catdir(@_, LIB)
                                        : LIB;
                            };
use constant AUTO           =&gt; 'auto';
use constant LIB_AUTO_DIR   =&gt; sub { return @_
                                        ? File::Spec-&gt;catdir(@_, LIB, AUTO)
                                        : File::Spec-&gt;catdir(LIB, AUTO)
                            };
use constant ARCH           =&gt; 'arch';
use constant ARCH_DIR       =&gt; sub { return @_
                                        ? File::Spec-&gt;catdir(@_, ARCH)
                                        : ARCH;
                            };
use constant ARCH_AUTO_DIR  =&gt; sub { return @_
                                        ? File::Spec-&gt;catdir(@_,ARCH,AUTO)
                                        : File::Spec-&gt;catdir(ARCH,AUTO)
                            };

use constant BLIB_LIBDIR    =&gt; sub { return @_
                                        ? File::Spec-&gt;catdir(
                                                @_, BLIB-&gt;(), LIB )
                                        : File::Spec-&gt;catdir( BLIB-&gt;(), LIB );
                            };

use constant BIN            =&gt; 'bin';

use constant SCRIPT         =&gt; 'script';

use constant CONFIG_USER_LIB_DIR =&gt; sub {
                                    require CPANPLUS::Internals::Utils;
                                    LIB_DIR-&gt;(
                                        CPANPLUS::Internals::Utils-&gt;_home_dir,
                                        DOT_CPANPLUS
                                    );
                                };
use constant CONFIG_USER_FILE    =&gt; sub {
                                    File::Spec-&gt;catfile(
                                        CONFIG_USER_LIB_DIR-&gt;(),
                                        split('::', CONFIG_USER),
                                    ) . '.pm';
                                };
use constant CONFIG_SYSTEM_FILE  =&gt; sub {
                                    # Debian-specific shortcut
                                    return '/etc/perl/CPANPLUS/Config/System.pm';
                                    
                                    require CPANPLUS::Internals;
                                    require File::Basename;
                                    my $dir = File::Basename::dirname(
                                        $INC{'CPANPLUS/Internals.pm'}
                                    );

                                    ### XXX use constants
                                    File::Spec-&gt;catfile(
                                        $dir, qw[Config System.pm]
                                    );
                                };

use constant README         =&gt; sub { my $obj = $_[0];
                                     my $pkg = $obj-&gt;package_name;
                                     $pkg .= '-' . $obj-&gt;package_version .
                                             '.readme';
                                     return $pkg;
                            };
use constant META_EXT       =&gt; 'meta';

use constant META           =&gt; sub { my $obj = $_[0];
                                     my $pkg = $obj-&gt;package_name;
                                     $pkg .= '-' . $obj-&gt;package_version .
                                             '.' . META_EXT;
                                     return $pkg;
                            };

use constant OPEN_FILE      =&gt; sub {
                                    my($file, $mode) = (@_, '');
                                    my $fh;
                                    open $fh, "$mode" . $file
                                        or error(loc(
                                            "Could not open file '%1': %2",
                                             $file, $!));
                                    return $fh if $fh;
                                    return;
                            };

use constant OPEN_DIR       =&gt; sub {
                                    my $dir = shift;
                                    my $dh;
                                    opendir $dh, $dir or error(loc(
                                        "Could not open dir '%1': %2", $dir, $!
                                    ));

                                    return $dh if $dh;
                                    return;
                            };

use constant READ_DIR       =&gt; sub {
                                    my $dir = shift;
                                    my $dh  = OPEN_DIR-&gt;( $dir ) or return;

                                    ### exclude . and ..
                                    my @files =  grep { $_ !~ /^\.{1,2}/ }
                                                    readdir($dh);

                                    ### Remove trailing dot on VMS when
                                    ### using VMS syntax.
                                    if( ON_VMS ) {
                                        s/(?&lt;!\^)\.$// for @files;
                                    }

                                    return @files;
                            };

use constant STRIP_GZ_SUFFIX
                            =&gt; sub {
                                    my $file = $_[0] or return;
                                    $file =~ s/.gz$//i;
                                    return $file;
                            };

use constant CHECKSUMS      =&gt; 'CHECKSUMS';
use constant PGP_HEADER     =&gt; '-----BEGIN PGP SIGNED MESSAGE-----';
use constant ENV_CPANPLUS_CONFIG
                            =&gt; 'PERL5_CPANPLUS_CONFIG';
use constant ENV_CPANPLUS_IS_EXECUTING
                            =&gt; 'PERL5_CPANPLUS_IS_EXECUTING';
use constant DEFAULT_EMAIL  =&gt; 'cpanplus@example.com';
use constant CPANPLUS_UA    =&gt; sub { ### for the version number ###
                                     require CPANPLUS::Internals;
                                     "CPANPLUS/$CPANPLUS::Internals::VERSION"
                                };
use constant TESTERS_URL    =&gt; sub {
                                    'http://cpantesters.org/distro/'.
                                    uc(substr($_[0],0,1)) .'/'. $_[0] . '.yaml';
                                };
use constant TESTERS_DETAILS_URL
                            =&gt; sub {
                                    'http://cpantesters.org/distro/'.
                                    uc(substr($_[0],0,1)) .'/'. $_[0];
                                };

use constant CREATE_FILE_URI
                            =&gt; sub {
                                    my $dir = $_[0] or return;
                                    return $dir =~ m|^/|
                                        ? 'file://'  . $dir
                                        : 'file:///' . $dir;
                            };

use constant EMPTY_DSLIP    =&gt; '     ';

use constant CUSTOM_AUTHOR_ID
                            =&gt; 'LOCAL';

use constant DOT_SHELL_DEFAULT_RC
                            =&gt; '.shell-default.rc';

use constant SOURCE_SQLITE_DB
                            =&gt; 'db.sql';

use constant PREREQ_IGNORE  =&gt; 0;
use constant PREREQ_INSTALL =&gt; 1;
use constant PREREQ_ASK     =&gt; 2;
use constant PREREQ_BUILD   =&gt; 3;
use constant BOOLEANS       =&gt; [0,1];
use constant CALLING_FUNCTION
                            =&gt; sub { my $lvl = $_[0] || 0;
                                     return join '::', (caller(2+$lvl))[3]
                                };
use constant PERL_CORE      =&gt; 'perl';
use constant PERL_WRAPPER   =&gt; 'use strict; BEGIN { my $old = select STDERR; $|++; select $old; $|++; $0 = shift(@ARGV); my $rv = do($0); die $@ if $@; }';
use constant STORABLE_EXT   =&gt; '.stored';

use constant GET_XS_FILES   =&gt; sub { my $dir = $_[0] or return;
                                     require File::Find;
                                     my @files;
                                     File::Find::find(
                                        sub { push @files, $File::Find::name
                                                if $File::Find::name =~ /\.xs$/i
                                        }, $dir );

                                     return @files;
                                };

use constant INSTALL_LOG_FILE
                            =&gt; sub { my $obj  = shift or return;
                                     my $name = $obj-&gt;name; $name =~ s/::/-/g;
                                     $name .= '-'. $obj-&gt;version;
                                     $name .= '-'. scalar(time) . '.log';
                                     return $name;
                                };

use constant ON_OLD_CYGWIN  =&gt; do { ON_CYGWIN and $] &lt; 5.008
                                    ? loc(
                                       "Your perl version for %1 is too low; ".
                                       "Require %2 or higher for this function",
                                       $^O, '5.8.0' )
                                    : '';
                                };

### XXX these 2 are probably obsolete -- check &amp; remove;
use constant DOT_EXISTS     =&gt; '.exists';

use constant QUOTE_PERL_ONE_LINER
                            =&gt; sub { my $line = shift or return;

                                     ### use double quotes on these systems
                                     return qq["$line"]
                                        if ON_WIN32 || ON_NETWARE || ON_VMS;

                                     ### single quotes on the rest
                                     return qq['$line'];
                            };

1;

# Local variables:
# c-indentation-style: bsd
# c-basic-offset: 4
# indent-tabs-mode: nil
# End:
# vim: expandtab shiftwidth=4:
</pre></body></html>