Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: @INC error

by talexb (Canon)
on Jan 17, 2020 at 19:53 UTC ( #11111547=note: print w/replies, xml ) Need Help??


in reply to @INC error

Works for me ..

$ perl -e 'print join("\n",@INC)' | xargs -I % find % -name Mailer.pm find: /usr/local/lib/x86_64-linux-gnu/perl/5.24.1: No such file or d +irectory find: /usr/local/share/perl/5.24.1: No such file or directory /usr/share/perl5/Mail/Mailer.pm
As has already been pointed out, all you've found is a Mail directory. That directory may or may not have a Mailer.pm in it.

Alex / talexb / Toronto

Thanks PJ. We owe you so much. Groklaw -- RIP -- 2003 to 2013.

Replies are listed 'Best First'.
Re^2: @INC error
by worstead (Acolyte) on Jan 18, 2020 at 19:57 UTC

    Thank you all for your help. Clearly my Perl installation is a mess. The agility of my memory has deteriorated since I began programming in assembly language in in the 1950s. I have also become lazy. I use Fedora (currently 31) and have relied on upgrading instead of new installations. As a result the various additions and even separate installations of Perl that I have made over the years still exist on my hard drive, I probably went to cpan as a user as well as root. In addition, I have various additions to @INC in .bashrc and /etc/profile whose purpose I have forgotten. Over ten years ago I was installing Perl from a tarball because Fedora did not include PerlMagick.

    My question now is how can I remove all versions of Perl and start with a completely new version including the necessary additions to @INC? Using "dnf remove" or "rpm -e" will only remove my latest version (i.e. perl-5.30.1-449.fc31.x86_64). As a last resort I could completely reinstall Fedora but that would take a long time considering the number of additional programs I have installed and the tweaks I have made.

      My question now is how can I remove all versions of Perl and start with a completely new version including the necessary additions to @INC?

      Well, you don't necessarily need to remove the old versions to build a fresh, self-contained Perl. In any case, you first need to hunt down and eliminate all environment variables related to Perl. In particular, look in your ~/.profile and ~/.bashrc, but environment variables could also be set elsewhere (like some files under /etc, depending on the system). Look for anything Perl-related, including for example source ~/perl5/perlbrew/etc/bashrc. Those would be in particular PERL5LIB, any PATH entries pointing to any specific Perl builds, PERL_MB_OPT, PERL_MM_OPT, PERL5OPT, and really any other environment variables with PERL in the name (see perlrun). If you're unsure about any of these, feel free to ask here.

      Then, it depends on whether it's enough to install Perl in your home directory, or whether you want to install it in some system-wide location. For the former, I'd suggest perlbrew. You can clobber ~/perl5/perlbrew/ first if you want to make sure you're getting a fresh start. Of course, if the file permissions on ~/perl5/perlbrew/ allow it, then you can use this Perl on the entire system.

      If you wanted to build Perl from source into some global location, like say /opt, then have a look at the INSTALL file. In short, it can be as simple as doing the following in the Perl source directory: sh Configure -de -Dprefix='/opt/perl5.30' && make && make test && sudo make install.

      Both of the methods above will set up self-contained Perl builds, that is, their @INC directories will only be located below ~/perl5/perlbrew/perls/perl-*/ or /opt/perl5.30, respectively, instead of being spread out all over the system. You can freely install modules there, and you no longer need to worry about @INC, PERL5LIB, local::lib, and so on. You only need to worry about your PATH pointing to the installation of Perl you want to use, or pointing your shebang line at the correct Perl.

      For installing modules, I strongly recommend cpanm, which you can install via curl -L https://cpanmin.us | perl - App::cpanminus (see App::cpanminus). When you're installing modules, you can check which perl and which cpanm to make sure they are from the same installation, otherwise you've got something strange going on with your PATH.

      If the installation gets mucked up somehow, you can simply perlbrew uninstall or rm -rf /opt/perl5.30 to clobber them. Keeping a cpanfile with your dependencies is an advantage, since it allows easy re-installation of your modules with "cpanm --installdeps .".

      Then, in your crontab file, make sure to call the correct Perl, I recommend doing this with the absolute pathname. So for example, 0 0 * * *  /opt/perl5.30/bin/perl /home/user/script.pl arg1 arg2 ....

        sh Configure -de -Dprefix='/opt/perl5.30' && make && make test && sudo make install

        Just to point out (to worstead) that one can do the same thing to install perl into one's home directory, without any need for perlbrew to be involved:
        sh Configure -de -Dprefix=/home/me/perl530 && make && make test && mak +e install
        Not that I'm suggesting that you should avoid perlbrew. It's widely used and generally recommended - from which I deduce that it's reliable and user-friendly.
        (I've never even looked at it, so I don't know.)

        Cheers,
        Rob
        Removed most of my old versions of perl but cannot download perlbrew. There appears to be no simple download site. Have tried the following:
        wget -O - https://install.perlbrew.pl | bash
        and
        curl -L https://install.perlbrew.pl | bash
        In each case get
        Need /usr/bin/perl or /usr/local/bin/perl to use bash
        which I do not now have.
        Appreciate all the directions. Shall attempt in next few days and post result.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://11111547]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (4)
As of 2020-04-03 11:55 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The most amusing oxymoron is:
















    Results (27 votes). Check out past polls.

    Notices?