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

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.