3

Being new to perl and its versions, I thought it worked like R but OBVIOUSLY not. I had folder /usr/share/perl/5.26.1 folder and /usr/share/perl/5.26 folder both with same files so I deleted /usr/share/perl/5.26 folder. Everything was okay. When I enter perl -v I get This is perl 5, version 26, subversion 1 (v5.26.1). But for some reason when try to install DBD::SQLite the Makefile.PL in the package "DBD-SQLite-1.66" folder defaults PERL_LIB = /usr/share/perl/5.26. How do I make it default to PERL_LIB = /usr/share/perl/5.26.1 or how can I get the /usr/share/perl/5.26 folder back cause obviously you need both which seems like a complete waste of space.

  • 5
    Perl, R, or whichever language; it doesn't matter. Don't mess with system files under /usr (maybe with the exception of /usr/local). Don't add any, don't remove any, don't change any. Those files are under control of the system's package management (apt/dpkg), and if you mess with them, the system's assumptions about those file start falling apart. If you don't need a specific application anymore, remove it using the package management. Your reference to Makefiles also suggest you're trying to install custom stuff into /usr. Don't, that way lies madness. – marcelm Sep 04 '20 at 16:53
  • Yes, I have learned this from this experience and reading about a million other posts that say not to mess with system perl or any system root folders. It burns like a hot stove. – Brian Wiley Sep 04 '20 at 21:27

2 Answers2

7

You have to simply use the power of APT to restore folder contents:

sudo apt-get install --reinstall \
$(dpkg -S /usr/share/perl/5.26 | sed "s/,//g" | sed "s|: /usr/share/perl/5.26||")

or more wider by

sudo apt-get install --reinstall \
$(dpkg -S /usr/share/perl/ | sed "s/,//g" | sed "s|: /usr/share/perl/||")
N0rbert
  • 99,918
  • this was very helpful and I did this first before trying the answer above. they both probably would have worked. the other answer might be helpful but will accept this as you cannot except both. – Brian Wiley Sep 04 '20 at 06:24
6

Many programs/libraries use symlinks to abstract away the exact version numbers and present a more stable location. For instance, rarely do programs care that your Perl patch number is 5.26.1 but may be dependent on the minor version number 5.26. In this case, the "real" directory is /usr/share/perl/5.26.1 and there was a symlink at /usr/share/perl/5.26 that pointed to /usr/share/perl/5.26.1 until you deleted it. Symlinks basically cost 0 disk space so having both of these directories doesn't waste anything.

To fix you situation, simply do sudo ln -s /usr/share/perl/5.26.1 /usr/share/perl/5.26 which will create a symlink at /usr/share/perl/5.26 that points to /usr/share/perl/5.26.1.

Brian Turek
  • 1,826