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