I have studied this issue a little more. I found that practically I do not need an ordinary (source manipulating) macro function at this case. In my case I need an access to the lexical scope of the callers environment to eval string type closures as they would exist inside the callers code.
Is there any practical method to change the lexical scope temporarily? caller() will give you some access to the callers properties but I think I need more.
sub foo { my $name="FOO"; bar("$name"); } sub bar { my $name="BAR"; print "My name is $name"; #My name is BAR function_to_do_something_using_callers_lexical_view { print "Your name is $name"; #Your name is FOO } } foo();
If there is no such function, as I fear, would it be "easy" or even possible to make a plugin which could install this kind of new core function to the interpreter? Or should I make my own Perl release ;-)
In reply to Re^2: How to simulate a preprocessor macro without one?
by AriSoft
in thread How to simulate a preprocessor macro without one?
by AriSoft
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |