in reply to Re^4: SDLx handlers and Moose
in thread SDLx handlers and Moose
Why I must pass @_ to the sub when it was implicit before in this example:
The callbacks are function references. They're not methods; they have no invocants. SDL will invoke those references and pass the parameters it wants to them. SDL doesn't know you're using methods. SDL doesn't know which objects you want to use.
Because you want to call methods on objects, you have to give SDL callbacks which are closures which then invoke methods on your objects.
Because you're using that layer of indirection, you have to pass the arguments to your methods directly.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^6: SDLx handlers and Moose
by Ransom (Beadle) on May 29, 2012 at 12:09 UTC | |
by chromatic (Archbishop) on May 29, 2012 at 18:36 UTC |