G'day Special_K,

I use Cygwin. I'm using the latest version, 3.3.6. I do a full update of "pending" components every week; my last update was about an hour ago. So, everything related to Cygwin below is up-to-date.

I also run Perlbrew. I recommend you do the same. I completely ignore whatever Perl components Cygwin has installed. I can easily switch between whatever Perl versions I want to use:

$ which perl /home/ken/perl5/perlbrew/perls/perl-5.36.0/bin/perl $ perlbrew list * perl-5.36.0 perl-5.34.0 perl-5.33.5 perl-5.32.0 perl-5.30.0 $ perlbrew switch perl-5.30.0 $ which perl /home/ken/perl5/perlbrew/perls/perl-5.30.0/bin/perl $ perlbrew switch perl-5.36.0 $ which perl /home/ken/perl5/perlbrew/perls/perl-5.36.0/bin/perl

If you're up-to-date, I'm surprised you've even got /usr/bin/perl5.30.3. Here's what I got from Cygwin:

$ ls -al /usr/bin/perl -rwxr-xr-x 2 ken None 12800 Aug 14 2021 /usr/bin/perl $ ls -al /usr/bin/perl* -rwxr-xr-x 2 ken None 12800 Aug 14 2021 /usr/bin/perl.exe -rwxr-xr-x 2 ken None 12800 Aug 14 2021 /usr/bin/perl5.32.1.exe -rwxr-xr-x 2 ken None 45259 Aug 14 2021 /usr/bin/perlbug -rwxr-xr-x 1 ken None 262 Aug 14 2021 /usr/bin/perldoc -rwxr-xr-x 1 ken None 57920 Feb 7 2021 /usr/bin/perli11ndoc -rwxr-xr-x 1 ken None 10813 Aug 14 2021 /usr/bin/perlivp -rwxr-xr-x 1 ken None 12047 Oct 4 17:26 /usr/bin/perlsh lrwxrwxrwx 1 ken None 48 Aug 13 10:59 /usr/bin/perltex -> /usr/shar +e/texmf-dist/scripts/perltex/perltex.pl -rwxr-xr-x 2 ken None 45259 Aug 14 2021 /usr/bin/perlthanks $ /usr/bin/perl -v This is perl 5, version 32, subversion 1 (v5.32.1) built for x86_64-cy +gwin-threads-multi (with 7 registered patches, see perl -V for more detail) ...

I attempted to replicate what you're showing us, but couldn't. However, although you've shown the code and the output, you don't say how you ran it: ./script.pl; perl script.pl; /usr/bin/perl script.pl; /usr/bin/perl5.30.3 script.pl; etc.

Try running variations of the following to see what's in @INC and where your modules are located (from %INC info):

$ /usr/bin/perl5.32.1 -E 'use strict; use warnings; say for @INC; use +Data::Dumper; print Dumper \%INC;' /usr/local/lib/perl5/site_perl/5.32/x86_64-cygwin-threads /usr/local/share/perl5/site_perl/5.32 /usr/lib/perl5/vendor_perl/5.32/x86_64-cygwin-threads /usr/share/perl5/vendor_perl/5.32 /usr/lib/perl5/5.32/x86_64-cygwin-threads /usr/share/perl5/5.32 $VAR1 = { 'feature.pm' => '/usr/share/perl5/5.32/feature.pm', 'XSLoader.pm' => '/usr/share/perl5/5.32/XSLoader.pm', 'bytes.pm' => '/usr/share/perl5/5.32/bytes.pm', 'Exporter.pm' => '/usr/share/perl5/5.32/Exporter.pm', 'constant.pm' => '/usr/share/perl5/5.32/constant.pm', 'Data/Dumper.pm' => '/usr/lib/perl5/5.32/x86_64-cygwin-threa +ds/Data/Dumper.pm', 'warnings.pm' => '/usr/share/perl5/5.32/warnings.pm', 'overloading.pm' => '/usr/share/perl5/5.32/overloading.pm', 'Carp.pm' => '/usr/share/perl5/5.32/Carp.pm', 'strict.pm' => '/usr/share/perl5/5.32/strict.pm', 'warnings/register.pm' => '/usr/share/perl5/5.32/warnings/re +gister.pm' };
"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? "

In general, you'll need to install all non-core modules (i.e. modules from CPAN, that you wrote yourself, that came from your $work, and so on). However, as you seem to have both a v5.30 and a v5.32, I'm not sure what you've done and what you need to do.

I keep a list of all of my non-core modules and install them (using the cpan utility) every time I install a new Perl version via Perlbrew. I'm reasonably certain that there are short-cuts for doing this, but I like to keep a close eye on all module installations (and any problems they might have). Other monks may provide you with different ways to do this.

"If I install a new version of perl but I want some scripts to use the prior version of perl, 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?"

I use this shebang for all of my scripts:

#!/usr/bin/env perl

I just switch to whatever Perl version I want (using Perlbrew) and run the script as is. Sometimes I want to test a script against several versions of Perl: this is an easy way to achieve that.

Without Perlbrew, you can just use something like this:

$ /usr/bin/perl5.30.3 script.pl $ /usr/bin/perl5.32.1 script.pl

Continually making changes to the shebang is a pain and error-prone. I wouldn't recommend it.

Also note the distinct absence of -w in any of my code in this response. I strongly recommend you use the warnings pragma instead. See "perlrun: -w" for more about that (note the "... normally, the lexically scoped use warnings pragma is preferred.").

— Ken


In reply to Re: help fixing module paths after upgrading perl in cygwin by kcott
in thread help fixing module paths after upgrading perl in cygwin by Special_K

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.