local variables and fileevent script



I'm developping an application that makes use of the fileevent command to keep the GUI alive during long calculations (creating/modifing large images).
What I'm looking for is a way to "pass" the value of local variables to the script fileevent will execute once the channel gets readable/wirtable. By this time, of course, the local variables probably no longer exist, or they have other values. (besides the fact you can't access them, since the script is executed in global scope.)


proc example {fd} {
	set local_var "Hello"      _____
					|  How to make the value of
	fileevent $fd readable {	|  local_var available in
		script...	  <-____|  the fileevent script ?
	}
}

Both solutions I could think of don't really statisfy me: global variables (don't they say to avoid them whenever possible?) or enclose the script in "" instead of {} (you have to make a heavy use of quoting to get the script behave as you want.)



	
.



Relevant Pages

  • Re: doubt in a script
    ... :>>> I have a doubt in one of the script i use, i want to know what the ... portability concern should be to other ksh's, ... The Bourne shell is virtually extinct and ash ... Besides, it does so much more than creating local variables, it ...
    (comp.unix.shell)
  • Re: calculate the difference between timestamps
    ... Or is it for me & you to don't loose ... Using function arguments as local variables is good practice, ... zA-Z] matches any single letter, ... In Thomas' script [. ...
    (comp.lang.awk)
  • script USE help
    ... @dbname varchar; ... Our GUI installation modifies the value of this script. ... Exiting database ... I am guessing that you cannot use local variables in a USE command. ...
    (microsoft.public.sqlserver.server)
  • Re: Newbie needs Help Please
    ... I have decided I need to learn how to script very badly. ... grant access to Customer Service email accounts. ... the previous guideline. ... they are local variables in disguise. ...
    (microsoft.public.scripting.vbscript)