Bugger, that title is horrendous.
I have a module on CPAN, Params::Lazy. I want to add a new feature as part of a bugfix, namely, that delayed arguments can see the delayer's original @_. Basically, it allows you to do this:
use Params::Lazy delay => q(^); sub delay { my ($delayed) = @_; say "delayed shift: ", force $delayed } sub calls_delay { delay shift @_; } calls_delay("original arg");
Which in the original version would've printed "delayed shift: SCALAR(whatever)", since the first argument of delay() would've been a scalar ref, and "delayed shift: original arg" in the new version.
However, this entrails some possible hits to performance, particularly when combined with threads, and it's entirely possible that people may not want the original @_ for some reason. So I'm left wondering how to provide both functionalities. I was thinking perhaps something like:
use Params::Lazy caller_args => { 'foo' => q(^^) };But it occurs to me that "using the original @_" might be the most common case, so perhaps enable it by default and have people explicitly request the old version somehow. Or perhaps something like this?
no Params::Lazy 'caller_args';I'm honestly pretty stumped, so any input is welcome!
In reply to Usable way of adding this feature to my module? by Hugmeir
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |