Ah, but that is not the reason I use UNIVERSAL::require.
In an effort to optimize for readability, I try to make sure that there are no bits of code that don't make perfect sense when being read.
Ofcourse, with some lines this just can't be done, but then you use comments.
The point is that eval "require $class"; is readable, but to when I read the code eval is one of the things that usually makes me pay close attention, and if this is only loading the module in $class, It's nothing special.
Loading a module is not what the lines where it's loaded are doing, but rather to what those lines need to do whatever it is they do.
By that rationale I prefer to make that code stand out less, so that I can switch focus to the important code more quickly.
I know this might sounds a bit far fetched, but I tend to have a hard time concentrating when I'm reading, unless I'm in a very good state (happy, energized, not hungry, not thirsty, not in a rush, not too jumpy, not too distracted...
|