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

I am after some advice/comments etc on a table data system I am writing for work. I have tried using a few module available on CPAN but I was getting slow results on lookups with tables over 2/3000 records so I thought I would have a go..... I currently use 3 hashes
1) holds the basic table data %T{tableName}=[['A','B',undef,'C'],['1','2',undef,'3'],['1','2',undef, +'67']]; 2) hold the column names for each table %C{tableName}={ 'serialno' => 0, 'type' => 1, 'hardware' => 2, 'software' => 3, }); 3) holds any required indexes %I{tableName}{_checksum}{'A'}=ref_to_row ['A','B',undef,'C'] %I{tableName}{_checksum}{'1'}=ref_to_row ['1','2',undef,'3']
_checksum relates to which columns make up the index. ie col 0 is 1, col 1 is 2, col 3 is 4, col 1+3 is 5 etc.
Indexes are created dynamically during a lookup and held in the hash for use later with any similar lookups. So if we want to perform a lookup for the row with 'A' in column 1 ie lookup(tableName,{serialno=>'A'}) we simply follow the reference in the index hash.
Things i would like to improve.
1) processing every element in a table currently I do a
foreach $row (@{getTable(tableName}) # getTable() returns the ref f +rom $T{tableName}; { $row->[getColumn(tableName,'software']='updated'; # getColumn() + simply returns the result of $C{tableName}{colName} }
This works ok but I would like to find a way of NOT having to state the tableName within the loop in the call to getColumn. After all the $row is part of the table so something like
foreach $row (@{getTable(tableName}) # getTable() returns the ref f +rom $T{tableName}; { $row->column('software'); # using OO in some way ? or element($row,'software) # not so good - uses a hash of row +reference addresses to enable me to find which table any row is in }
2) mentioned OO above but I have not really used it with Perl. I'm looking into rewriting and I think it will work quite well but I'm having problems seeing how to relate tables and rows. I can bless a table into being which would contain column names and indexes. Do I make the rows sub-objects of the table ? Any ideas on how to do this so that from any given row we can find which table it is in. if all rows are objects then how do we loop through every object in a class ?
i.e foreach $row ($table)
Thanks again - any comments welcome.