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