--- Johan Vromans <[EMAIL PROTECTED]> wrote:

> I have an app that works with PostgreSQL. It depends on DPD::Pg. So
> far, so good.
> 
> However, the requirement that DBD::Pg is installed is by no means a
> guarantee that there is a database server around. And if there is,
> the
> user running the CPAN test may nog have (sufficient) access to this
> database.
> 
> What would be a good means to arm the test scripts against this?

You might want to take a look at Object::Relation.  There is a
Object::Relation::Setup class which, if you're using a Postgres
database, uses Object::Relation::Setup::PG:

 
http://search.cpan.org/dist/Object-Relation/lib/Object/Relation/Setup/DB/Pg.pm

Internally, you'll want to check out the &rules method.  This is a
state-machine driven method of validating dependencies for Postgres
setup, such as "does the database exist", "does the user exist", "does
the user have sufficient permissions", etc.

Might take a bit of getting used to, but it's pretty damned powerful.

You can see an example of a graphed version of that state machine in
Theory's journal:

 
http://justatheory.com/computers/programming/perl/fsa_rules_graph_improved.html

Cheers,
Ovid

--
Buy the book  - http://www.oreilly.com/catalog/perlhks/
Perl and CGI  - http://users.easystreet.com/ovid/cgi_course/
Personal blog - http://publius-ovidius.livejournal.com/
Tech blog     - http://use.perl.org/~Ovid/journal/

Reply via email to