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

Thread Next
Michael Schroeder
August 6, 2016 10:47
Subject: and optional modules
Message ID:

Hi Porters,

I've got a question about the change in I understand that
the strategy for fixing the '.' in @INC problem is to remove '.'
for all optional module loads. Also, 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

    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...)


Michael Schroeder                         
SUSE LINUX GmbH,           GF Jeff Hawn, HRB 16746 AG Nuernberg

Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About