in reply to Re: Named captures or positional variables
in thread Named captures or positional variables

Maybe something like use revar name => "regex";

or use revar '$name' => "regex";

(Which are similar to use constant or use vars)

Note: I suspect this would create "our" variables. Is it possible for a pragma to create "my" variables in the use-ing package?

Replies are listed 'Best First'.
Re^3: Named captures or positional variables
by LanX (Saint) on Dec 11, 2014 at 01:18 UTC
    > Is it possible for a pragma to create "my" variables in the use-ing package?

    If lexical variables are already declared in the calling package, you can change their value, e.g. with PadWalker.

    Otherwise it wouldn't compile under strict if you try to use them.

    Cheers Rolf

    (addicted to the Perl Programming Language and ☆☆☆☆ :)

      Declaration can be worked around using parser hacks. That's what Object::Util does. It declares and populates lexical variables for the caller. (Though it falls back to package variables if it's unable to do the parser hacking stuff.)