I've built a few Pas based applicaitons at work and attempting
to manage potentially complex, nested or hirarchical configuration data
is becomeing a bit tiresome using the key=value syntax of the current
configuration object.
We were talking about the configuration use cases for another peice of
Perl software at work and Chip Salzenberg poitned out XML::Simple.
It's a fairly standard module (Mandrake has an rpm for it). Take
a quick look at the perldoc, it gives a great overview of how easy
it really is to use.
In the case of Pas, we could be using XML::Simple to read and write
configuration file(s). We could start to seperate out different
aspects of the system, like Pas configuration from URI/page registration.
We could introduce the concept of data sources (similar to Struts), where
you configure the DBI dsn(s) in the configuration and then just
request the dbi handle by logical data source name.
If the page registraiton is seperated out into a series of one or more
files, it might be easier to re-configure or add in new registered page
objects at run-time without restarting Apache.
Using an XML formatted configuration file openes up the ability to store
more complexly structured configuration data. It would make the
configuration data easier to process by external tools (someone could
create a configuration GUI, and all it would need to know about would
be the XML syntax).
Plus XML is more politically palletable, and switching to XML for
the configuration syntax might push us to integrate it into
other areas of Pas as well.
That's about it for the configuration idea. I've got another random
idea that you can read below if you're interested.
Hrm...I just realized that the whole DDL XML idea from before could
easily become a reality using XML::Simple. Create your database meta
description in XML, run a utiilty to generate the DDL for creating
the database itself:
xmlddl --ddl --db Oracle dataModel.xml
xmlddl --ddl --db PostgreSQL dataModel.xml
xmlddl --ddl --db MySQL dataModel.xml
Then a tool (maybe the one tool generates the objects as well) to
generate the data access layer:
xmlddl --obj --db PostgreSQL --package MyApp::DB --parent MyApp::DB::Base dataModel.xml
The idea of xmlddl to generate object wrapper(s) could be easily extended
to other languages as well. Since the ddlxml should be listing foreign
key relationships, the generated code should be able to automatically
work in table joins so with the generated code you might be able to
do something like:
my $product = $dataSource->load(
'product',
'filter' => {'ID' => '01234' },
'join' => { table => 'price', 'filter' => {'cust_id'=>123} }
);
and the dataSource would be smart enough to know that the 'product' table
corresponded to some object, and to load the pricing records by joining
with a fk based on the ddlxml, and a filter for cust_id...
A tool to try to reverse-engineer the db into the ddlxml would be a good
starting piont for many projects. Another interesting twist on top of
that idea is:
http://diffxml.sourceforge.net/
If we had a reliable 'ddlxml --reverseEngineer', you could xmldiff your
database changes to arrive at the necessary alter table commands necessary
to syncronize two database instances between versions or environments.
Kyle
--
------------------------------------------------------------------------------
Wisdom and Compassion are inseparable.
-- Christmas Humphreys
mo...@vo... http://www.voicenet.com/~mortis
------------------------------------------------------------------------------
|