NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Re: Ask use.perl.org - Class Tree + Driver API ? (Score:1)
Hi Alias,
I don't know if I understood completely what you are trying to accomplish, but I think I have developed a similar system, that is used to access different data sources (txt, ftp, http, sql, AS/400, ...) with a single interface.
Sql class in particular has the behaviour you mention, in that it supports Postgres, Mysql, Oracle, DB2, Sybase, Informix, ...
In my case, I have a "Driver" class with many subclasses like Pg, Oracle, Sybase, MSSQL, ... that are embedded in a $self->{driver} member.
When I need to specialize behaviour for (example) Postgres, I never test for driver name, but rather for a special "feature" (missing or implemented) by the database.
An example is worth 1000 words:
Don't get me wrong. This example is not very exciting, but I think the concept behind is interesting. Checking for features *across* all driver classes, creating a "common denominator" approach, rather than specializing by class.
Sorry if I have totally missed the point... :-)
Reply to This