in reply to Database Search Approaches
The advantages of this is that you don't have to alter the main script any time you want to add a table, and there is only one place new tables and modules need to be added. Down sides are that it uses string eval to pull in the module at run time, that can cause delays as the compiler fires up again, and it risks that if someone gets some malicious code into your configuration you could have a serious problem.#called as Searchable->getTableHandler($table); sub getTableHandler { my $class = shift; my $table = shift; #get $handlerClass from db eval "use $handlerClass;"; #deal with errors return $handlerClass->new($table); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Database Search Approaches
by Tanktalus (Canon) on Aug 23, 2005 at 23:42 UTC | |
Re^2: Database Search Approaches
by saberworks (Curate) on Aug 23, 2005 at 21:20 UTC |