autarch/class-load — pull request #5 by kentfredric (2012-12-18 23:10:31+00:00)
Title:  Remove delete $INC{$pmfile} logic, as its purpose is redundant.

Because if the heuristics fail,
delete $INC{$pmfile} can cause a module to erroneously load twice,
and in the case of Roles, this is a bad thing.

Because %INC is fixed on >5.10 to properly report source failures,
the edge case that delete $INC{$pmfile} was aimed at solving only happens when

a) some code doesn't use Module::Runtime/Class::Load to load a module,
but instead uses eval { require } method, *prior* to you using Class::Load to
load that module.

and

b) Code runs on Perl 5.8

and

c) Code contains a syntax error

and only loaded the second time via Module::Runtime.

And given this happens substantially less often than people want to use
Class::Load to load a role on >5.10, its just causing more problems than it
fixes.

And as it is, as long as all code on <5.8 uses Module::Runtime to load modules,
then Module::Runtime will solve this issue itself because it deletes from %INC
*after* failure.

So that only left the fringe benefit of giving a more useful error on >5.10 ,
which is mitigated by the fact Module::Runtime is smart enough to report that
its refusing to reload the module a *second* time, ( ie: inferring it broke the
first time ).