2011-04-15

keep track of your tk widgets easily

when writing a tk application, it's almost always a good idea to keep track of your widgets: this allows to change their state later on.

most of the time, a simple hash is enough; but it is usually wrapped up in methods to make the hash private to the window object. and of course, those methods are duplicated in all modules, under a form or another...

since duplication is bad, i just released Tk::Role::HasWidgets which is a moose role, and provides with a convenient way to store & retrieve your widgets:
use Moose;
    with 'Tk::Role::HasWidgets';

    # when creating a widget
    $self->_set_w( 'my_button', $button );

    # later on, in one of the methods
    $self->_w( 'my_button' )->configure( ... );

the methods featured in this role begin with "_", that is, they are following perl convention of private methods. this is on purpose: remember that this module is a role, consumed by your class. and you don't want those methods to be available outside of the window class, do you?

2011-04-12

a bit of dwimery in magpie

all the pieces were available, binding them together was just a smop. therefore magpie just got a new subcommand: "magpie dwim" which does exactly what i mean...

in the case of magpie, what i mean is of course:
  • check which perl packages are not up to date wrt cpan
  • check them out
  • tighten spec file
  • update the package to latest version
  • commit result
  • wait for build system if needed
  • submit result
and all of this is done in parallel, with errors reported at the end.
you too can have some fun:
$ sudo urpmi magpie
$ magpie dwim

maintaining the ~2500 perl module rpm packages in mageia has never been so easy!