]> git.decadent.org.uk Git - maypole.git/blob - Makefile.PL
fixed bug 16869 - forced inheritance of model
[maypole.git] / Makefile.PL
1 use 5.006;
2 use ExtUtils::MakeMaker;
3
4 # See lib/ExtUtils/MakeMaker.pm for details of how to influence
5 # the contents of the Makefile that is written.
6 WriteMakefile(
7     NAME         => 'Maypole',
8     VERSION_FROM => 'lib/Maypole.pm',    # finds $VERSION
9     PREREQ_PM    => {
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,
17         Class::DBI                       => 0.96,
18         Class::DBI::SQLite               => 0,
19         CGI::Untaint                     => 0,
20         UNIVERSAL::moniker               => 0,
21         UNIVERSAL::require               => 0,
22         URI                              => 0,
23         URI::QueryParam                  => 0,
24         CGI::Simple                      => 0,
25         HTTP::Headers                    => 1.59,
26         HTTP::Body                       => 0.5,
27         Template                         => 0,
28         Template::Plugin::Class          => 0,
29         Test::MockModule                 => 0,
30         Digest::MD5                                  => 0,
31     },    # e.g., Module::Name => 1.1
32     (
33         $] >= 5.005
34         ?    ## Add these new keywords supported since 5.005
35           (
36             ABSTRACT_FROM => 'lib/Maypole.pm',   # retrieve abstract from module
37             AUTHOR => 'Simon flack <simonflk#cpan.org>'
38           )
39         : ()
40     ),
41 );
42
43 sub has_module {
44     my ($module, $version) = @_;
45     (my $file = "$module.pm") =~ s/::/\//g;
46     eval {require $file} or return;
47     return ($module->VERSION || 0) >= $version;
48 }
49
50 if ( !-e "t/beerdb.db" ) {
51     print "Making SQLite DB\n";
52     my $driver = 'SQLite';
53     eval { require DBD::SQLite } or do {
54         print "Error loading DBD::SQLite, trying DBD::SQLite2\n";
55         eval {require DBD::SQLite2} ? $driver = 'SQLite2'
56             : die "DBD::SQLite2 is not installed";
57     };
58     require DBI;
59     my $dbh = DBI->connect("dbi:$driver:dbname=t/beerdb.db");
60     my $sql = join( '', (<DATA>) );
61
62     for my $statement ( split /;/, $sql ) {
63         $statement =~ s/\#.*$//mg;           # strip # comments
64         $statement =~ s/auto_increment//g;
65         next unless $statement =~ /\S/;
66         eval { $dbh->do($statement) };
67         die "$@: $statement" if $@;
68     }
69 }
70
71 __DATA__
72
73 create table brewery (
74     id integer auto_increment primary key,
75     name varchar(30),
76     url varchar(50),
77     notes text
78 );
79
80 create table beer (
81     id integer auto_increment primary key,
82     brewery integer,
83     style integer,
84     name varchar(30),
85     url varchar(120),
86 #    tasted date,
87     score integer(2),
88     price varchar(12),
89     abv varchar(10),
90     notes text
91 );
92
93 create table handpump (
94     id integer auto_increment primary key,
95     beer integer,
96     pub integer
97 );
98
99 create table pub (
100     id integer auto_increment primary key,
101     name varchar(60),
102     url varchar(120),
103     notes text
104 );
105
106 create table style (
107     id integer auto_increment primary key,
108     name varchar(60),
109     notes text
110 );
111
112 INSERT INTO beer (id, brewery, name, abv) VALUES
113     (1, 1, "Organic Best Bitter", "4.1");
114 INSERT INTO brewery (id, name, url) VALUES
115     (1, "St Peter's Brewery", "http://www.stpetersbrewery.co.uk/");
116 INSERT INTO pub (id, name) VALUES (1, "Turf Tavern");
117 INSERT INTO handpump (id, pub, beer) VALUES (1, 1,1);
118