Perl Monk, Perl Meditation | |
PerlMonks |
Wx and MVCby rvosa (Curate) |
on Aug 10, 2006 at 00:03 UTC ( [id://566515]=perlquestion: print w/replies, xml ) | Need Help?? |
rvosa has asked for the wisdom of the Perl Monks concerning the following question:
Dear monks,
I'm writing my first GUI app using wxglade. I'm trying to come up with a sensible MVC-ish architecture. The way wxglade works is that you can define handlers for events, e.g., a button is pressed, and a subroutine \&handle_button_press (or whatever) is called. In the wxglade interface you can specify the name of the handler, and then when you generate gui code, a stub for the handler is generated as well. I can imagine the end result being an enormous file with gui code plus lots of stubs I am supposed to fill in in the same file. This seems spaghetti-ish (and not very MVC). I figured the following could work: I do this code generation thing as wxglade wants me to, then I delete all the handler stubs, and instead write an AUTOLOAD sub that, using $AUTOLOAD calls something like $Model->update( '-message' => $AUTOLOAD ), were the $Model in turn calls $self->notify_listeners( '-message' => $AUTOLOAD ). I'm wondering if I'm on the right track with this or whether I'm missing something obvious. Thanks!
Back to
Seekers of Perl Wisdom
|
|