David Baird wrote:
use Test::WWW::Mechanize::Maypole 'BeerDB';
This is a great tool! Thanks, Dave.
To be able to test my real application, I'd like to be able to run my
real application against a test database with known content. So I
changed the start of Test::WWW::Mechanize::Maypole::import to be like this:
use NEXT;
sub import
{
my ( $class, $app, @db_args ) = @_;
if (@db_args > 0)
{
eval <<" SETUP";
package $app;
sub setup {
shift->NEXT::DISTINCT::setup(qw(@db_args));
}
SETUP
die $@ if $@;
}
... and the rest as before
Now I can say things like:
use Test::WWW::Mechanize::Maypole 'BeerDB',
'dbi:SQLite:test-beerdb.db';
or
use Test::WWW::Mechanize::Maypole 'BeerDB',
'dbi:mysql:beer_d_b', 'dhoworth', 'password';
Oh, it's backwards compatible :) In the sense that it still passes its
own tests.
Cheers, Dave
-------------------------------------------------------
SF.Net email is sponsored by:
Tame your development challenges with Apache's Geronimo App Server. Download
it for free - -and be entered to win a 42" plasma tv or your very own
Sony(tm)PSP. Click here to play: http://sourceforge.net/geronimo.php
_______________________________________________
Maypole-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/maypole-users