aplonis has asked for the wisdom of the Perl Monks concerning the following question:
I would like to execute Perl commands contained in a string. The string in question may be any arbitrary Perl code as typed by user into a Tk Text widget.
This is for a data editor, so commands must execute in same main package as for the Tk widget which called it so as to act upon same vars, arrays and hashes as exist in said package.
I have tried 'exec' but it seems to execute independently, as if in some wholly different package. In Forth all that would be required is to make the string executable and call it. How would one accomplish such a feat in Perl?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Execute commands in a string
by etcshadow (Priest) on Aug 15, 2004 at 19:38 UTC | |
by aplonis (Pilgrim) on Aug 15, 2004 at 20:13 UTC | |
|
Re: Execute commands in a string
by Aristotle (Chancellor) on Aug 15, 2004 at 19:24 UTC | |
|
Re: Execute commands in a string
by saintmike (Vicar) on Aug 15, 2004 at 19:26 UTC | |
by PodMaster (Abbot) on Aug 15, 2004 at 20:02 UTC | |
|
Re: Execute commands in a string
by CountZero (Bishop) on Aug 15, 2004 at 19:27 UTC |