in reply to perlTk sample that shows sambastatus

Some coding critique (not knowing anything about Tk):
$hlist->header('create', 0, -text => 'user'); $hlist->header('create', 1, -text => 'gid'); $hlist->header('create', 2, -text => 'pid'); $hlist->header('create', 3, -text => 'machine'); $hlist->header('create', 4, -text => 'service'); $hlist->header('create', 5, -text => 'ip-adres'); $hlist->header('create', 6, -text => 'logon time');
I would code this as:
my $option = 0; foreach (qw(user gid pid machine service ip-adres logon)) { $hlist->header('create', $option++, -text => $_); }
because I hate to repeat things myself that can be repeated by the computer. And I would try to do something similar for the rest of the snippet. And yes, I cheated a little by changing "logon time" to "logon" to make it work with qw(). ;-)

Liz

Replies are listed 'Best First'.
Re: Re: perlTk sample that shows sambastatus
by teabag (Pilgrim) on Sep 10, 2003 at 12:45 UTC
    Excellent suggestion. I changed the code and will see if I can change the rest asap.

    thanks liz
    Teabag
    Sure there's more than one way, but one just needs one anyway - Teabag