The way it's done now allows for the mutual inclusion of two modules. The way you suggest would cause an infinite loop.
The way it's done now takes into consideration that the re-running a module that failed in an uncontrolled fashion is a bad idea.
If the module dies in a controled fashion (by returning a specific value or by throwing a specific exception indicating it's safe to reload the module), you can circumvent the %INC check by using do or by clearing the appropriate entry in %INC.
(my $module = "$class.pm") =~ s{::}{/}g; if (!eval { require $module }) { die $@ if ((my $e = $@) !~ /.../); # Fix something ... # Try again delete $INC{$module}; require $module; }
In reply to Re: How not to check if a module is installed
by ikegami
in thread How not to check if a module is installed
by xdg
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |