in reply to Cant figure out this part?
Here is a decent explanation of callbacks, the tutorial is really about Gtk. Callbacks are used extensively in GUI programming. The idea is to assign a subroutine to a widget such as a button. When the user clicks that button, the button calls the subroutine that was assigned to it. This allows the GUI programmer to easily add functionality.use strict; sub decorate { my ($cb,$text) = @_; return $cb->($text); } my %sub = ( bold => sub { return '<b>' . shift() . '</b>' }, ital => sub { return '<i>' . shift() . '</i>' }, undl => sub { return '<u>' . shift() . '</u>' }, ); for (keys %sub) { print decorate($sub{$_},'foobar'), "\n"; }
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|