A Simplified Interface for Module::UseFrom
In response to his concern that the interface is overly complicated and strays from the known
use interface, I really had to examine what I was doing, why, and how best to accomplish it. Most importantly I followed his suggestion to create a separate
use_if_available function (exported on request) rather than using flags to
In the end I needed tidier cleanup from a no-op
use_if_available and I needed some way to inform the user whether or not the module had been loaded (without being able to tuck it into a hash). The former was accomplished by injecting a no-op subroutine to catch import parameters intended for the not-available module. The latter involved using the rarely seen
dualvar to tuck the module version into the number slot of the original scalar (I thought that was rather cute).
I have released 0.02 which provides this greatly simplified interface and since I’m sure nobody jumped out to use 0.01 in a mission-critical way, I will remove it from CPAN as soon as 0.02 posts.
Special thanks to Schwern for his comments. I welcome yours if you have any.