in reply to help fixing module paths after upgrading perl in cygwin

I'm not sure how to fix this. How do I locate strict.pm?

I don't have a copy of Cygwin at the moment, but since you also wrote that you upgraded your Perl version, I suspect that it actually deinstalled Perl 5.30, while for some reason leaving /usr/bin/perl5.30.3 behind. That would explain a core module like strict.pm missing.

If I install a new version of perl, do I need to install new copies of every module that was installed for the prior version of perl I was using?

Yes. Some modules may survive being used in the new version of Perl, but any XS modules won't. That's why it's generally not recommended to reinstall all modules. Note you may want to look at e.g. cpanfiles to document your required modules, as they make it easy to install them all in one go using cpanm.

If I install a new version of perl but I want some scripts to use the prior version of perl

Why would you want to do this? I don't think there were any major incompatibilities between 5.30 and 5.32, so you should be fine using the latter.

... do I need to manually edit each of those scripts to point to the old version, as I have done in my second sample code block above?

Not necessarily, for example I use the shebang #!/usr/bin/env perl to use whatever perl is first in PATH, and for example tools like perlbrew make it easy to modify PATH to point to whatever version of Perl you want.

However, in this case it would appear to me that your best course of action would be to install WWW::Mechanize to your Perl 5.32.

Update: Fixed second paragraph (was originally "not recommended to reuse modules across versions" and I forgot to remove the "not" when changing it, sorry).

Replies are listed 'Best First'.
Re^2: help fixing module paths after upgrading perl in cygwin (updated)
by Special_K (Pilgrim) on Oct 21, 2022 at 16:07 UTC
    I don't have a copy of Cygwin at the moment, but since you also wrote that you upgraded your Perl version, I suspect that it actually deinstalled Perl 5.30, while for some reason leaving /usr/bin/perl5.30.3 behind. That would explain a core module like strict.pm missing.

    So in this context, "deinstalling perl" means removing all built-in modules but leaving the actual perl executable?

    Why would you want to do this? I don't think there were any major incompatibilities between 5.30 and 5.32, so you should be fine using the latter.

    If the alternative is to reinstall all modules that I had installed via CPAN for 5.30, then maybe it would be easier to just revert to 5.30 if I don't specifically need any of the changes that 5.32 offers over 5.30.
      So in this context, "deinstalling perl" means removing all built-in modules but leaving the actual perl executable?

      Well, from your description in the root node that's my best guess as to what happened, though I find it strange that modules like strict.pm were removed while the 5.30 binary was left behind, since it's esentially left behind a broken 5.30 installation.

      if I don't specifically need any of the changes that 5.32 offers over 5.30

      That is up to you to decide, but note that there have been quite a few nice new features added, and more importantly security fixes made, that make a good argument for always using the newest version of Perl that is available. Have a look at perl5320delta.

      If the alternative is to reinstall all modules that I had installed via CPAN for 5.30

      Since I regularly install fresh copies of Perl, either because I'm setting up a new machine or because I'm upgrading a Perl version somewhere, I don't think installing all of the CPAN modules I need is a big hassle, because as I said I use tools like cpanfile and cpanm to make that really easy. Tools like scandeps.pl can help in building such a list (see e.g. Re: Using Cartons to automate module installs).

      If instead you just wanted a one-time reinstall of everything, there are ways to list all the modules you have installed (perlfaq3, Finding what modules are installed, List of Installed Perl Module in Unix Box, and many more), and you may want to look into CPAN's autobundle command.