develooper Front page | perl.perl5.porters | Postings from August 2016

base.pm and optional modules

Thread Next
From:
Michael Schroeder
Date:
August 6, 2016 10:47
Subject:
base.pm and optional modules
Message ID:
20160806104730.GA11384@suse.de

Hi Porters,

I've got a question about the change in base.pm. I understand that
the strategy for fixing the '.' in @INC problem is to remove '.'
for all optional module loads. Also, base.pm is somewhat special
because it can be used both for mandatory and optional loads.

What I don't get is why you can't use %{"$base\::"} to check if
it is used for an optional load or not. I.e. make the code something
like:

    my $dotty = $INC[-1] eq '.' && %{"$base\::"};
    local @INC = @INC;
    pop @INC if $dotty;

If %{"$base\::"} is empty, the code will croak if the requires
fails, so it is a mandatory load and it's ok to look in '.'.
Wouldn't that be more compatible to the old behavior and still
be safe enough?

(I'm also not very happy about perl not croaking if there is
something in %{"$base\::"} and the module exists in '.' and
doesn't get loaded because of '.' being popped. That may cause
some hard to find errors at a distance...)

Cheers,
  Michael.

-- 
Michael Schroeder                                   mls@suse.de
SUSE LINUX GmbH,           GF Jeff Hawn, HRB 16746 AG Nuernberg
main(_){while(_=~getchar())putchar(~_-1/(~(_|32)/13*2-11)*13);}

Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About