Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^3: Named captures or positional variables

by LanX (Saint)
on Dec 11, 2014 at 01:18 UTC ( [id://1109998]=note: print w/replies, xml ) Need Help??


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

> 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 ☆☆☆☆ :)

  • Comment on Re^3: Named captures or positional variables

Replies are listed 'Best First'.
Re^4: Named captures or positional variables
by tobyink (Canon) on Dec 11, 2014 at 11:25 UTC

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

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1109998]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (3)
As of 2024-04-25 06:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found