I'm trying to write generic code that will work for any table. The
following does work but it's ugly. (I'm still just prototyping so please
excuse the nofrills output format). I suspect I'm labouring under all sorts
of naive misunderstandings. Does anyone know ways to improve this? In
particular do I have to construct the classname like this in order to use
it?
# construct manager name
my $classname = ucfirst($table);
chop($classname);
my $mgr = "GARD::".$classname."::Manager";
# Note: I was hoping to do
# use $mgr
# at this point but that doesn't work so I am having to "use" every class
manually at the start of the script.
# construct method name
my $get_objects = "get_$table";
my $records = $mgr->$get_objects(%$searchspec); #
$mgr->get_$table(%$searchspec) doesn't work
print @$records." results found<br>";
foreach my $record (@$records) {
for (my $c=0; $c < @{$tableinfo{$table}{listfields}}; $c++) {
my $colname = $tableinfo{$table}{listfields}[$c];
print $record->$colname.", ";
}
print "<br>";
}
thanks for any pointers.
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Rose-db-object mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/rose-db-object