2 use ExtUtils::MakeMaker;
3 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
4 # the contents of the Makefile that is written.
7 VERSION_FROM => 'lib/Apache/MVC.pm', # finds $VERSION
9 DBD::SQLite => 0, # For testing
10 Class::DBI::Loader => 0,
13 }, # e.g., Module::Name => 1.1
14 ($] >= 5.005 ? ## Add these new keywords supported since 5.005
15 (ABSTRACT_FROM => 'lib/Apache/MVC.pm', # retrieve abstract from module
16 AUTHOR => 'Simon Cozens <simon@nonet>') : ()),
19 if (!-e "t/beerdb.db") {
20 print "Making SQLite DB\n";
23 my $dbh = DBI->connect("dbi:SQLite:dbname=t/beerdb.db");
25 my $sql = join ( '', (<DATA>) );
27 for my $statement (split /;/, $sql) {
28 $statement =~ s/\#.*$//mg; # strip # comments
29 $statement =~ s/auto_increment//g;
30 next unless $statement =~ /\S/;
31 eval { $dbh->do($statement) };
32 die "$@: $statement" if $@;
38 create table brewery (
39 id int not null auto_increment primary key,
46 id int not null auto_increment primary key,
58 create table handpump (
59 id int not null auto_increment primary key,
65 id int not null auto_increment primary key,
71 INSERT INTO beer (id, brewery, name, abv) VALUES
72 (1, 1, "Organic Best Bitter", "4.1");
73 INSERT INTO brewery (id, name, url) VALUES
74 (1, "St Peter's Brewery", "http://www.stpetersbrewery.co.uk/");
75 INSERT INTO pub (id, name) VALUES (1, "Turf Tavern");
76 INSERT INTO handpump (id, pub, beer) VALUES (1, 1,1);