in reply to Tk bind mouse down question
\&mysub creates a reference to the sub mysub;and by davidj in the same postcalls mysub, then creates a reference to the returned value\&mysub(...)
"When you want to pass arguments to a callbakc, specify an array reference, with the callback code reference as the first element and the callback arguments as the subsequent array elements" In other words: instead ofThus... what happens is instead of binding my_test to 'can', you are executing 'my_test' and binding the result to 'can'. This happens I guess in the main_loop.you need to have$input->bind('<Return>', [\&mysub($arg)]);$input->bind('<Return>', [\&mysub, $arg]);
UPDATE: Fixed format of quoted text
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Tk bind mouse down question
by Plankton (Vicar) on Jun 01, 2004 at 15:58 UTC | |
by mawe (Hermit) on Jun 01, 2004 at 16:09 UTC |