IrishMonk has asked for the wisdom of the Perl Monks concerning the following question:

I've hit a wall just after starting to learn perl. Mainly when I try to install packages it seems to install fine but then I try to use the Linux bash shell commands and it gives me the message

bash: cpanm: command not found...

This is one of the ways I tried to install cpanminus

downloaded package from http://search.cpan.org/dist/App-cpanminus/ navigated to download folder typed: tar zxf App-cpanminus-1.7004.tar.gz cd App-cpanminus-1.7004/ perl Makefile.PL make make test make install

The following is the CUI Screen readout

[IrishMonk@localhost ~]$ cd Downloads/ [IrishMonk@localhost Downloads]$ cd App-cpanminus-1.7004/ [IrishMonk@localhost App-cpanminus-1.7004]$ perl Makefile.PL Generating a Unix-style Makefile Writing Makefile for App::cpanminus Writing MYMETA.yml and MYMETA.json [IrishMonk@localhost App-cpanminus-1.7004]$ make Skip blib/lib/App/cpanminus.pm (unchanged) Skip blib/lib/App/cpanminus/fatscript.pm (unchanged) cp bin/cpanm blib/script/cpanm /usr/bin/perl -MExtUtils::MY -e 'MY->fixin(shift)' -- blib/script/cpanm Manifying blib/man1/cpanm.1 Manifying blib/man3/App::cpanminus.3pm Manifying blib/man3/App::cpanminus::fatscript.3pm [IrishMonk@localhost App-cpanminus-1.7004]$ make test PERL_DL_NONLAZY=1 /usr/bin/perl "-MExtUtils::Command::MM" "-MTest::Harness" "-e" "undef *Test::Harness::Switches; test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/happy_cpantesters.t .. 1/1 # App::cpanminus/1.7004 t/happy_cpantesters.t .. ok All tests successful. Files=1, Tests=1, 0 wallclock secs ( 0.03 usr 0.01 sys + 0.03 cusr 0.00 csys = 0.07 CPU) Result: PASS [IrishMonk@localhost App-cpanminus-1.7004]$ make install Appending installation info to /home/IrishMonk/perl5 /lib/perl5/i386-linux-thread-multi/perllocal.pod [IrishMonk@localhost App-cpanminus-1.7004]$ cpanm bash: cpanm: command not found... Similar command is: 'cpan' [IrishMonk@localhost App-cpanminus-1.7004]$

Replies are listed 'Best First'.
Re: cpanminus installing but not working
by taint (Chaplain) on May 27, 2014 at 00:30 UTC
    Greetings, IrishMonk!

    A couple of things come to mind. Is your local copy of Perl listed in your $PATH Environment? In other words, if you type $PATH, or %PATH in your current bash session. Does it list your local copy of Perl? Or is the Systems copy of Perl listed?

    Also of possible assistance; http://www.cpan.org/modules/INSTALL.html

    All in all, become familiar with both PATH, and env, for your shell, and OS (if you're not already. :)

    I'm on a *BSD OS. So my experience will be different in those regards. As those environment variables are different, than on Linux.

    All the best

    --Chris

    UPDATE: Overlooked the obvious;
    What's the output of
    perl -V

    ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

      Sorry if I seem a bit air headed. I'm still learning.

      There's a lot of back story to this but putting it simply, I'm running Linux Fedora 20 on a bootable USB stick but I've ecountered the same problems(and more problems) on Vista and Win7 with Strawberry.

      system Perl was not with the bootable OS so I installed it with sudo yum install perl.

      As per your suggestion I looked into the $PATH enviroment variable. After installing Perl the perl and perldoc commands worked without /usr/bin/perl being a part of the enviroment variable. I assume those codes worked because even though Shebang line of my programs would validly be #!/usr/bin/perl the perl part of the code isnt a directory so since the $PATH enviroment variable included /usr/bin the bash commands worked.

      I've started rambling on. I'm going to study up more on PATH and enviroment to see if I can fix this. Thanks for the tip. I added /usr/bin/perl to the PATH variable but of course that did nothing. My current $PATH is as follows.

      [root@localhost ~]# echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/IrishMonk +/.local/bin:/home/IrishMonk/bin:/usr/bin/perl

      If I type perl -v the output looks like this

      [root@localhost ~]# perl -v This is perl 5, version 18, subversion 2 (v5.18.2) built for i386-linu +x-thread-multi (with 18 registered patches, see perl -V for more detail) Copyright 1987-2013, Larry Wall Perl may be copied only under the terms of either the Artistic License + or the GNU General Public License, which may be found in the Perl 5 source ki +t. Complete documentation for Perl, including FAQ lists, should be found +on this system using "man perl" or "perldoc perl". If you have access to + the Internet, point your browser at http://www.perl.org/, the Perl Home Pa +ge.
        No worries, IrishMonk -- love the name you chose, BTW. :)

        We've all been there, at one time (new to OS, or Perl). INMHO, you made the right choice picking a *NIX OS, over Win$.

        Well, as to the command

        perl -V
        I should have noted that it was CaSe SeNsiTiVe. Meaning -V isn't the same as -v as it appears you used. No matter. You've given enough clues to help get things on the right track.

        Normally, for a situation/environment like the one you're using. Perl users often pick PerlBrew. However, it isn't the only choice, and many times, isn't the best. Besides, at this point, it would probably only serve to overwhelm you.

        What you're going to need to do first off. Is to somehow prepend your $PATH with your $HOME directory. Often your shell -- bash, in your case, rc file.

        For example. On the box I'm writing this to you from; I'm running csh, on FreeBSD. So, for me, all of my Shell Environment settings are located in ~/.cshrc. The tilde slash (~/) is a shell shortcut for your $HOME folder/directory.
        The $PATH statement, as listed/controlled by my shell is set thusly, in my .cshrc

        set path = (/sbin /bin /usr/sbin /usr/bin /usr/games /usr/local/sbin / +usr/local/bin $HOME/bin)
        According to the man pages for bash (link above). You'll need to edit ~/.bashrc, adjusting your $PATH accordingly. Perhaps pre-pending $HOME to the list of directories, rather than Appending, as in the path statement I listed, from my own.

        There are other "tricks" that can be employed, where Perl is concerned. But in all honesty. What you appear to be trying to do, is going to be a great deal more work, than I think you want to attempt.

        If it were just $HOME, it wouldn't be too bad. As many users face this situation, and as a result, thare many possible solutions available. But your use of a "thumb drive"/"USB stick" I think possibly complicates matters, more than usual -- more information needed.

        Top of the evenin' to you.

        --Chris

        ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

        The following looks very ODD to me:
        [root@localhost ~]# echo $PATH /usr/local/bin:/usr/bin:/bin:/usr/local/sbin:/usr/sbin:/home/IrishMonk +/.local/bin:/home/IrishMonk/bin:/usr/bin/perl
        The part that strikes me as odd is:
        /home/IrishMonk/.local/bin
        I have no idea what .local/bin translates to. "dot files" have special meaning on *NIX OS's, and it'd be rare to intentionally use "dot folders". Any chance you have your USB stick mounted as .local?

        --Chris

        ¡λɐp ʇɑəɹ⅁ ɐ əʌɐɥ puɐ ʻꜱdləɥ ꜱᴉɥʇ ədoH

        Just out of curiosity, what do you get when you do a 'locate cpanm' ? (sort of assuming Fedora has locate, but it has been 10 years since I touched anything RH-like).

        ...the majority is always wrong, and always the last to know about it...

        Insanity: Doing the same thing over and over again and expecting different results...

        A solution is nothing more than a clearly stated problem...otherwise, the problem is not a problem, it is a facct