libwww-perl / URI

The Perl URI module
https://metacpan.org/pod/URI
Other
57 stars 48 forks source link

5.11 breaks CPAN::Reporter #101

Closed twogee closed 2 years ago

twogee commented 2 years ago

Bareword "URI::HAS_RESERVED_SQUARE_BRACKETS" not allowed while "strict subs" in use at URI/_generic.pm line 13.

oalders commented 2 years ago

Ping @Perlbotics

haarg commented 2 years ago

When is this error appearing?

Perlbotics commented 2 years ago

Hi, I could reproduce this error in a mixed environment where the system perl interferes with this module during testing. I.e. prove fails while prove -I lib does not. Same problem as with uri-test script.

[Update] Even uri-test tells us with 5.11: URI (bug99): ./uri-test https://example.com Using: /usr/lib/perl5/vendor_perl/5.26.1/URI.pm Previous discussion: https://github.com/libwww-perl/URI/pull/100#pullrequestreview-1003665497 - last comment (uri-test).

[Update] Perhaps prove should add ./lib by default to compensate the change in Perl 5.26 where . was removed from @INC or at least issue a warning? IMO, it is counter intuitive to use prove interactively and test outside the current source directory.

[Update] Section 'Module Authors' in https://metacpan.org/release/XSAWYERX/perl-5.26.0/view/pod/perldelta.pod#Removal-of-the-current-directory-(%22.%22)-from-@INC

haarg commented 2 years ago

prove -l is the correct command to use to test the against the version in lib. This was no different before . was removed from @INC. Having . in @INC would not help find the modules in lib.

The reported issue seems to be regarding an actual installed version of the module. The error would seem to indicate that the install was incomplete or broken in some way. It's worth checking the $VERSION in the installed URI.pm and URI/_generic.pm files.

Perlbotics commented 2 years ago

Graham (@haarg) , you are absolutely right. First, I've got onto the wrong track, then I gave full throttle m(

Seems, that @twogee's setup loaded another version of URI.pm first since the current version would have defined the constant. @twogee should deliver more context to decide if this one is really a bug that needs to be fixed.

What do you think of a test/assertion ( in .t/00.assert.t) that bails out if it detects that the tests are not going to be run against the new URI.pm module that is going to be installed ($URI::VERSION- or inode-comparison)?

is( $URI::VERSION, "5.11") or BAIL_OUT("Test is run against the wrong URI.pm ($INC{'URI.pm'})! Please check your environment.");

oalders commented 2 years ago

Closing as this does not appear to be a bug. @twogee if you can demonstrate otherwise, please add to this ticket.