|
|
| more useful options | |
| PerlMonks |
SDLx handlers and Mooseby Ransom (Beadle) |
| on May 24, 2012 at 19:21 UTC ( #972299=perlquestion: print w/ replies, xml ) | Need Help?? |
|
Ransom has asked for the
wisdom of the Perl Monks concerning the following question:
Hey monks, back again with another puzzler.
I'm testing out SDL and SDLx, as well as learning Moose. According to the SDLx docs, when setting up move and show handler callbacks, SDLx will automatically pass some variables in. Namely, ($step, $app, $time) = @_;. This was all well and good when I was practicing outside of Moose. All values were passed correctly. Once Moose was incorporated, I passed an object method as the callback instead of a sub in the main file. Now when the callback is called, I only receive the blessed hashref of the object, none of the $step, $app, or $time values. This effectively breaks my movement and drawing methods. The main code is like this:
As you can see, I've stripped the methods of anything useful in order to just print the argument lists. The counter example of this is to move the callback method to the main file, in which it will pass all the values the documentation specifies. How can I get the values from SDLx app stuff into my Moose method calls? Occasionally putting words into a post is beyond my ability so please don't hesitate to ask me for more information or a better description. Ransom
Back to
Seekers of Perl Wisdom
|
|
||||||||||||||||||||||||||||||||||||