Branch: refs/heads/yves/make_universal_import_deal_with_version_assertions
  Home:   https://github.com/Perl/perl5
  Commit: d381fe86831a456d0793a5aa4c0d5ee06d53a134
      
https://github.com/Perl/perl5/commit/d381fe86831a456d0793a5aa4c0d5ee06d53a134
  Author: Yves Orton <demer...@gmail.com>
  Date:   2023-07-21 (Fri, 21 Jul 2023)

  Changed paths:
    M universal.c

  Log Message:
  -----------
  universal.c - handle version style imports as a version check

if someone does

    use Thing 1.234;

it is interpreted as

    BEGIN {
        require Thing;
        Thing->import();
        Thing->VERSION(1.234);
    }

however in the case of

    use Thing "1.234";

we treat it as

    BEGIN {
        require Thing;
        Thing->import("1.234");
    }

however if people use Exporter::import() as their
importer then its import will turn such cases silently into

    Thing->VERSION("1.234")

anyway.

With the new logic to detect if someone has called into
UNIVERSAL::import() with an argument we were not discriminating between
the two cases.

This patch basically does the same thing that Exporter would.

This patch also special cases the class Test::SubExport::SETUPALT
so that Sub::Exporter does not break, as it is very high in the CPAN
river, and when it is broken we have problems with test reporting.


Reply via email to