In perl.git, the branch davem/require_fixups has been created

<http://perl5.git.perl.org/perl.git/commitdiff/651cd10d6d8be4687d33f428d00da788bffc613c?hp=0000000000000000000000000000000000000000>

        at  651cd10d6d8be4687d33f428d00da788bffc613c (commit)

- Log -----------------------------------------------------------------
commit 651cd10d6d8be4687d33f428d00da788bffc613c
Author: David Mitchell <[email protected]>
Date:   Thu Apr 13 12:52:30 2017 +0100

    require "you may need to install" only on bareword
    
    RT #131098
    
    The helpful hint which require sometimes includes in its error message
    these days (split across multiple lines for clarity):
    
        $ perl -e'require Foo::Bar'
        Can't locate Foo/Bar.pm in @INC
            (you may need to install the Foo::Bar module)
            (@INC contains: ... ) at ...
    
    is a bit over-enthusiastic when the pathname hasn't actually been derived
    from a module name:
    
        $ perl -e'require "Foo.+/%#Bar.pm"'
        Can't locate Foo.+%#Bar.pm in @INC
            (you may need to install the Foo.+::%#Bar module)
            (@INC contains: ... ) at ...
    
    Perl currently emits the "(you may need to install)" bit if the pathname
    ends in .pm, displaying in the hint, the pathname sans .pm and with /
    converted to ::.
    
    However, note that at compile-time,
    
        require Foo::Bar
    
    is converted to
    
        require "Foo/Bar.pm"
    
    except that the OP_CONST op holding the string is flagged OPpCONST_BARE.
    So its possible to distinguish at runtime between the pathname
    "Foo/Bar.pm" derives in two different ways in the source:
    
        require Foo::Bar
        require "Foo/Bar.pm"
    
    This commit makes perl use the OPpCONST_BARE flag, rather than the
    presence of /\.pm$/ in the filename, to choose whether to emit the helpful
    hint.
    
    In summary; previously:
    
        require Foo::Bar       # (you may need to install the Foo::Bar module)
        require "Foo/Bar.pm"   # (you may need to install the Foo::Bar module)
        require "./foo.pm"     # (you may need to install the .::foo module)
    
    now:
    
        require Foo::Bar       # (you may need to install the Foo::Bar module)
        require "Foo/Bar.pm"   # no hint
        require "./foo.pm"     # no hint

M       cpan/parent/t/parent.t
M       pp_ctl.c
M       t/op/require_errors.t

commit d6b5daf95f869083c83686c7e4b9915f7d84f96e
Author: David Mitchell <[email protected]>
Date:   Thu Apr 13 12:23:59 2017 +0100

    require die msg: only mention @INC if used
    
    RT #131098
    
    5.8.0 introduced a change which as an inadvertent side-effect caused
    this @INC-related require croak message:
    
        Can't locate foo in @INC (@INC contains: ...) at ...
    
    to be emitted even when foo is a non-searchable pathname (like /foo or
    ./foo) and @INC isn't used.
    
    This commit reverts the error message in these cases to be the simple
    
        Can't locate foo at ...

M       pp_ctl.c
M       t/op/require_errors.t

commit 16a3c488bc53527fed25d2654e0c282b6dc93866
Author: David Mitchell <[email protected]>
Date:   Thu Apr 13 11:53:35 2017 +0100

    S_require_file() : simplify an else if block
    
    change
    
        if (...) {
            ...
        }
        else {
          if (...) {
            ...
          }
        }
    to
    
        if (...) {
            ...
        }
        else if (...) {
            ...
        }
    
    Should make no functional difference

M       pp_ctl.c

commit 09c0f955bc6e37f5445b5069808c0e33d2e49e92
Author: David Mitchell <[email protected]>
Date:   Thu Apr 13 11:50:39 2017 +0100

    better comment require() source.
    
    Add code more comments to S_require_file() and its helpder functions to
    better understand what's going on.

M       pp_ctl.c
-----------------------------------------------------------------------

--
Perl5 Master Repository

Reply via email to