]> git.decadent.org.uk Git - maypole.git/blob - Makefile.PL
Fixed mime type setting, fixed errors in revision 445, folded in Maypole::Component...
[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         File::MMagic::XS                => 0.08,
32     },    # e.g., Module::Name => 1.1
33     (
34         $] >= 5.005
35         ?    ## Add these new keywords supported since 5.005
36           (
37             ABSTRACT_FROM => 'lib/Maypole.pm',   # retrieve abstract from module
38             AUTHOR => 'Aaron TEEJAY Trevena <teejay#droogs.org>'
39           )
40         : ()
41     ),
42 );
43
44 sub has_module {
45     my ($module, $version) = @_;
46     (my $file = "$module.pm") =~ s/::/\//g;
47     eval {require $file} or return;
48     return ($module->VERSION || 0) >= $version;
49 }
50
51 if ( !-e "t/beerdb.db" ) {
52     print "Making SQLite DB\n";
53     my $driver = 'SQLite';
54     eval { require DBD::SQLite } or do {
55         print "Error loading DBD::SQLite, trying DBD::SQLite2\n";
56         eval {require DBD::SQLite2} ? $driver = 'SQLite2'
57             : die "DBD::SQLite2 is not installed";
58     };
59     require DBI;
60     my $dbh = DBI->connect("dbi:$driver:dbname=t/beerdb.db");
61     my $sql = join( '', (<DATA>) );
62
63     for my $statement ( split /;/, $sql ) {
64         $statement =~ s/\#.*$//mg;           # strip # comments
65         $statement =~ s/auto_increment//g;
66         next unless $statement =~ /\S/;
67         eval { $dbh->do($statement) };
68         die "$@: $statement" if $@;
69     }
70 }
71
72 __DATA__
73
74 create table brewery (
75     id integer auto_increment primary key,
76     name varchar(30),
77     url varchar(50),
78     notes text
79 );
80
81 create table beer (
82     id integer auto_increment primary key,
83     brewery integer,
84     style integer,
85     name varchar(30),
86     url varchar(120),
87 #    tasted date,
88     score integer(2),
89     price varchar(12),
90     abv varchar(10),
91     notes text
92 );
93
94 create table handpump (
95     id integer auto_increment primary key,
96     beer integer,
97     pub integer
98 );
99
100 create table pub (
101     id integer auto_increment primary key,
102     name varchar(60),
103     url varchar(120),
104     notes text
105 );
106
107 create table style (
108     id integer auto_increment primary key,
109     name varchar(60),
110     notes text
111 );
112
113 INSERT INTO beer (id, brewery, name, abv) VALUES
114     (1, 1, "Organic Best Bitter", "4.1");
115 INSERT INTO brewery (id, name, url) VALUES
116     (1, "St Peter's Brewery", "http://www.stpetersbrewery.co.uk/");
117 INSERT INTO pub (id, name) VALUES (1, "Turf Tavern");
118 INSERT INTO handpump (id, pub, beer) VALUES (1, 1,1);
119