A Simplified Interface for Module::UseFrom

A couple days ago I released Module::UseFrom and I asked Schwern for his comments since it was addressing an issue that I knew he was very familiar with.

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

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.

Leave a comment

About Joel Berger

user-pic As I delve into the deeper Perl magic I like to share what I can.