j0nny has asked for the wisdom of the Perl Monks concerning the following question:

I already asked a Tk::Hlist question and would have asked another in the previous node but it's better to have more answers spread out for other people :O. 1. I need to know how to get the total number of rows. Right now im just using a global variable that is modified through out a few different subs. 2. When I get an error, eg if i am getting data from a column in a row that only has one entry, the script will die with TK::Error, it croaks, or something. I need to know how to "catch" them or just prevent them from stopping the script execution. Thanks.

Replies are listed 'Best First'.
Re: Th::Hlist more questions :)
by zentara (Cardinal) on May 29, 2008 at 14:49 UTC
    Without seeing your code, to get the rows, try
    sub getlist { my $tree = shift; my @list = $tree->infoChildren(shift); if (@list) { foreach my $entry (@list) { push(@ListOfAllEntries, $entry); getlist($tree, $entry); } } } # Is there an easy way to find the # of columns and rows of a HList? # For columns: $hlist->cget(-columns) # For rows, I could not found an easy way. You can use # $hlist->info("children") to traverse the whole tree and get the row # number.

    I'm not really a human, but I play one on earth CandyGram for Mongo