2 use ExtUtils::MakeMaker;
4 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
5 # the contents of the Makefile that is written.
8 VERSION_FROM => 'lib/Maypole.pm', # finds $VERSION
10 Class::DBI::Loader => '0.02',
11 Class::DBI::AbstractSearch => 0,
12 Class::DBI::Pager => 0,
13 Class::DBI::Plugin::RetrieveAll => 0,
14 Class::DBI::AsForm => 2.2,
15 Class::DBI::FromCGI => 0.94,
16 Class::DBI::Loader::Relationship => 0,
18 Class::DBI::SQLite => 0,
20 UNIVERSAL::moniker => 0,
21 UNIVERSAL::require => 0,
26 Template::Plugin::Class => 0,
27 Test::MockModule => 0,
28 }, # e.g., Module::Name => 1.1
31 ? ## Add these new keywords supported since 5.005
33 ABSTRACT_FROM => 'lib/Maypole.pm', # retrieve abstract from module
34 AUTHOR => 'Simon Cozens <simon@simon-cozens.org>'
41 my ($module, $version) = @_;
42 (my $file = "$module.pm") =~ s/::/\//g;
43 eval {require $file} or return;
44 return ($module->VERSION || 0) >= $version;
47 if ( !-e "t/beerdb.db" ) {
48 print "Making SQLite DB\n";
49 eval { require DBD::SQLite };
50 die "No, wait, we don't have SQLite installed. Never mind\n" if $@;
52 my $dbh = DBI->connect("dbi:SQLite:dbname=t/beerdb.db");
54 my $sql = join( '', (<DATA>) );
56 for my $statement ( split /;/, $sql ) {
57 $statement =~ s/\#.*$//mg; # strip # comments
58 $statement =~ s/auto_increment//g;
59 next unless $statement =~ /\S/;
60 eval { $dbh->do($statement) };
61 die "$@: $statement" if $@;
67 create table brewery (
68 id integer auto_increment primary key,
75 id integer auto_increment primary key,
87 create table handpump (
88 id integer auto_increment primary key,
94 id integer auto_increment primary key,
101 id integer auto_increment primary key,
106 INSERT INTO beer (id, brewery, name, abv) VALUES
107 (1, 1, "Organic Best Bitter", "4.1");
108 INSERT INTO brewery (id, name, url) VALUES
109 (1, "St Peter's Brewery", "http://www.stpetersbrewery.co.uk/");
110 INSERT INTO pub (id, name) VALUES (1, "Turf Tavern");
111 INSERT INTO handpump (id, pub, beer) VALUES (1, 1,1);