2

I installed Ubuntu earlier this weekend and had to install an updated version of perl(5.22.0) for a script I'm using. However when I used CPAN to install the modules I needed I found out that they got installed in Ubuntu's default perl(5.18.2). I've ran perl -l and its showing the updated perl5, but for some reason CPAN refuses to use it.

I'm sure its a configuration issue or I'm misunderstanding how CPAN works. Either way i have looked through pages and pages of google trying to find a solution to no avail. I'm hoping someone here could guide me in the right direction and maybe this could be of some help to others having a similar issue.

chicks
  • 3,793
  • 10
  • 27
  • 36
Sarge888
  • 23
  • 1
  • 5

1 Answers1

3

I had exactly the same problem. Caveat: I'm using fedora. But, fc22 broke my perl scripts [the perl 5.20.3 interpreter would segfault], so I had to install 5.22.0, so I have some direct experience with this.


Finding out about the new interpreter's config

First, how you installed. I'm guessing that you used the installer to install the binary package for 5.22.0. Did this overwrite /usr/bin/perl? I assume so. Or, did it get installed as (e.g.) /usr/bin/perl-5.22.0?

In /usr/lib64/perl/Config.pm, look at the bottom to find the tied hash. This will have the configuration. Another [perhaps better] way to get this is to dump out @INC and do use Config; and dump out the Config hash from a [of course--perl] script.

Of particular interest will be the privlibexp, sitearchexp,sitelibexp, and archlibexp variables.

Dumping @INC is the most definitive.

The question to note/answer is: Does the 5.22.0 perl interpreter use the 5.22.0 directories or does some of the config still point to 5.18.2?

Under one or more of these directories should be CPAN.pm along with the CPAN subdir. My guess is that you'll find it only under the 5.18.2 related directory.

In fact, with some investigation, you may find that you now have a "hybrid" installation that is neither quite 5.18.2 nor quite 5.22.0. If you [decide to] follow my "recommended best practice" [see below], you may wish to uninstall 5.22.0 so you have a stock/standard 5.18.2 installation. This minimizes headaches if Ubuntu does issues a patch.


A bit about CPAN

When a distro installs perl packages that overlap with packages you can get from CPAN, it works, sort of. But, in reality, they often clash. Also, using a non-standard perl version against the distro requires even more care.

You'll probably have to install CPAN under the 5.22.0 directory using the new interpreter. That may be the short answer.

So, this brings up the question of how CPAN got installed in the first place. Did it come from the distro or did it get pulled and installed manually? If from distro, an "upgrade" may work. Otherwise, manually install it from the new perl interpreter--that should send it [and anything it installs] to the correct place.

Also, under $HOME you should find a .cpan directory [if you've run it]. Of particular interest is $HOME/.cpan/CPAN subdir. It should have a cpan config file (e.g. $HOME/.cpan/CPAN/MyConfig.pm). There are a number of variables, but make_install_make_command may be of some use


What I've done--recommended best practice

[Side note: I've been doing perl for 20+--my current script repo has 250,000 lines in it].

I've had to deal with this sort of problem a few [more than a few] times. Frankly, I don't "fight" the distro anymore, because of problems like the one you're having. Even though, on paper, distros claim to be able to install multiple package versions simultaneously, I've always had bad luck with this--perl in particular.

IMO, and in my experience, the problem you're having is just the tip of the iceberg. Even if you solve, there are probably more, similar problems later on.

If I need an alternate perl version, I go to the perl website, download the source tarball and rebuild it. Note: The recommended advice [from the perl website] is to download the source from the perl website and not try to rebuild from a distro source package.

I specify an alternate prefix to the ./Configure script so that everything gets put in a new place. Then, do a make and make install.

For example, my 5.22.0 perl is under /home/alt/perl/perl-5.22.0 and has bin/perl, lib/CPAN.pm, and lib/CPAN under it. I am able to maintain as many different versions as I want because they each to to /home/alt/perl/<version>

After that, I can do (e.g.): ln -sf /home/alt/perl/perl-5.22.0/bin/perl /usr/bin/perl22 and change the scripts I want to use it with #!/usr/bin/perl22.

Here are the options I use to configure perl. The first three are the most important [*]:

-Dprefix=/home/alt/perl/perl-5.22.0
-Dstartperl=/home/alt/perl/perl-5.22.0/bin/perl
-Dusethreads=y
-DEBUGGING=both
-Doptimize=-gdwarf-2
-Dman1dir=none
-Dcf_email=anybody@gmail.com
-Dpager=/usr/bin/less
'-Dstatic_ext=threads threads/shared'
-d
-e
-s

Note that because I was having trouble with fedora's 5.20.3, I may have added some extra debug options that you won't need.

Another place to put this is /home/myself/perl/perl-5.22.0 if you want a private/experimental copy.

NOTE: Because I used a completely different place to install 5.22.0, 5.22.0 and 5.20.3 coexist in complete harmony. They do not interfere in any way [AFAICT].

You can even try this without interfering with the 5.22.0 you've already installed.


My actual rebuild scripts

[*] P.S. Of course, I have a fully automated perl script to do all this configure, build, install [and pull tarball from website]

These will not be runnable as is, because they require/assume a lot of my existing infrastructure. They're merely for a loose reference. If you care to look at all, ignore about 99.44% of what you don't immediately recognize.

Here's the perl specific script:

#!/usr/bin/perl
# altbld/qprlmkx -- connect to CPAN
#
# xperl -- execute script with alternate perl interpreter
#   "-b" -- use base script name (e.g. skip XBIN)
#   "-ddd" -- run ddd on perl
#   "-db" -- run perl script debugger (perl's -d)
#   "-D" -- perl -D options (see perlrun manpage)
#   "-E" -- environment variables
#   "-Lc" -- use alternate glibc (BROKEN)
#   "-Ld" -- set up PERLIO_DEBUG
#   "-Le" -- force glibc to use stderr for fatal errors
#   "-S" -- do vxshazam (recommended for debug on vxshazam programs)
#
# pathx -- dump the path
#
# qprlmkc -- configure perl interpreter
# qprlmkx -- remake perl interpreter

use qslib::qsinit;
use qpile::qpchk;
use qsnet::rshlib;
use pjx::pjxlib;
use qpile::qploc;
use altbld::altlib;
use gtx::gtxlib;

master(@ARGV);
exit(0);

# master -- master control
sub master
{
    my(@argv) = @_;
    my($proc);
    my(@opts);

    unshift(@argv,"-ddd")
        if ($pgmtail eq "qprlgdb");

    while (1) {
        vbqdash(\@argv);
        vbqnumdcd($_,"-S",1,\$keyS);

        vbqnumdcd($_,"-go",1,\$keygo);

        if (($pgmtail eq "xperl") || ($pgmtail =~ /^tskdir/)) {
            vbqnumdcd($_,"-b",1,\$keyb);
            vbqnumdcd($_,"-db",1,\$keydb);
            vbqvstrdcd($_,"-D","tlsRSD",\@keyD);
            vbqvstrdcd($_,"-E",undef,\@keyE);

            vbqnumdcd($_,"-Le",1,\$keyLe);
            vbqnumdcd($_,"-Lc",1,\$keyLc);
            vbqnumdcd($_,"-Ld",1,\$keyLd);

            pjxdddopt($_);
            vbqnumdcd($_,"-help",1,\$keyhelp);
            vbqnumdcd($_,"-Q",1,\$keyQ);
            vbqnumdcd($_,"-S",1,\$keyS);
        }

        if ($pgmtail eq "qprlmkc") {
            vbqvstrdcd($_,"-D",undef,\@keyD);
            vbqnumdcd($_,"-publish",1,\$keypublish);
        }

        vbqnumdcd($_,"-ask",1,\$keyask);
        vbqnumdcd($_,"-sh",1,\$keysh);

        altoptdcd($_);

        sysusage($_);
    }

    vxshazam()
        if ($keyS);

    push(@opts,"-V$keyV")
        if ($keyV ne "");
    $APL = altverget(@opts,"perl");
    $ALTPERL = $APL->{alt_xfile};

    $APL->{alt_bld} = $APL->{alt_src};

    $APL->{alt_remhost} = "ftp.cpan.org";
    $APL->{alt_remtop} = "pub/CPAN/src";
    ###$APL->{alt_remdir} = "/gcc-" . $APL->{alt_revuse};
    $APL->{alt_remsuf} = ".tar.gz";

    $proc = "cmd_" . $pgmtail;
    &$proc(@argv);
}

# cmd_qprlwget -- pull perl
sub cmd_qprlwget
{

    altwget($APL);
}

# cmd_qmetacfg -- pull perl
sub cmd_qmetacfg
{
    my($sdir);
    my($tail);

    $sdir = $APL->{alt_top};
    msg("$pgmtail: chdir %s ...\n",$sdir);
    xchdir($sdir);

    # get metaconfig
    {
        if (-d $tail) {
            msg("$pgmtail: project dir already exists\n");
            last;
        }

        last;

        vxsystem("git","clone",
            "git://perl5.git.perl.org/$tail.git",
            $tail);
    }
}

# cmd_qprlver -- show versions
sub cmd_qprlver
{
}

# cmd_qprldis -- disassemble executable
sub cmd_qprldis
{

    vxsystem("-x","asmdis",$APL->{alt_xfile});
}

# cmd_qprlmkc -- configure perl
sub cmd_qprlmkc
{
    my(@opts);
    my(@shopts);
    push(@lnklist);
    my($src,$ins,$bld,$xfile);
    my($tail,$lnkto);

    $keygo = 0
        if ($keypublish);

    $src = $APL->{alt_src};
    $ins = $APL->{alt_ins};
    $bld = $APL->{alt_bld};
    $xfile = $APL->{alt_xfile};

    xchdir($src);
    ###sysrmdir($bld);
    ###xmkdir($bld);
    ###xchdir($bld);

    # make depend fails [due to bug] without some symlinks
    ###push(@lnklist,qw(makedepend.SH Makefile.SH perl_exp.SH config_h.SH));
    foreach $tail (@lnklist) {
        $lnkto = "$src/$tail";
        symlink($lnkto,$tail) ||
            sysfault("qprlmkc: unable to symlink to '%s' -- $!\n",$lnkto);
    }

    # save us some complaints
    if ($keygo) {
        xmkdir($ins);
        xmkdir("$ins/bin");
    }

    push(@opts,"-Dprefix=$ins");
    push(@opts,"-Dstartperl=$xfile");

    push(@opts,"-Dusethreads=y");
    ###push(@opts,"-Duseithreads=y");
    ###push(@opts,"-Duselargefiles");
    ###push(@opts,"-Duse64bitall=y");

    ###push(@opts,"-Dusedevel");
    push(@opts,"-DEBUGGING=both");
    push(@opts,"-Doptimize=-gdwarf-2");

    ###push(@keyD,"DEBUG_LEAKING_SCALARS");

    foreach $opt (@keyD) {
        push(@opts,"-A","ccflags=-D$opt");
    }

    # hard to breakpoint on dynamically loaded stuff
    if (1) {
        push(@sext,"threads");
        push(@sext,"threads/shared");
    }

    push(@opts,"-Dman1dir=none");
    $env = gtxconfig("user");
    $email = $env->{email};
    $email = "anybody\@gmail.com"
        if ($keypublish);
    push(@opts,"-Dcf_email=" . $email);

    if (0) {
        push(@opts,"-Dnetdb_host_type=const void *");
        push(@opts,"-Dnetdb_hlen_type=socklen_t");
    }

    push(@opts,"-Dpager=/usr/bin/less");

    if (@sext > 0) {
        $opt = join(" ",@sext);
        push(@opts,"-Dstatic_ext=$opt");
    }

    # NOTE: to use threads, one must also use perlio :-(
    ###push(@opts,"-Duseperlio=n");

    ###push(@opts,$APL->{alt_src});

    # whip through defaults
    push(@opts,"-d","-e","-s")
        unless ($keyask);

    msgv("$pgmtail: OPTS",@opts);

    if ($keypublish) {
        foreach $opt (@opts) {
            $opt = $quo_1 . $opt . $quo_1
                 if ($opt =~ /\s/);
            printf("%s\n",$opt);
        }
    }

    unless ($keygo) {
        sysfault("$pgmtail: rerun with -go to actually do it\n");
    }

    sleep(5)
        if (sysisatty(1));

    push(@shopts,"-x")
        if ($keysh);

    {

        last unless ($keygo);

        vxsystem("sh",@shopts,"$APL->{alt_src}/Configure",@opts);
    }

    # complains on the second round
    {
        last unless ($keygo);

        last if (-e "$src/MANIFEST_NOT");

        msg("$pgmtail: renaming manifest ...\n");
        rename("$src/MANIFEST","$src/MANIFEST_NOT");

        $xfdst = xfopen(">$src/MANIFEST","qprlmkc");
        $xfdst = xfclose($xfdst,"qprlmkc");
    }
}

# cmd_qprlmkx -- make perl executable
sub cmd_qprlmkx
{
    my(@opts);

    xchdir($APL->{alt_bld});

    vxsystem("-x","make");
}

# cmd_xperl -- invoke alternate perl
sub cmd_xperl
{
    my(@argv) = @_;
    my(@opts);

    unshift(@argv,"-V")
        if ($keyQ);

    @opts = altperl(@argv);

    enveval("ALTPERL",$ALTPERL);

    {
        last if (defined($keyddd));
        xperlenv();
        exec($ALTPERL,@opts);
        sysfault("$pgmtail: exec of '%s' failed -- $!\n",$ALTPERL);
    }

    pjxgdbinit("-alien=$APL->{alt_src}",@opts);
    pjxdddloc();

    xperlenv();
    vxsystem("-x",@ddd,$ALTPERL);
}

# xperlenv -- set up environment
sub xperlenv
{
    my($opt);

    foreach $opt (@keyE) {
        if ($opt =~ /$keyval_rgx/o) {
            enveval($1,$2);
        }
    }
}

# altperl -- get alternate perl
sub altperl
{
    my(@argv) = @_;
    my(@keyD);
    local(@opts);
    my($tail,$file);
    my($logf);

    zprt(ZPXHOWEXEC,"altperl: ENTER\n");

    zprtlist(ZPXHOWEXEC,"altperl/ARGV",\@argv);

    envchk(qw(XLBIN));

    # turn on perl's internal tracing
    # NOTE: perl must be compiled with -DEBUGGING for this to work
    foreach $opt (@keyD) {
        push(@opts,"-D$opt");
        $keyLe = 1;
    }

    # run the script debugger
    push(@opts,"-dt")
        if ($keydb);

    while (1) {
        vbqdash(\@argv);
        push(@opts,$_);
        zprt(ZPXHOWEXEC,"altperl: PUSHOPT '%s'\n",$_);
    }

    # locate the script
    {
        $tail = shift(@argv);

        $file = tstloc($tail);
        last if (defined($file));

        if ($tail =~ m,^[./],) {
            $file = $tail;
            last;
        }

        # skip the XBIN entries and go direct to the final script
        if ($keyb) {
            $file = basescan($tail);
            last;
        }

        $file = "$XLBIN/$tail";
    }
    push(@opts,$file);

    # tell tskdirbug to _not_ fork/exec
    {
        last unless ($keyddd || $keydb);
        last unless (defined($tst_xfile));
        push(@opts,"-d");
    }

    enveval("LIBC_FATAL_STDERR_",1)
        if ($keyLe);

    $keyLd = 1
        if (zprtok(ZPXHOWGDB));

    if ($keyLd) {
        $logf = logfile("qprldbg");
        msg("altperl: PERLIO_DEBUG %s ...\n",$logf);
        unlink($logf);
        enveval("PERLIO_DEBUG",$logf);
    }

    # FIXME/CAE -- this needs work
    ###$glibc_ins = "/home/libc";
    ###$dir = "$glibc_ins/lib";
    ###enveval("LD_LIBRARY_PATH",$dir)
        ###if ($keyLc);

    push(@opts,@argv);
    msgv("altperl: OPTS",@opts,"...");

    zprt(ZPXHOWEXEC,"altperl: EXIT\n");

    @opts;
}

# basescan -- run perl debugger on base script
sub basescan
{
    my($basetail) = @_;
    my($topdir);
    my($basefile);
    my($bindir,@binpath);
    my($lnkfile);

    $topdir = syshome("altperl");
    sysrmdir($topdir);
    xmkdir($topdir);

    @binpath = qpbinpath();
    foreach $bindir (@binpath) {
        push(@opts,"-I$bindir");
    }

    $basefile = qplocate($basetail);
    sysfault("basescan: unable to locate '%s'\n",$basetail)
        unless (-e $basefile);
    msg("basescan: %s --> %s ...\n",$basetail,$basefile);

    # we have to create a link with the correct command name in it
    $lnkfile = "$topdir/$basetail";
    symlink($basefile,$lnkfile) ||
        sysfault("basescan: unable to symlink '%s' to '%s' -- $!\n",
            $lnkfile,$basefile);

    $lnkfile;
}

# cmd_pathx -- show path
sub cmd_pathx
{
    my(@argv) = @_;

    # execute ourself with the alternate interpreter -- we will _not_
    # recurse further because we're leaving off the -P
    {
        last if ($keyV eq "");
        exec($ALTPERL,$0);
        sysfault("$pgmtail: exec failure -- $!\n");
    }

    showpath("INC",\@INC);
    showpath("PATH");
    showpath("LD_LIBRARY_PATH");
}

# showpath -- show a path
sub showpath
{
    my($sym,$path) = @_;
    my(@path);

    printf("%s:\n",$sym);

    {
        if (ref($path)) {
            @path = @$path;
            last;
        }

        $path = $ENV{$sym};
        @path = syspathsplit($path);
    }

    foreach $path (@path) {
        printf("  %s\n",$path);
    }
}

# cmd_tskdirbug -- wrapper for tskdirbug
sub cmd_tskdirbug
{
    my($xfile);

    $xfile = tstloc();

    if ($keyhelp) {
        sysusage_less(pgmbase(),$xfile);
    }
}

# tstloc -- locate script
sub tstloc
{
    my($tail) = @_;
    my($code);
    my($xfile);

    $tail //= "tskdirbug";

    $tst_top = cdxgo("cdt");

    {
        if ($tail =~ /^tskdir/) {
            $tst_dir = "$tst_top/tskdirbug";
            last;
        }

        $tst_dir = "$tst_top/$tail";
    }

    $xfile = "$tst_dir/$tail";
    undef($xfile)
        unless (-e $xfile);

    $tst_xfile = $xfile;

    {
        last if ($keyhelp);

        last unless (defined($xfile));

        $code = qpchkgo($xfile);
        exit(1) if ($code);
    }

    $xfile;
}

Here's it's primary library [which is the basis to build other things, such as glibc, gcc, etc]:

# altbld/altlib.pm -- common alternate make control
#
#@+
#   "-a" -- push all versions
#   "-go" -- actually do it (install)
#   "-j" -- suppress parallel build
#   "-url" -- output top url
#   "-V" -- target version to build (DEFAULT: highest)
#   "-x" -- extractable versions
#@-

_altsetup();

# _altsetup -- passive setup
sub _altsetup
{

    $altsuf{".tar.gz"} = "z";
    $altsuf{".tgz"} = "z";

    $altsuf{".tar.bz"} = "j";
    $altsuf{".tbz"} = "j";

    @altsuf = reverse(sort(keys(%altsuf)));
}

# altoptdcd -- decode options
sub altoptdcd
{
    my($arg) = @_;

    vbqnumdcd($arg,"-a",1,\$keya);
    vbqnumdcd($arg,"-go",1,\$keygo);
    vbqstrdcd($arg,"-install","",\$keyinstall);
    vbqnumdcd($arg,"-j",1,\$keyj);
    vbqstrdcd($arg,"-V","",\$keyV);
    vbqnumdcd($arg,"-x",1,\$keyx);
    vbqnumdcd($arg,"-url",1,\$keyurl);
}

# altwget -- get versions
sub altwget
{
    local($alt) = @_;
    local($remtop);
    local($foundcnt);
    my($rev,@revlist);

    sysfault("!altwget: bad pointer\n")
        unless (ref($alt));

    # most sites allow ftp with some exceptions (e.g. python.org)
    $remtop = $alt->{alt_remproto};
    $remtop //= "ftp";

    $remtop .= "://" . $alt->{alt_remhost} . "/" . $alt->{alt_remtop};

    {
        if ($keyurl) {
            printf("%s\n",$remtop);
            last;
        }

        if ($keya) {
            @revlist = @{$alt->{alt_revlist}};
            last;
        }

        push(@revlist,$alt->{alt_revuse});
    }

    foreach $rev (@revlist) {
        _altwget($rev);
    }
}

# _altwget -- pull version from website
sub _altwget
{
    my($rev) = @_;
    my($remurl,$remtail);
    my($tgzfile);
    my($dir,@dirs);
    my($subdir);
    my($cmd);

    $remurl .= $remtop;
    $remurl .= $alt->{alt_remdir};
    $remtail = $alt->{alt_name} . "-$rev" . $alt->{alt_remsuf};
    $remurl .= "/$remtail";

    xchdir($alt->{alt_netsave});
    $tgzfile = $alt->{alt_netsave} . "/$remtail";

    {
        $cmd = $altsuf{$alt->{alt_remsuf}};

        if (defined($cmd)) {
            $cmd .= "xf";
            last;
        }

        sysfault("_altwget: unknown suffix -- %s\n",$remurl);
    }

    {
        # pull the file
        unless (-e $tgzfile) {
            msgv("altwget:",NOGO("pulling"),$remurl,"...");
            if ($keygo) {
                $code = vxsystem("wget",$remurl);
                last if ($code);
            }
        }

        {
            ($dir) = homesrc("-d",$alt->{alt_name});

            unless (defined($dir)) {
                msgv("altwget: no directory found --",@dirs);
                last;
            }

            zprtx("\n")
                if ($keya);

            $subdir = "$dir/" . $alt->{alt_name} . "-$rev";
            if (-d $subdir) {
                msgv("altwget:",NOGO("removing"),$subdir);
                sysrmdir($subdir)
                    if ($keygo);
            }

            msgv("altwget:",NOGO("extracting"),$rev,"in",$dir,"...");
            $code = vxsystem("-C$dir","tar",$cmd,$tgzfile)
                if ($keygo);

            $foundcnt++;
        }

        unless ($keygo) {
            msg("altwget: rerun with -go to actually do it\n");
            last;
        }
    }

    msg("altwget: %s\n",$code ? "errors" : "complete");
}

# altverget -- get version
sub altverget
# "-ins" -- scan install directories
# "-q" -- quiet mode
{
    my(@argv) = @_;
    my($keyins,$keyq) = (0,0);
    my($keyV);
    my($svmsg);
    my($pjname);
    my($tail,@tails);
    my($dir,@dirs);
    my(@revlist);
    my($revfound);
    my($revuse);
    my($sym,$val);
    my($suf);
    my($alt);

    while (1) {
        vbqdash(\@argv);
        vbqnumdcd($_,"-ins",1,\$keyins);
        vbqstrdcd($_,"-V","",\$keyV);
        vbqnumdcd($_,"-q",1,\$keyq);
        vbqusage($_,"altverget");
    }

    $svmsg = msgqtpush($keyq);

    $pjname = shift(@argv);
    msg("altverget: project %s ...\n",$pjname);
    $alt = {};
    $alt->{alt_name} = $pjname;

    envchk(qw(NETSAVE));
    $alt->{alt_netsave} = filejoin($NETSAVE,$pjname);
    msg("altverget: netsave %s ...\n",$alt->{alt_netsave});

    $alt->{alt_ins} = "/home/alt/$pjname";

    $revlist = [];
    $alt->{alt_revlist} = $revlist;

    {
        if ($keyins) {
            @dirs = ($alt->{alt_ins});
            msg("altverget: from install ...\n");
            last;
        }

        if ($keya) {
            $keyx = 1;
        }
        else {
            last if ($pgmtail =~ /wget/);
        }

        if ($keyx) {
            msg("altverget: from netsave ...\n");
            @dirs = ($alt->{alt_netsave});
            last;
        }

        msg("altverget: from src ...\n");
        @dirs = homesrc($pjname);
    }

    foreach $dir (@dirs) {
        $alt->{alt_top} = $dir;
        $alt->{alt_src} = $dir;

        # get known versions
        if (-e $alt->{alt_src}) {
            @tails = xfdirload($alt->{alt_src},"altverget");

            foreach $tail (@tails) {
                next unless ($tail =~ s/^$pjname-//);
                foreach $suf (@altsuf) {
                    last if ($tail =~ s,$suf$,,);
                }
                push(@$revlist,$tail);
            }

            @$revlist = revsort(@$revlist);
            msgv("altverget: versions",@$revlist);

            $revfound = $revlist->[$#$revlist];

            last;
        }
    }

    # do final selection on revision
    {
        {
            # explicit command line override
            if ($keyV ne "") {
                $revuse = $keyV;
                last;
            }

            # grab an override from the environment
            $sym = "ALTREV_" . $pjname;
            $val = $ENV{$sym};
            if ($val ne "") {
                $revuse = $val;
                last;
            }

            $sym = "PJNAME";
            $val = $ENV{$sym};
            if ($val =~ s/^$pjname-//) {
                $revuse = $val;
                last;
            }

            # use searched for value
            $revuse = $revfound;
        }

        if ($revuse eq "") {
            $revuse = "unknown";
            $alt->{alt_revuse} = $revuse;
            last if ($keyins);
            last if ($keyurl);
            sysfault("altverget: no version specified\n");
        }

        msg("altverget: VERSION %s ...\n",$revuse);
        $alt->{alt_revuse} = $revuse;
    }

    $alt->{alt_src} .= "/$pjname-$revuse";
    msg("altverget: source %s ...\n",$alt->{alt_src});

    $alt->{alt_bld} = syshome("-xt","alt/build/$pjname/$pjname-$revuse");
    msg("altverget: build %s ...\n",$alt->{alt_bld});

    $alt->{alt_ins} .= "/$pjname-$revuse";
    ###$alt->{alt_ins} .= "/$pjname";
    msg("altverget: install %s ...\n",$alt->{alt_ins});

    {
        if ($revuse eq "std") {
            $alt->{alt_xfile} = "/usr/bin/$pjname";
            $alt->{alt_std} = 1;
            last;
        }

        $pjname =~ s/-.+$//;
        $alt->{alt_xfile} = $alt->{alt_ins} . "/bin/$pjname";
    }
    msg("altverget: xfile %s ...\n",$alt->{alt_xfile});

    msgqtpop($svmsg);

    $alt;
}

1;
Craig Estey
  • 524
  • 2
  • 5
  • alot of helpful info and insight here, thx. Well il start off by saying that the new perl is installed as perl5 so it doesnt actually replace the system perl. When looking in "/usr/lib/perl5" i do not see a config file. It seems to be a fresh directory if just a few folders and one LibAppArmor.pm file. In the other directory "/usr/lib/perl" it had both 5.18 & 5.18.2 folders. Inside the latter had the config file which was missing from perl5 folder. I suspect thats because CPAN isnt configured to use the new perl binary? – Sarge888 Dec 08 '15 at 00:36
  • Cpan's directory in $home does have a MyConfig.pm but nothing that seems to relate to what perl binary to use. doing 'which perl' gives me '/usr/local/bin/perl'. maybe i need to get that to change to perl5(perl5.22.0 in bin directory). sry im still a bit new to this. – Sarge888 Dec 08 '15 at 00:41
  • @Sarge888 All scripts will need their `#!` lines changed if 5.22.0 isn't `/usr/bin/perl`. Do `--version` on all interpreters (e.g. `/usr/bin/perl`, `/usr/local/bin/perl`, etc.) to verify. Then, do the `@INC` print script on them. This tells you which dirs to use. Something I didn't know about: `cpanm` https://metacpan.org/pod/distribution/App-cpanminus/bin/cpanm It's a single file and "does everything" Edit the top line `#!` line. It's okay to edit your question and post more info as you discover it (e.g. outputs, ls's, etc.). msg me and I can take a look and maybe update my answer – Craig Estey Dec 08 '15 at 01:41
  • Thats the problem, the modules are being installed to 5.18.2 and NOT 5.22.0. so unless i can get cpan to install to a new perl, setting the script' #! to use the new perl will just error out with missing modules. – Sarge888 Dec 09 '15 at 03:36
  • @Sarge888 A simple way may be to tar up the cpan files from 5.18.2 [or get a full, fresh copy from cpan.org] and extract them to the correct place in the 5.22.0 directory. Then, using perl22, run cpan (e.g. perl22 -Mcpan) and have it do a full upgrade of everything. It will probably _tell_ you that it wants to do this when it sees downrev stuff in the directory when it first comes up (e.g. recommends "install CPAN" and "install Bundle::CPAN") – Craig Estey Dec 09 '15 at 04:09
  • alright, i will try this either later in the week or this weekend. Im sure this should solve my issue as i really dont use the system perl. So if i can just get cpan to work with perl22 then id be all good and this seems like it may fix that. Thank you for all your help @Craig. Il update within the next couple days or so. – Sarge888 Dec 10 '15 at 03:37
  • Well @Craig, i think i messed some stuff up. The new perl5 seems to have not been setup correctly as part of the system is using it and other parts are not. It had its own file in /usr/local/bin and Cpan bin was still directing to the system perl. So im going to try and start fresh by trying to remove all traces of the new perl5 and just have the system perl. Then il look into how to install a custom perl to my home directory to better keep up with whats going on. If you dont mind, could you tell me if i have removed the new perl correctly as i cannot seem to find an uninstall method. – Sarge888 Dec 11 '15 at 23:41
  • I removed the entire /usr/local/lib/perl5 directory(it had 5.22.0 and site__somthing folder in it), and i also removed the perl5.22.0 bin from /usr/local/bin. am i missing anything? can i start fresh now and try doing this the correct way as you stated above? – Sarge888 Dec 11 '15 at 23:43
  • /usr/local/man/{man1,man3} will have tons of files and there are others in bin, etc. Since mine are isolated, I was able to create a full/pure list with `find` and I put it here: http://pastebin.com/PXw7kxT0 Just edit the file and put "rm -f " at the front of each line and execute it as a bash script. These are relative path so be sure you're in /usr/local. To be safe you could create a tar backup beforehand of /usr/local. That should get you cleaned up. When building `./Configure -h` to get option help. Note Configure _very_ smart about default answers – Craig Estey Dec 12 '15 at 00:36
  • Thank you very much Craig. For all of your help. The info i have learned from you will hopefully prevent me from messing up my system again. Sadly i accidentally messed up a command as i was typing to fast. I found some default bin files for perl that i chown to root:root but for some reason i forgot to actually add the perl* and instead used *. So i no longer have access to the sudo command. Which is kinda good news as now i can start fresh with the new knowledge. luckily this server was setup only a week ago so i wont lose very much if anything. Im good tho, glad to start from scratch. :$ – Sarge888 Dec 12 '15 at 01:29
  • Fresh full install sounds best [for you now] because you can be sure of the baseline. For minor repairs, you can boot system single-user or boot Ubuntu livecd install and get a shell [sata drives will be mounted under /mnt/sysimage(?)]. msg me if you a snag with perl that you think I could be helpful with. P.S. I did `rm -fr /` once ... **Just once** :-) – Craig Estey Dec 12 '15 at 01:43
  • Ya i was happy to start fresh. and i even downloaded Virtualbox and installed a Ubuntu test server that i can mess with the perl crap before putting it on the live server. should have done that before but i wasnt thinking lol. Anyway servers basically all up again, system perl is stock and fresh as can be. Maybe i can try and get these perl modules i need to work with the system perl id be golden but of course they require an updated perl which sucks... – Sarge888 Dec 12 '15 at 03:05
  • If you want to give me some advice on how to get the following modules working with the system perl that would be great. If they can even work with the system perl. These are the modules i need - File::Copy::Recursive File::Glob LWP::Simple TVDB::API Getopt::Long Switch WWW::TheMovieDB JSON::Parse XML::Simple XML::Parser Im told they need S/SH/SHAY/perl-5.20.2.tar.gz maybe if i get an older version of the modules they will work with the system perl, that would be the easiest option. Besides that il have to make a custom perl as u mentioned above. (dam formatting/mini-Markdown isnt working) – Sarge888 Dec 12 '15 at 03:08
  • A distro may prepackage a given perl package/module. (e.g.) File::Copy::Recursive --> perl-File-Copy-Recursive-... on fedora. They do _some_ (fedora has 370), but CPAN has thousands. Don't mix and match. The core interpreter package can come stock from ubuntu distro. CPAN can provide _all_ cpan modules. It's like a separate distro for perl modules. Don't comingle (i.e. dependencies break)--it's like taking gcc from ubuntu and glibc from fedora--not the best result. Ubuntu, at best, will prebuild a few hundred cpan modules ... – Craig Estey Dec 12 '15 at 03:26
  • Let us [continue this discussion in chat](http://chat.stackexchange.com/rooms/32888/discussion-between-sarge888-and-craig-estey). – Sarge888 Dec 12 '15 at 03:28