Closed mirokado closed 2 years ago
It seems that, in the same process of CPAN or CPAN::Reporter,
A minimal example is:
#!/usr/bin/env perl
use strict;
use warnings;
use lib "local/lib/perl5";
sub run { warn "--> @_\n"; !system @_ or die }
run 'rm -rf local';
run "curl -fsSL https://cpanmin.us | $^X - -Llocal -nq URI\@5.10";
require URI;
run "curl -fsSL https://cpanmin.us | $^X - -Llocal -nq URI\@5.11";
require URI::https; # load by LWP with https url
❯ perl test.pl
--> rm -rf local
--> curl -fsSL https://cpanmin.us | /Users/skaji/env/plenv/versions/5.36.0/bin/perl - -Llocal -nq URI@5.10
Successfully installed URI-5.10
1 distribution installed
--> curl -fsSL https://cpanmin.us | /Users/skaji/env/plenv/versions/5.36.0/bin/perl - -Llocal -nq URI@5.11
Successfully installed URI-5.11 (upgraded from 5.10)
1 distribution installed
Bareword "URI::HAS_RESERVED_SQUARE_BRACKETS" not allowed while "strict subs" in use at local/lib/perl5/URI/_generic.pm line 13.
Compilation failed in require at /Users/skaji/env/plenv/versions/5.36.0/lib/perl5/5.36.0/parent.pm line 16.
BEGIN failed--compilation aborted at local/lib/perl5/URI/_server.pm line 6.
Compilation failed in require at /Users/skaji/env/plenv/versions/5.36.0/lib/perl5/5.36.0/parent.pm line 16.
BEGIN failed--compilation aborted at local/lib/perl5/URI/http.pm line 8.
Compilation failed in require at /Users/skaji/env/plenv/versions/5.36.0/lib/perl5/5.36.0/parent.pm line 16.
BEGIN failed--compilation aborted at local/lib/perl5/URI/https.pm line 8.
Compilation failed in require at test.pl line 12.
This kind of issue only happens in CPAN clients, and should be addressed in CPAN clients side, I think.
OTOH, once URI module has been upgraded successfully, this issue never happens. So we may not have to take it too seriously.
And this is duplicate of #101
Thanks for the quick replies. This is clearly more subtle than I had realised! HAS_RESERVED_SQUARE_BRACKETS is a constant defined in URI.pm, _generic.pm has URI as a parent, both URI.pm and _generic.pm compile correctly on my system when I just run perl -c on them.
I have executed fforce install URI in cpan, which should ensure that URI is "upgraded successfully": I will post again after the next cpan update.
Hi @mirokado, now, you have have a clean installation, alas a buggy one (5.11).
Consider to manually patch URI.pm
around line 120/130 from
my $orig = $2;
to
my $orig = $2 || return;
until a patched version is available.
Alternatively, restore 5.10 or see 5.11 section ENVIRONMENT VARIABLES
for other measures
to restore the previous behavior if your software relies on scheme:///...
or scheme://#...
or scheme://?...
,
especially file:///...
or mailto:...
.
Sorry for the inconvenience.
Thank you @Perlbotics, I patched as you suggest (at line 105 here) and tried to install something new (Math::Matrix). This worked fine. My other machine has just found URI v5.12, and that also installed without problems, so I installed Math::Matrix there too, successfully. I think you could close this now.
Thanks @mirokado for opening this issue and thanks @skaji and @Perlbotics for the debugging!
URI fails to load, noticed while CPAN invokes CPAN::Reporter
I think there is a dollar sign missing before the identifier at perl/5.26.1/URI/_generic.pm line 13.
Perl version 5.26.1 URI is up to date (5.11).
CPAN::Reporter: Test result is 'pass', All tests successful. CPAN::Reporter: preparing a CPAN Testers report for WWW-Mechanize-2.10 CPAN::Reporter: sending test report with 'pass' via Metabase CPAN::Reporter: Test::Reporter: error from 'Test::Reporter::Transport::Metabase:' Bareword "URI::HAS_RESERVED_SQUARE_BRACKETS" not allowed while "strict subs" in use at /usr/lib/perl5/site_perl/5.26.1/URI/_generic.pm line 13. Compilation failed in require at /usr/lib/perl5/site_perl/5.26.1/parent.pm line 16. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.26.1/URI/_server.pm line 6. Compilation failed in require at /usr/lib/perl5/site_perl/5.26.1/parent.pm line 16. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.26.1/URI/http.pm line 8. Compilation failed in require at /usr/lib/perl5/site_perl/5.26.1/parent.pm line 16. BEGIN failed--compilation aborted at /usr/lib/perl5/site_perl/5.26.1/URI/https.pm line 8. Compilation failed in require at (eval 525) line 1.