Broken Perl programs: "Can't locate [file] in @INC"

I upgraded Perl, and some programs won't execute.

Code:
Can't locate Curses.pm in @INC (you may need to install the Curses module) (@INC entries checked: /usr/local/lib/perl5/site_perl/mach/5.40 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.40/mach /usr/local/lib/perl5/5.40) at /usr/local/lib/perl5/site_perl/Term/Animation.pm line 7.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/Term/Animation.pm line 7.
Compilation failed in require at /usr/local/bin/asciiquarium line 42.
BEGIN failed--compilation aborted at /usr/local/bin/asciiquarium line 42.

Code:
Can't locate Curses.pm in @INC (you may need to install the Curses module) (@INC entries checked: /usr/local/lib/perl5/site_perl/mach/5.40 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.40/mach /usr/local/lib/perl5/5.40) at /usr/local/bin/textmaze line 41.
BEGIN failed--compilation aborted at /usr/local/bin/textmaze line 41.

Code:
Can't locate Term/ReadKey.pm in @INC (you may need to install the Term::ReadKey module) (@INC entries checked: /usr/local/lib/perl5/site_perl/mach/5.40 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.40/mach /usr/local/lib/perl5/5.40) at /usr/local/bin/cadubi line 20.
BEGIN failed--compilation aborted at /usr/local/bin/cadubi line 20.

Code:
Can't locate Compress/Bzip2.pm in @INC (you may need to install the Compress::Bzip2 module) (@INC entries checked: /usr/local/lib/perl5/site_perl/mach/5.40 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.40/mach /usr/local/lib/perl5/5.40) at /usr/local/bin/frozen-bubble line 57.
BEGIN failed--compilation aborted at /usr/local/bin/frozen-bubble line 57.

Code:
Can't locate Gtk2.pm in @INC (you may need to install the Gtk2 module) (@INC entries checked: /usr/local/lib/perl5/site_perl/mach/5.40 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.40/mach /usr/local/lib/perl5/5.40) at /usr/local/bin/gprename line 49.
BEGIN failed--compilation aborted at /usr/local/bin/gprename line 49.

Code:
Can't locate Ogg/Vorbis/Header.pm in @INC (you may need to install the Ogg::Vorbis::Header module) (@INC entries checked: /usr/local/lib/perl5/site_perl/mach/5.40 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.40/mach /usr/local/lib/perl5/5.40) at /usr/local/bin/mp3burn line 63.
BEGIN failed--compilation aborted at /usr/local/bin/mp3burn line 63.

Code:
Can't locate YAML/Syck.pm in @INC (you may need to install the YAML::Syck module) (@INC entries checked: /usr/local/lib/perl5/site_perl/mach/5.40 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.40/mach /usr/local/lib/perl5/5.40) at /usr/local/lib/perl5/site_perl/HTML/TextToHTML.pm line 638.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/HTML/TextToHTML.pm line 638.
Compilation failed in require at /usr/local/bin/txt2html line 811.
BEGIN failed--compilation aborted at /usr/local/bin/txt2html line 811.

Code:
Can't locate Glib.pm in @INC (you may need to install the Glib module) (@INC entries checked: /usr/local/lib/perl5/site_perl/mach/5.40 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.40/mach /usr/local/lib/perl5/5.40) at /usr/local/lib/perl5/site_perl/Intclock/UI_gtk2.pm line 34.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/Intclock/UI_gtk2.pm line 34.
Compilation failed in require at /usr/local/bin/intclock line 227 (#1)
    (F) You said to do (or require, or use) a file that couldn't be found.
    Perl looks for the file in all the locations mentioned in @INC, unless
    the file name included the full path to the file.  Perhaps you need
    to set the PERL5LIB or PERL5OPT environment variable to say where the
    extra library is, or maybe the script needs to add the library name
    to @INC.  Or maybe you just misspelled the name of the file.  See
    "require" in perlfunc and lib.
    
Uncaught exception from user code:
    Can't locate Glib.pm in @INC (you may need to install the Glib module) (@INC entries checked: /usr/local/lib/perl5/site_perl/mach/5.40 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.40/mach /usr/local/lib/perl5/5.40) at /usr/local/lib/perl5/site_perl/Intclock/UI_gtk2.pm line 34.
    BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/Intclock/UI_gtk2.pm line 34.
    Compilation failed in require at /usr/local/bin/intclock line 227.

Anyway, they're all seeking in */5.40/ what's actually in */5.42/. How can I rectify this without breaking other dependent programs (mc elinks cowsay weechat) that function properly?
 
Reinstall all affected applications, from pkg or ports, they are obviously built at a time when perl5.40 was default.
I suspected that this wouldn't work because pkg already did, but I deleted and reinstalled asciiquarium and frozen-bubble, and they're still broken because they haven't been upgraded, likely because they haven't maintainers.

Interestingly, I downloaded the (rather old) asciiquarium script from Baucom's site, and:
Code:
./asciiquarium
Can't locate Curses.pm in @INC (you may need to install the Curses module) (@INC entries checked: /usr/local/lib/perl5/site_perl/mach/5.40 /usr/local/lib/perl5/site_perl /usr/local/lib/perl5/5.40/mach /usr/local/lib/perl5/5.40) at /usr/local/lib/perl5/site_perl/Term/Animation.pm line 7.
BEGIN failed--compilation aborted at /usr/local/lib/perl5/site_perl/Term/Animation.pm line 7.
Compilation failed in require at ./asciiquarium line 42.
BEGIN failed--compilation aborted at ./asciiquarium line 42.
I wouldn't know what to edit in the script to locate the module in the right directory....!
 
This (IS NOT) the greatest fix to this problem :-)....

But here is my "free beer" advice on how I typically fix issues like this -- particularly with perl(1). I tend to give software "what it wants" and make it happy for "now". Later you will have more time to (maybe?) fix it right later?

Assuming /usr/local/lib/perl5/site_perl/mach/5.40 (DOES NOT exist)...

Try:

Code:
shell$ sudo -s
Password:
shell$ cd /usr/local/lib/perl5/site_perl/mach
shell$ ln -s 5.42 5.40
shell$ ls -al 5.40
lrwxr-xr-x    1 root wheel          3 Nov 16 02:43 5.40 -> 5.42
shell$ exit

Now: /usr/local/lib/perl5/site_perl/mach/5.40 (WILL ACTUALLY EXIST) and will function normally. Try your perl(1) scripts again.

WHAT THIS DOES:

The odds of (ANY) perl code from 5.42 being noticeably from 5.40 are almost ZERO (aka no difference). Some FreeBSD or perl developer probably made a REALLY minor edit to perl(1) recently. So you are just pretending that the (new) perl libraries are the (old) perl libraries.

BTW: My (14.3-RELEASE-p5): /usr/local/lib/perl5/site_perl/mach looks like:

Code:
shell$ ls -al  /usr/local/lib/perl5/site_perl/mach $ ls -al
total 34
drwxr-xr-x   4 root wheel   4 Oct 11 07:13 .
drwxr-xr-x  59 root wheel  72 Oct 26 01:13 ..
drwxr-xr-x   3 root wheel   3 Oct 11 07:13 5.40
drwxr-xr-x  21 root wheel 326 Oct 26 01:13 5.42
shell$

If this change (DOES NOT) work for you -- you can undo it with:

Code:
shell$ sudo -s
Password:
shell$ cd /usr/local/lib/perl5/site_perl/mach
shell$ rm 5.40
shell$ exit

Larry Wall stopped writing perl(1) a long time ago :cool:? Might be time to upgrade your perl stuff to something 2025-ish? Does CPAN even work anymore!?

Good luck !
 
Back
Top