in reply to Re: Tk programming style
in thread Tk programming style

Thank you Aristotle, this is exactly the kind of feedback I was looking for.

Your idea for handling the buttons in the activity_configure sub is excellent - very clear and concise. Though I would probably have used a hash instead of @button, and used each instead of splice.

Regarding OO, this has prompted me to review and assess the plethora of Class::* modules on CPAN. Having activity as a class will present a neater way of dealing with the callbacks, as methods, but it still looks that "Next" will be difficult to implement. Can I get the toplevel widget to return me the next frame I wonder?

Regarding the .ini save, I prefer my original, as the heredoc stands out and makes it obvious what is happening. Admittedly, I could refactor the time calculation into a sub - which may become a method in my new class.

Replies are listed 'Best First'.
Re^3: Tk programming style
by Aristotle (Chancellor) on Nov 07, 2002 at 14:01 UTC
    But the way the save loop is set up, it reduces some duplication, and you can still add a # SAVE ACTIVITIES to make it stand out. :-) Actually, I didn't take it far enough - it should have been:
    for (@activity) { print SAVE "[Button]\n"; my $item; print SAVE "$prop=" . $_->$prop() for $_->properties; }
    where properties() simply looks like sub properties { qw(legend time elapsed) } and then the INI saving loop doesn't require any maintance at all any more.

    Makeshifts last the longest.